2006-10-01 22:30:10 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 10:29:20 +00:00
|
|
|
/* Mutter Keybindings */
|
2012-12-13 01:50:43 +00:00
|
|
|
/*
|
2004-02-23 01:48:29 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
|
|
|
* Copyright (C) 2002 Red Hat Inc.
|
|
|
|
* Copyright (C) 2003 Rob Adams
|
2006-01-10 19:43:21 +00:00
|
|
|
* Copyright (C) 2004-2006 Elijah Newren
|
2012-12-13 01:50:43 +00:00
|
|
|
*
|
2001-06-06 04:47:37 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2012-12-13 01:50:43 +00:00
|
|
|
*
|
2001-06-06 04:47:37 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-12 01:42:06 +00:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-06-06 04:47:37 +00:00
|
|
|
*/
|
|
|
|
|
2013-02-18 13:19:28 +00:00
|
|
|
/**
|
|
|
|
* SECTION:keybindings
|
|
|
|
* @Title: MetaKeybinding
|
|
|
|
* @Short_Description: Key bindings
|
|
|
|
*/
|
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "config.h"
|
2014-04-07 18:24:53 +00:00
|
|
|
|
2017-07-10 09:39:07 +00:00
|
|
|
#include "backends/meta-backend-private.h"
|
2019-11-14 02:59:25 +00:00
|
|
|
#include "backends/meta-keymap-utils.h"
|
2016-12-13 02:37:11 +00:00
|
|
|
#include "backends/meta-logical-monitor.h"
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "backends/meta-monitor-manager-private.h"
|
2014-04-23 20:23:26 +00:00
|
|
|
#include "backends/x11/meta-backend-x11.h"
|
2020-11-17 13:59:42 +00:00
|
|
|
#include "backends/x11/meta-input-device-x11.h"
|
2019-02-20 10:53:54 +00:00
|
|
|
#include "compositor/compositor-private.h"
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "core/edge-resistance.h"
|
|
|
|
#include "core/frame.h"
|
|
|
|
#include "core/keybindings-private.h"
|
|
|
|
#include "core/meta-accel-parse.h"
|
|
|
|
#include "core/meta-workspace-manager-private.h"
|
|
|
|
#include "core/workspace-private.h"
|
|
|
|
#include "meta/compositor.h"
|
|
|
|
#include "meta/meta-x11-errors.h"
|
|
|
|
#include "meta/prefs.h"
|
2017-08-26 16:26:30 +00:00
|
|
|
#include "x11/meta-x11-display-private.h"
|
2014-06-16 22:25:40 +00:00
|
|
|
#include "x11/window-x11.h"
|
2014-05-29 16:11:26 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_NATIVE_BACKEND
|
2014-04-21 23:47:04 +00:00
|
|
|
#include "backends/native/meta-backend-native.h"
|
2014-05-29 16:11:26 +00:00
|
|
|
#endif
|
2014-03-19 02:01:31 +00:00
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
#include <linux/input.h>
|
|
|
|
#elif !defined KEY_GRAVE
|
|
|
|
#define KEY_GRAVE 0x29 /* assume the use of xf86-input-keyboard */
|
|
|
|
#endif
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
#define SCHEMA_COMMON_KEYBINDINGS "org.gnome.desktop.wm.keybindings"
|
|
|
|
#define SCHEMA_MUTTER_KEYBINDINGS "org.gnome.mutter.keybindings"
|
2013-07-16 12:37:49 +00:00
|
|
|
#define SCHEMA_MUTTER_WAYLAND_KEYBINDINGS "org.gnome.mutter.wayland.keybindings"
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
#define META_KEY_BINDING_PRIMARY_LAYOUT 0
|
|
|
|
#define META_KEY_BINDING_SECONDARY_LAYOUT 1
|
|
|
|
|
2020-03-12 18:43:15 +00:00
|
|
|
/* Only for special modifier keys */
|
|
|
|
#define IGNORED_MODIFIERS (CLUTTER_LOCK_MASK | \
|
|
|
|
CLUTTER_MOD2_MASK | \
|
|
|
|
CLUTTER_BUTTON1_MASK | \
|
|
|
|
CLUTTER_BUTTON2_MASK | \
|
|
|
|
CLUTTER_BUTTON3_MASK | \
|
|
|
|
CLUTTER_BUTTON4_MASK | \
|
|
|
|
CLUTTER_BUTTON5_MASK)
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
static gboolean add_builtin_keybinding (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 14:42:42 +00:00
|
|
|
GSettings *settings,
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
int handler_arg);
|
2008-10-06 00:24:07 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
static void
|
|
|
|
resolved_key_combo_reset (MetaResolvedKeyCombo *resolved_combo)
|
|
|
|
{
|
|
|
|
g_free (resolved_combo->keycodes);
|
|
|
|
resolved_combo->len = 0;
|
|
|
|
resolved_combo->keycodes = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
resolved_key_combo_copy (MetaResolvedKeyCombo *from,
|
|
|
|
MetaResolvedKeyCombo *to)
|
|
|
|
{
|
|
|
|
to->len = from->len;
|
2021-02-04 17:45:59 +00:00
|
|
|
to->keycodes = g_memdup2 (from->keycodes,
|
|
|
|
from->len * sizeof (xkb_keycode_t));
|
2017-04-25 11:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
resolved_key_combo_has_keycode (MetaResolvedKeyCombo *resolved_combo,
|
|
|
|
int keycode)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < resolved_combo->len; i++)
|
|
|
|
if ((int) resolved_combo->keycodes[i] == keycode)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
resolved_key_combo_intersect (MetaResolvedKeyCombo *a,
|
|
|
|
MetaResolvedKeyCombo *b)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < a->len; i++)
|
|
|
|
if (resolved_key_combo_has_keycode (b, a->keycodes[i]))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-11-04 18:18:57 +00:00
|
|
|
static void
|
|
|
|
meta_key_binding_free (MetaKeyBinding *binding)
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_key_combo_reset (&binding->resolved_combo);
|
2020-10-19 17:57:57 +00:00
|
|
|
g_free (binding);
|
2011-11-04 18:18:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static MetaKeyBinding *
|
|
|
|
meta_key_binding_copy (MetaKeyBinding *binding)
|
|
|
|
{
|
2020-10-19 17:57:57 +00:00
|
|
|
MetaKeyBinding *clone = g_memdup2 (binding, sizeof (MetaKeyBinding));
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_key_combo_copy (&binding->resolved_combo,
|
|
|
|
&clone->resolved_combo);
|
|
|
|
return clone;
|
2011-11-04 18:18:57 +00:00
|
|
|
}
|
|
|
|
|
2012-04-10 05:25:13 +00:00
|
|
|
G_DEFINE_BOXED_TYPE(MetaKeyBinding,
|
|
|
|
meta_key_binding,
|
|
|
|
meta_key_binding_copy,
|
|
|
|
meta_key_binding_free)
|
2011-11-04 18:18:57 +00:00
|
|
|
|
|
|
|
const char *
|
|
|
|
meta_key_binding_get_name (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return binding->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaVirtualModifier
|
|
|
|
meta_key_binding_get_modifiers (MetaKeyBinding *binding)
|
|
|
|
{
|
2015-01-07 02:31:33 +00:00
|
|
|
return binding->combo.modifiers;
|
2011-11-04 18:18:57 +00:00
|
|
|
}
|
|
|
|
|
2014-05-29 18:38:13 +00:00
|
|
|
gboolean
|
|
|
|
meta_key_binding_is_reversed (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0;
|
|
|
|
}
|
|
|
|
|
2011-11-04 18:18:57 +00:00
|
|
|
guint
|
|
|
|
meta_key_binding_get_mask (MetaKeyBinding *binding)
|
|
|
|
{
|
2015-01-07 22:48:32 +00:00
|
|
|
return binding->resolved_combo.mask;
|
2011-11-04 18:18:57 +00:00
|
|
|
}
|
|
|
|
|
2012-11-16 23:32:04 +00:00
|
|
|
gboolean
|
|
|
|
meta_key_binding_is_builtin (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return binding->handler->flags & META_KEY_BINDING_BUILTIN;
|
|
|
|
}
|
|
|
|
|
2008-10-06 00:24:07 +00:00
|
|
|
/* These can't be bound to anything, but they are used to handle
|
|
|
|
* various other events. TODO: Possibly we should include them as event
|
|
|
|
* handler functions and have some kind of flag to say they're unbindable.
|
|
|
|
*/
|
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
static gboolean process_mouse_move_resize_grab (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event);
|
|
|
|
|
|
|
|
static gboolean process_keyboard_move_grab (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event);
|
|
|
|
|
|
|
|
static gboolean process_keyboard_resize_grab (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event);
|
|
|
|
|
2019-07-15 11:13:45 +00:00
|
|
|
static void maybe_update_locate_pointer_keygrab (MetaDisplay *display,
|
|
|
|
gboolean grab);
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
static GHashTable *key_handlers;
|
2012-08-28 13:28:11 +00:00
|
|
|
static GHashTable *external_grabs;
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
#define HANDLER(name) g_hash_table_lookup (key_handlers, (name))
|
|
|
|
|
|
|
|
static void
|
|
|
|
key_handler_free (MetaKeyHandler *handler)
|
|
|
|
{
|
|
|
|
g_free (handler->name);
|
|
|
|
if (handler->user_data_free_func && handler->user_data)
|
|
|
|
handler->user_data_free_func (handler->user_data);
|
|
|
|
g_free (handler);
|
|
|
|
}
|
2001-06-23 05:49:35 +00:00
|
|
|
|
2012-08-28 13:28:11 +00:00
|
|
|
typedef struct _MetaKeyGrab MetaKeyGrab;
|
|
|
|
struct _MetaKeyGrab {
|
|
|
|
char *name;
|
|
|
|
guint action;
|
2015-01-07 02:24:10 +00:00
|
|
|
MetaKeyCombo combo;
|
2018-08-24 19:20:13 +00:00
|
|
|
gint flags;
|
2012-08-28 13:28:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_key_grab_free (MetaKeyGrab *grab)
|
|
|
|
{
|
|
|
|
g_free (grab->name);
|
|
|
|
g_free (grab);
|
|
|
|
}
|
|
|
|
|
2014-03-03 13:08:34 +00:00
|
|
|
static guint32
|
2017-04-25 11:17:02 +00:00
|
|
|
key_combo_key (MetaResolvedKeyCombo *resolved_combo,
|
|
|
|
int i)
|
2014-03-03 13:08:34 +00:00
|
|
|
{
|
|
|
|
/* On X, keycodes are only 8 bits while libxkbcommon supports 32 bit
|
|
|
|
keycodes, but since we're using the same XKB keymaps that X uses,
|
|
|
|
we won't find keycodes bigger than 8 bits in practice. The bits
|
|
|
|
that mutter cares about in the modifier mask are also all in the
|
|
|
|
lower 8 bits both on X and clutter key events. This means that we
|
|
|
|
can use a 32 bit integer to safely concatenate both keycode and
|
|
|
|
mask and thus making it easy to use them as an index in a
|
|
|
|
GHashTable. */
|
2017-04-25 11:17:02 +00:00
|
|
|
guint32 key = resolved_combo->keycodes[i] & 0xffff;
|
2015-01-07 22:48:32 +00:00
|
|
|
return (key << 16) | (resolved_combo->mask & 0xffff);
|
2014-03-03 13:08:34 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
reload_modmap (MetaKeyBindingManager *keys)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2017-09-01 09:45:08 +00:00
|
|
|
struct xkb_keymap *keymap = meta_backend_get_keymap (keys->backend);
|
2014-08-18 19:52:22 +00:00
|
|
|
struct xkb_state *scratch_state;
|
2014-08-15 20:23:15 +00:00
|
|
|
xkb_mod_mask_t scroll_lock_mask;
|
2015-11-03 16:52:10 +00:00
|
|
|
xkb_mod_mask_t dummy_mask;
|
2014-08-15 20:23:15 +00:00
|
|
|
|
|
|
|
/* Modifiers to find. */
|
|
|
|
struct {
|
2015-09-23 23:13:59 +00:00
|
|
|
const char *name;
|
2014-08-15 20:23:15 +00:00
|
|
|
xkb_mod_mask_t *mask_p;
|
2015-11-03 16:52:10 +00:00
|
|
|
xkb_mod_mask_t *virtual_mask_p;
|
2014-08-15 20:23:15 +00:00
|
|
|
} mods[] = {
|
2015-11-03 16:52:10 +00:00
|
|
|
{ "ScrollLock", &scroll_lock_mask, &dummy_mask },
|
|
|
|
{ "Meta", &keys->meta_mask, &keys->virtual_meta_mask },
|
|
|
|
{ "Hyper", &keys->hyper_mask, &keys->virtual_hyper_mask },
|
|
|
|
{ "Super", &keys->super_mask, &keys->virtual_super_mask },
|
2014-08-15 20:23:15 +00:00
|
|
|
};
|
|
|
|
|
2014-08-18 19:52:22 +00:00
|
|
|
scratch_state = xkb_state_new (keymap);
|
|
|
|
|
2014-08-15 20:23:15 +00:00
|
|
|
gsize i;
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (mods); i++)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2014-08-15 20:23:15 +00:00
|
|
|
xkb_mod_mask_t *mask_p = mods[i].mask_p;
|
2015-11-03 16:52:10 +00:00
|
|
|
xkb_mod_mask_t *virtual_mask_p = mods[i].virtual_mask_p;
|
2014-08-15 20:23:15 +00:00
|
|
|
xkb_mod_index_t idx = xkb_keymap_mod_get_index (keymap, mods[i].name);
|
|
|
|
|
|
|
|
if (idx != XKB_MOD_INVALID)
|
2014-08-18 19:52:22 +00:00
|
|
|
{
|
2014-08-19 18:57:48 +00:00
|
|
|
xkb_mod_mask_t vmodmask = (1 << idx);
|
|
|
|
xkb_state_update_mask (scratch_state, vmodmask, 0, 0, 0, 0, 0);
|
|
|
|
*mask_p = xkb_state_serialize_mods (scratch_state, XKB_STATE_MODS_DEPRESSED) & ~vmodmask;
|
2015-11-03 16:52:10 +00:00
|
|
|
*virtual_mask_p = vmodmask;
|
2014-08-18 19:52:22 +00:00
|
|
|
}
|
2014-08-15 20:23:15 +00:00
|
|
|
else
|
2015-11-03 16:52:10 +00:00
|
|
|
{
|
|
|
|
*mask_p = 0;
|
|
|
|
*virtual_mask_p = 0;
|
|
|
|
}
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2014-08-18 19:52:22 +00:00
|
|
|
xkb_state_unref (scratch_state);
|
|
|
|
|
2014-08-15 20:22:16 +00:00
|
|
|
keys->ignored_modifier_mask = (scroll_lock_mask | Mod2Mask | LockMask);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Ignoring modmask 0x%x scroll lock 0x%x hyper 0x%x super 0x%x meta 0x%x",
|
2014-08-14 19:33:45 +00:00
|
|
|
keys->ignored_modifier_mask,
|
2014-04-07 21:19:39 +00:00
|
|
|
scroll_lock_mask,
|
2014-08-14 19:33:45 +00:00
|
|
|
keys->hyper_mask,
|
|
|
|
keys->super_mask,
|
|
|
|
keys->meta_mask);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2014-08-14 22:14:55 +00:00
|
|
|
static gboolean
|
|
|
|
is_keycode_for_keysym (struct xkb_keymap *keymap,
|
2014-09-23 15:48:31 +00:00
|
|
|
xkb_layout_index_t layout,
|
|
|
|
xkb_level_index_t level,
|
2014-08-14 22:14:55 +00:00
|
|
|
xkb_keycode_t keycode,
|
|
|
|
xkb_keysym_t keysym)
|
|
|
|
{
|
2014-09-23 15:48:31 +00:00
|
|
|
const xkb_keysym_t *syms;
|
|
|
|
int num_syms, k;
|
2014-08-14 22:14:55 +00:00
|
|
|
|
2014-09-23 15:48:31 +00:00
|
|
|
num_syms = xkb_keymap_key_get_syms_by_level (keymap, keycode, layout, level, &syms);
|
|
|
|
for (k = 0; k < num_syms; k++)
|
2014-08-14 22:14:55 +00:00
|
|
|
{
|
2014-09-23 15:48:31 +00:00
|
|
|
if (syms[k] == keysym)
|
|
|
|
return TRUE;
|
2014-08-14 22:14:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GArray *keycodes;
|
|
|
|
xkb_keysym_t keysym;
|
2014-09-23 15:48:31 +00:00
|
|
|
xkb_layout_index_t layout;
|
|
|
|
xkb_level_index_t level;
|
2014-08-14 22:14:55 +00:00
|
|
|
} FindKeysymData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
get_keycodes_for_keysym_iter (struct xkb_keymap *keymap,
|
|
|
|
xkb_keycode_t keycode,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
FindKeysymData *search_data = data;
|
|
|
|
GArray *keycodes = search_data->keycodes;
|
|
|
|
xkb_keysym_t keysym = search_data->keysym;
|
2014-09-23 15:48:31 +00:00
|
|
|
xkb_layout_index_t layout = search_data->layout;
|
|
|
|
xkb_level_index_t level = search_data->level;
|
2014-08-14 22:14:55 +00:00
|
|
|
|
2014-09-23 15:48:31 +00:00
|
|
|
if (is_keycode_for_keysym (keymap, layout, level, keycode, keysym))
|
2017-04-25 11:17:02 +00:00
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
gboolean missing = TRUE;
|
|
|
|
|
|
|
|
/* duplicate keycode detection */
|
|
|
|
for (i = 0; i < keycodes->len; i++)
|
|
|
|
if (g_array_index (keycodes, xkb_keysym_t, i) == keycode)
|
|
|
|
{
|
|
|
|
missing = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (missing)
|
|
|
|
g_array_append_val (keycodes, keycode);
|
|
|
|
}
|
2014-08-14 22:14:55 +00:00
|
|
|
}
|
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
static void
|
|
|
|
add_keysym_keycodes_from_layout (int keysym,
|
|
|
|
MetaKeyBindingKeyboardLayout *layout,
|
|
|
|
GArray *keycodes)
|
|
|
|
{
|
|
|
|
xkb_level_index_t layout_level;
|
|
|
|
|
2017-11-01 02:53:59 +00:00
|
|
|
for (layout_level = 0;
|
|
|
|
layout_level < layout->n_levels && keycodes->len == 0;
|
|
|
|
layout_level++)
|
2017-09-01 09:46:53 +00:00
|
|
|
{
|
|
|
|
FindKeysymData search_data = (FindKeysymData) {
|
|
|
|
.keycodes = keycodes,
|
|
|
|
.keysym = keysym,
|
|
|
|
.layout = layout->index,
|
|
|
|
.level = layout_level
|
|
|
|
};
|
|
|
|
xkb_keymap_key_for_each (layout->keymap,
|
|
|
|
get_keycodes_for_keysym_iter,
|
|
|
|
&search_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-10 11:34:26 +00:00
|
|
|
/* Original code from gdk_x11_keymap_get_entries_for_keyval() in
|
|
|
|
* gdkkeys-x11.c */
|
2017-04-25 11:17:02 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
get_keycodes_for_keysym (MetaKeyBindingManager *keys,
|
2014-08-14 22:14:55 +00:00
|
|
|
int keysym,
|
2017-04-25 11:17:02 +00:00
|
|
|
MetaResolvedKeyCombo *resolved_combo)
|
2013-04-10 11:34:26 +00:00
|
|
|
{
|
2017-09-01 09:46:53 +00:00
|
|
|
unsigned int i;
|
2017-08-17 09:04:13 +00:00
|
|
|
GArray *keycodes;
|
2013-04-10 11:34:26 +00:00
|
|
|
int keycode;
|
|
|
|
|
2017-08-17 09:04:13 +00:00
|
|
|
keycodes = g_array_new (FALSE, FALSE, sizeof (xkb_keysym_t));
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2014-04-07 18:49:46 +00:00
|
|
|
/* Special-case: Fake mutter keysym */
|
|
|
|
if (keysym == META_KEY_ABOVE_TAB)
|
|
|
|
{
|
2014-04-07 18:24:53 +00:00
|
|
|
keycode = KEY_GRAVE + 8;
|
2017-08-17 09:04:13 +00:00
|
|
|
g_array_append_val (keycodes, keycode);
|
2014-04-07 18:49:46 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (keys->active_layouts); i++)
|
2017-08-17 09:04:13 +00:00
|
|
|
{
|
2017-09-01 09:46:53 +00:00
|
|
|
MetaKeyBindingKeyboardLayout *layout = &keys->active_layouts[i];
|
|
|
|
|
|
|
|
if (!layout->keymap)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
add_keysym_keycodes_from_layout (keysym, layout, keycodes);
|
2017-08-17 09:04:13 +00:00
|
|
|
}
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2014-04-07 18:49:46 +00:00
|
|
|
out:
|
2017-08-17 09:04:13 +00:00
|
|
|
resolved_combo->len = keycodes->len;
|
|
|
|
resolved_combo->keycodes =
|
|
|
|
(xkb_keycode_t *) g_array_free (keycodes,
|
|
|
|
keycodes->len == 0 ? TRUE : FALSE);
|
2014-04-07 18:51:13 +00:00
|
|
|
}
|
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
typedef struct _CalculateLayoutLevelsState
|
|
|
|
{
|
|
|
|
struct xkb_keymap *keymap;
|
|
|
|
xkb_layout_index_t layout_index;
|
|
|
|
|
|
|
|
xkb_level_index_t out_n_levels;
|
|
|
|
} CalculateLayoutLevelState;
|
|
|
|
|
2014-09-23 15:48:31 +00:00
|
|
|
static void
|
2017-09-01 09:46:53 +00:00
|
|
|
calculate_n_layout_levels_iter (struct xkb_keymap *keymap,
|
|
|
|
xkb_keycode_t keycode,
|
|
|
|
void *data)
|
2014-09-23 15:48:31 +00:00
|
|
|
{
|
2017-09-01 09:46:53 +00:00
|
|
|
CalculateLayoutLevelState *state = data;
|
|
|
|
xkb_level_index_t n_levels;
|
2014-09-23 15:48:31 +00:00
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
n_levels = xkb_keymap_num_levels_for_key (keymap,
|
|
|
|
keycode,
|
|
|
|
state->layout_index);
|
|
|
|
|
|
|
|
state->out_n_levels = MAX (n_levels, state->out_n_levels);
|
2014-09-23 15:48:31 +00:00
|
|
|
}
|
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
static xkb_level_index_t
|
|
|
|
calculate_n_layout_levels (struct xkb_keymap *keymap,
|
|
|
|
xkb_layout_index_t layout_index)
|
|
|
|
|
2014-09-23 15:48:31 +00:00
|
|
|
{
|
2017-09-01 09:46:53 +00:00
|
|
|
CalculateLayoutLevelState state = {
|
|
|
|
.keymap = keymap,
|
|
|
|
.layout_index = layout_index,
|
2014-09-23 15:48:31 +00:00
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
.out_n_levels = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
xkb_keymap_key_for_each (keymap, calculate_n_layout_levels_iter, &state);
|
|
|
|
|
|
|
|
return state.out_n_levels;
|
2014-09-23 15:48:31 +00:00
|
|
|
}
|
|
|
|
|
2013-04-10 11:34:26 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
reload_iso_next_group_combos (MetaKeyBindingManager *keys)
|
2013-04-10 11:34:26 +00:00
|
|
|
{
|
|
|
|
const char *iso_next_group_option;
|
|
|
|
int i;
|
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
for (i = 0; i < keys->n_iso_next_group_combos; i++)
|
|
|
|
resolved_key_combo_reset (&keys->iso_next_group_combo[i]);
|
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
keys->n_iso_next_group_combos = 0;
|
2013-04-10 11:34:26 +00:00
|
|
|
|
|
|
|
iso_next_group_option = meta_prefs_get_iso_next_group_option ();
|
|
|
|
if (iso_next_group_option == NULL)
|
|
|
|
return;
|
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
get_keycodes_for_keysym (keys, XKB_KEY_ISO_Next_Group, keys->iso_next_group_combo);
|
|
|
|
|
|
|
|
if (keys->iso_next_group_combo[0].len == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
keys->n_iso_next_group_combos = 1;
|
2013-04-10 11:34:26 +00:00
|
|
|
|
|
|
|
if (g_str_equal (iso_next_group_option, "toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "lalt_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "lwin_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "rwin_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "lshift_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "rshift_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "lctrl_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "rctrl_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "sclk_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "menu_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "caps_toggle"))
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
keys->iso_next_group_combo[0].mask = 0;
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
else if (g_str_equal (iso_next_group_option, "shift_caps_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "shifts_toggle"))
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
keys->iso_next_group_combo[0].mask = ShiftMask;
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
else if (g_str_equal (iso_next_group_option, "alt_caps_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "alt_space_toggle"))
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
keys->iso_next_group_combo[0].mask = Mod1Mask;
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
else if (g_str_equal (iso_next_group_option, "ctrl_shift_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "lctrl_lshift_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "rctrl_rshift_toggle"))
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_key_combo_copy (&keys->iso_next_group_combo[0],
|
|
|
|
&keys->iso_next_group_combo[1]);
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
keys->iso_next_group_combo[0].mask = ShiftMask;
|
|
|
|
keys->iso_next_group_combo[1].mask = ControlMask;
|
|
|
|
keys->n_iso_next_group_combos = 2;
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
else if (g_str_equal (iso_next_group_option, "ctrl_alt_toggle"))
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_key_combo_copy (&keys->iso_next_group_combo[0],
|
|
|
|
&keys->iso_next_group_combo[1]);
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
keys->iso_next_group_combo[0].mask = Mod1Mask;
|
|
|
|
keys->iso_next_group_combo[1].mask = ControlMask;
|
|
|
|
keys->n_iso_next_group_combos = 2;
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
else if (g_str_equal (iso_next_group_option, "alt_shift_toggle") ||
|
|
|
|
g_str_equal (iso_next_group_option, "lalt_lshift_toggle"))
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_key_combo_copy (&keys->iso_next_group_combo[0],
|
|
|
|
&keys->iso_next_group_combo[1]);
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
keys->iso_next_group_combo[0].mask = Mod1Mask;
|
|
|
|
keys->iso_next_group_combo[1].mask = ShiftMask;
|
|
|
|
keys->n_iso_next_group_combos = 2;
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_key_combo_reset (keys->iso_next_group_combo);
|
|
|
|
keys->n_iso_next_group_combos = 0;
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-14 19:08:47 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
devirtualize_modifiers (MetaKeyBindingManager *keys,
|
2019-07-15 16:37:20 +00:00
|
|
|
MetaVirtualModifier modifiers,
|
|
|
|
unsigned int *mask)
|
2014-08-14 18:44:46 +00:00
|
|
|
{
|
|
|
|
*mask = 0;
|
|
|
|
|
|
|
|
if (modifiers & META_VIRTUAL_SHIFT_MASK)
|
|
|
|
*mask |= ShiftMask;
|
|
|
|
if (modifiers & META_VIRTUAL_CONTROL_MASK)
|
|
|
|
*mask |= ControlMask;
|
|
|
|
if (modifiers & META_VIRTUAL_ALT_MASK)
|
|
|
|
*mask |= Mod1Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_META_MASK)
|
2014-08-14 19:33:45 +00:00
|
|
|
*mask |= keys->meta_mask;
|
2014-08-14 18:44:46 +00:00
|
|
|
if (modifiers & META_VIRTUAL_HYPER_MASK)
|
2014-08-14 19:33:45 +00:00
|
|
|
*mask |= keys->hyper_mask;
|
2014-08-14 18:44:46 +00:00
|
|
|
if (modifiers & META_VIRTUAL_SUPER_MASK)
|
2014-08-14 19:33:45 +00:00
|
|
|
*mask |= keys->super_mask;
|
2014-08-14 18:44:46 +00:00
|
|
|
if (modifiers & META_VIRTUAL_MOD2_MASK)
|
|
|
|
*mask |= Mod2Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_MOD3_MASK)
|
|
|
|
*mask |= Mod3Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_MOD4_MASK)
|
|
|
|
*mask |= Mod4Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_MOD5_MASK)
|
|
|
|
*mask |= Mod5Mask;
|
|
|
|
}
|
|
|
|
|
2015-01-08 20:08:51 +00:00
|
|
|
static void
|
|
|
|
index_binding (MetaKeyBindingManager *keys,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
int i;
|
2015-01-08 20:08:51 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
for (i = 0; i < binding->resolved_combo.len; i++)
|
|
|
|
{
|
|
|
|
MetaKeyBinding *existing;
|
|
|
|
guint32 index_key;
|
|
|
|
|
|
|
|
index_key = key_combo_key (&binding->resolved_combo, i);
|
|
|
|
|
|
|
|
existing = g_hash_table_lookup (keys->key_bindings_index,
|
|
|
|
GINT_TO_POINTER (index_key));
|
|
|
|
if (existing != NULL)
|
|
|
|
{
|
|
|
|
/* Overwrite already indexed keycodes only for the first
|
|
|
|
* keycode, i.e. we give those primary keycodes precedence
|
|
|
|
* over non-first ones. */
|
|
|
|
if (i > 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
meta_warning ("Overwriting existing binding of keysym %x"
|
2020-10-02 15:47:22 +00:00
|
|
|
" with keysym %x (keycode %x).",
|
2017-04-25 11:17:02 +00:00
|
|
|
binding->combo.keysym,
|
|
|
|
existing->combo.keysym,
|
|
|
|
binding->resolved_combo.keycodes[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_replace (keys->key_bindings_index,
|
|
|
|
GINT_TO_POINTER (index_key), binding);
|
|
|
|
}
|
2015-01-08 20:08:51 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 02:31:33 +00:00
|
|
|
static void
|
2015-01-07 22:48:32 +00:00
|
|
|
resolve_key_combo (MetaKeyBindingManager *keys,
|
|
|
|
MetaKeyCombo *combo,
|
|
|
|
MetaResolvedKeyCombo *resolved_combo)
|
2015-01-07 02:31:33 +00:00
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
|
|
|
|
resolved_key_combo_reset (resolved_combo);
|
|
|
|
|
2015-01-07 02:31:33 +00:00
|
|
|
if (combo->keysym != 0)
|
2017-04-25 11:17:02 +00:00
|
|
|
{
|
|
|
|
get_keycodes_for_keysym (keys, combo->keysym, resolved_combo);
|
|
|
|
}
|
|
|
|
else if (combo->keycode != 0)
|
|
|
|
{
|
|
|
|
resolved_combo->keycodes = g_new0 (xkb_keycode_t, 1);
|
|
|
|
resolved_combo->keycodes[0] = combo->keycode;
|
|
|
|
resolved_combo->len = 1;
|
|
|
|
}
|
2015-01-07 02:31:33 +00:00
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
devirtualize_modifiers (keys, combo->modifiers, &resolved_combo->mask);
|
2015-01-07 02:31:33 +00:00
|
|
|
}
|
|
|
|
|
2014-03-03 13:08:34 +00:00
|
|
|
static void
|
2015-01-07 02:29:00 +00:00
|
|
|
binding_reload_combos_foreach (gpointer key,
|
|
|
|
gpointer value,
|
|
|
|
gpointer data)
|
2014-03-03 13:08:34 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = data;
|
2014-03-03 13:08:34 +00:00
|
|
|
MetaKeyBinding *binding = value;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
resolve_key_combo (keys, &binding->combo, &binding->resolved_combo);
|
2015-01-08 20:08:51 +00:00
|
|
|
index_binding (keys, binding);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2017-09-01 10:41:44 +00:00
|
|
|
typedef struct _FindLatinKeysymsState
|
|
|
|
{
|
|
|
|
MetaKeyBindingKeyboardLayout *layout;
|
|
|
|
gboolean *required_keysyms_found;
|
|
|
|
int n_required_keysyms;
|
|
|
|
} FindLatinKeysymsState;
|
|
|
|
|
|
|
|
static void
|
|
|
|
find_latin_keysym (struct xkb_keymap *keymap,
|
|
|
|
xkb_keycode_t key,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
FindLatinKeysymsState *state = data;
|
|
|
|
int n_keysyms, i;
|
|
|
|
const xkb_keysym_t *keysyms;
|
|
|
|
|
|
|
|
n_keysyms = xkb_keymap_key_get_syms_by_level (state->layout->keymap,
|
|
|
|
key,
|
|
|
|
state->layout->index,
|
|
|
|
0,
|
|
|
|
&keysyms);
|
|
|
|
for (i = 0; i < n_keysyms; i++)
|
|
|
|
{
|
|
|
|
xkb_keysym_t keysym = keysyms[i];
|
|
|
|
|
|
|
|
if (keysym >= XKB_KEY_a && keysym <= XKB_KEY_z)
|
|
|
|
{
|
|
|
|
unsigned int keysym_index = keysym - XKB_KEY_a;
|
|
|
|
|
|
|
|
if (!state->required_keysyms_found[keysym_index])
|
|
|
|
{
|
|
|
|
state->required_keysyms_found[keysym_index] = TRUE;
|
|
|
|
state->n_required_keysyms--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
needs_secondary_layout (MetaKeyBindingKeyboardLayout *layout)
|
|
|
|
{
|
|
|
|
gboolean required_keysyms_found[] = {
|
|
|
|
FALSE, /* XKB_KEY_a */
|
|
|
|
FALSE, /* XKB_KEY_b */
|
|
|
|
FALSE, /* XKB_KEY_c */
|
|
|
|
FALSE, /* XKB_KEY_d */
|
|
|
|
FALSE, /* XKB_KEY_e */
|
|
|
|
FALSE, /* XKB_KEY_f */
|
|
|
|
FALSE, /* XKB_KEY_g */
|
|
|
|
FALSE, /* XKB_KEY_h */
|
|
|
|
FALSE, /* XKB_KEY_i */
|
|
|
|
FALSE, /* XKB_KEY_j */
|
|
|
|
FALSE, /* XKB_KEY_k */
|
|
|
|
FALSE, /* XKB_KEY_l */
|
|
|
|
FALSE, /* XKB_KEY_m */
|
|
|
|
FALSE, /* XKB_KEY_n */
|
|
|
|
FALSE, /* XKB_KEY_o */
|
|
|
|
FALSE, /* XKB_KEY_p */
|
|
|
|
FALSE, /* XKB_KEY_q */
|
|
|
|
FALSE, /* XKB_KEY_r */
|
|
|
|
FALSE, /* XKB_KEY_s */
|
|
|
|
FALSE, /* XKB_KEY_t */
|
|
|
|
FALSE, /* XKB_KEY_u */
|
|
|
|
FALSE, /* XKB_KEY_v */
|
|
|
|
FALSE, /* XKB_KEY_w */
|
|
|
|
FALSE, /* XKB_KEY_x */
|
|
|
|
FALSE, /* XKB_KEY_y */
|
|
|
|
FALSE, /* XKB_KEY_z */
|
|
|
|
};
|
|
|
|
FindLatinKeysymsState state = {
|
|
|
|
.layout = layout,
|
|
|
|
.required_keysyms_found = required_keysyms_found,
|
|
|
|
.n_required_keysyms = G_N_ELEMENTS (required_keysyms_found),
|
|
|
|
};
|
|
|
|
|
|
|
|
xkb_keymap_key_for_each (layout->keymap, find_latin_keysym, &state);
|
|
|
|
|
|
|
|
return state.n_required_keysyms != 0;
|
|
|
|
}
|
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
static void
|
|
|
|
clear_active_keyboard_layouts (MetaKeyBindingManager *keys)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (keys->active_layouts); i++)
|
|
|
|
{
|
|
|
|
MetaKeyBindingKeyboardLayout *layout = &keys->active_layouts[i];
|
|
|
|
|
|
|
|
g_clear_pointer (&layout->keymap, xkb_keymap_unref);
|
|
|
|
*layout = (MetaKeyBindingKeyboardLayout) { 0 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-01 10:41:44 +00:00
|
|
|
static MetaKeyBindingKeyboardLayout
|
|
|
|
create_us_layout (void)
|
|
|
|
{
|
|
|
|
struct xkb_rule_names names;
|
|
|
|
struct xkb_keymap *keymap;
|
|
|
|
struct xkb_context *context;
|
|
|
|
|
|
|
|
names.rules = DEFAULT_XKB_RULES_FILE;
|
|
|
|
names.model = DEFAULT_XKB_MODEL;
|
|
|
|
names.layout = "us";
|
|
|
|
names.variant = "";
|
|
|
|
names.options = "";
|
|
|
|
|
2019-11-14 02:59:25 +00:00
|
|
|
context = meta_create_xkb_context ();
|
2017-09-01 10:41:44 +00:00
|
|
|
keymap = xkb_keymap_new_from_names (context, &names, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
|
|
|
xkb_context_unref (context);
|
|
|
|
|
|
|
|
return (MetaKeyBindingKeyboardLayout) {
|
|
|
|
.keymap = keymap,
|
|
|
|
.n_levels = calculate_n_layout_levels (keymap, 0),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
static void
|
|
|
|
reload_active_keyboard_layouts (MetaKeyBindingManager *keys)
|
|
|
|
{
|
|
|
|
struct xkb_keymap *keymap;
|
|
|
|
xkb_layout_index_t layout_index;
|
2017-09-01 10:41:44 +00:00
|
|
|
MetaKeyBindingKeyboardLayout primary_layout;
|
2017-09-01 09:46:53 +00:00
|
|
|
|
|
|
|
clear_active_keyboard_layouts (keys);
|
|
|
|
|
|
|
|
keymap = meta_backend_get_keymap (keys->backend);
|
|
|
|
layout_index = meta_backend_get_keymap_layout_group (keys->backend);
|
2017-09-01 10:41:44 +00:00
|
|
|
primary_layout = (MetaKeyBindingKeyboardLayout) {
|
2017-09-01 09:46:53 +00:00
|
|
|
.keymap = xkb_keymap_ref (keymap),
|
|
|
|
.index = layout_index,
|
|
|
|
.n_levels = calculate_n_layout_levels (keymap, layout_index),
|
|
|
|
};
|
2017-09-01 10:41:44 +00:00
|
|
|
|
|
|
|
keys->active_layouts[META_KEY_BINDING_PRIMARY_LAYOUT] = primary_layout;
|
|
|
|
|
|
|
|
if (needs_secondary_layout (&primary_layout))
|
|
|
|
{
|
|
|
|
MetaKeyBindingKeyboardLayout us_layout;
|
|
|
|
|
|
|
|
us_layout = create_us_layout ();
|
|
|
|
keys->active_layouts[META_KEY_BINDING_SECONDARY_LAYOUT] = us_layout;
|
|
|
|
}
|
2017-09-01 09:46:53 +00:00
|
|
|
}
|
|
|
|
|
2002-07-14 03:16:41 +00:00
|
|
|
static void
|
2015-01-07 02:29:00 +00:00
|
|
|
reload_combos (MetaKeyBindingManager *keys)
|
2002-07-14 03:16:41 +00:00
|
|
|
{
|
2015-01-08 20:08:51 +00:00
|
|
|
g_hash_table_remove_all (keys->key_bindings_index);
|
|
|
|
|
2017-09-01 09:46:53 +00:00
|
|
|
reload_active_keyboard_layouts (keys);
|
2015-01-07 02:29:00 +00:00
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
resolve_key_combo (keys,
|
|
|
|
&keys->overlay_key_combo,
|
|
|
|
&keys->overlay_resolved_key_combo);
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
resolve_key_combo (keys,
|
|
|
|
&keys->locate_pointer_key_combo,
|
|
|
|
&keys->locate_pointer_resolved_key_combo);
|
|
|
|
|
2015-01-07 02:29:00 +00:00
|
|
|
reload_iso_next_group_combos (keys);
|
|
|
|
|
|
|
|
g_hash_table_foreach (keys->key_bindings, binding_reload_combos_foreach, keys);
|
2002-07-14 03:16:41 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
rebuild_binding_table (MetaKeyBindingManager *keys,
|
|
|
|
GList *prefs,
|
|
|
|
GList *grabs)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2014-03-03 13:08:34 +00:00
|
|
|
MetaKeyBinding *b;
|
2012-08-28 13:28:11 +00:00
|
|
|
GList *p, *g;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_remove_all (keys->key_bindings);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
p = prefs;
|
|
|
|
while (p)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyPref *pref = (MetaKeyPref*)p->data;
|
2014-02-25 18:49:16 +00:00
|
|
|
GSList *tmp = pref->combos;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
|
|
while (tmp)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
MetaKeyCombo *combo = tmp->data;
|
2003-02-22 20:31:51 +00:00
|
|
|
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 19:06:26 +00:00
|
|
|
if (combo && (combo->keysym != None || combo->keycode != 0))
|
2003-02-22 20:31:51 +00:00
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyHandler *handler = HANDLER (pref->name);
|
|
|
|
|
2020-10-19 17:57:57 +00:00
|
|
|
b = g_new0 (MetaKeyBinding, 1);
|
2014-03-03 13:08:34 +00:00
|
|
|
b->name = pref->name;
|
|
|
|
b->handler = handler;
|
|
|
|
b->flags = handler->flags;
|
2015-01-07 02:31:33 +00:00
|
|
|
b->combo = *combo;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_add (keys->key_bindings, b);
|
2003-02-22 20:31:51 +00:00
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
tmp = tmp->next;
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
p = p->next;
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2012-08-28 13:28:11 +00:00
|
|
|
g = grabs;
|
|
|
|
while (g)
|
|
|
|
{
|
|
|
|
MetaKeyGrab *grab = (MetaKeyGrab*)g->data;
|
2015-01-07 02:24:10 +00:00
|
|
|
if (grab->combo.keysym != None || grab->combo.keycode != 0)
|
2012-08-28 13:28:11 +00:00
|
|
|
{
|
|
|
|
MetaKeyHandler *handler = HANDLER ("external-grab");
|
|
|
|
|
2020-10-19 17:57:57 +00:00
|
|
|
b = g_new0 (MetaKeyBinding, 1);
|
2014-03-03 13:08:34 +00:00
|
|
|
b->name = grab->name;
|
|
|
|
b->handler = handler;
|
2018-08-24 19:20:13 +00:00
|
|
|
b->flags = grab->flags;
|
2015-01-07 02:31:33 +00:00
|
|
|
b->combo = grab->combo;
|
2014-03-03 13:08:34 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_add (keys->key_bindings, b);
|
2012-08-28 13:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g = g->next;
|
|
|
|
}
|
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
" %d bindings in table",
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_size (keys->key_bindings));
|
2003-02-22 20:31:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
rebuild_key_binding_table (MetaKeyBindingManager *keys)
|
2003-02-22 20:31:51 +00:00
|
|
|
{
|
2012-08-28 13:28:11 +00:00
|
|
|
GList *prefs, *grabs;
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Rebuilding key binding table from preferences");
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
prefs = meta_prefs_get_keybindings ();
|
2012-08-28 13:28:11 +00:00
|
|
|
grabs = g_hash_table_get_values (external_grabs);
|
2014-08-14 19:33:45 +00:00
|
|
|
rebuild_binding_table (keys, prefs, grabs);
|
2011-10-28 01:05:43 +00:00
|
|
|
g_list_free (prefs);
|
2012-08-28 13:28:11 +00:00
|
|
|
g_list_free (grabs);
|
2003-02-22 20:31:51 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
rebuild_special_bindings (MetaKeyBindingManager *keys)
|
2008-12-02 23:13:11 +00:00
|
|
|
{
|
|
|
|
MetaKeyCombo combo;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
meta_prefs_get_overlay_binding (&combo);
|
2014-08-14 19:33:45 +00:00
|
|
|
keys->overlay_key_combo = combo;
|
2019-02-20 10:53:54 +00:00
|
|
|
|
|
|
|
meta_prefs_get_locate_pointer_binding (&combo);
|
|
|
|
keys->locate_pointer_key_combo = combo;
|
2008-12-02 23:13:11 +00:00
|
|
|
}
|
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
static void
|
2013-03-31 17:06:40 +00:00
|
|
|
ungrab_key_bindings (MetaDisplay *display)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2014-08-14 18:52:15 +00:00
|
|
|
GSList *windows, *l;
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2017-08-26 19:38:59 +00:00
|
|
|
if (display->x11_display)
|
|
|
|
meta_x11_display_ungrab_keys (display->x11_display);
|
2002-11-06 16:00:56 +00:00
|
|
|
|
2009-06-15 19:32:23 +00:00
|
|
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
2014-08-14 18:52:15 +00:00
|
|
|
for (l = windows; l; l = l->next)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2014-08-14 18:52:15 +00:00
|
|
|
MetaWindow *w = l->data;
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_window_ungrab_keys (w);
|
2013-03-31 17:06:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
grab_key_bindings (MetaDisplay *display)
|
|
|
|
{
|
2014-08-14 18:52:15 +00:00
|
|
|
GSList *windows, *l;
|
2013-03-31 17:06:40 +00:00
|
|
|
|
2017-08-26 19:38:59 +00:00
|
|
|
if (display->x11_display)
|
|
|
|
meta_x11_display_grab_keys (display->x11_display);
|
2013-03-31 17:06:40 +00:00
|
|
|
|
|
|
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
2014-08-14 18:52:15 +00:00
|
|
|
for (l = windows; l; l = l->next)
|
2013-03-31 17:06:40 +00:00
|
|
|
{
|
2014-08-14 18:52:15 +00:00
|
|
|
MetaWindow *w = l->data;
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_window_grab_keys (w);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
|
2009-08-25 20:54:54 +00:00
|
|
|
static MetaKeyBinding *
|
2014-08-14 19:33:45 +00:00
|
|
|
get_keybinding (MetaKeyBindingManager *keys,
|
2015-01-07 22:48:32 +00:00
|
|
|
MetaResolvedKeyCombo *resolved_combo)
|
2002-07-14 03:16:41 +00:00
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
MetaKeyBinding *binding = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < resolved_combo->len; i++)
|
|
|
|
{
|
|
|
|
guint32 key;
|
|
|
|
|
|
|
|
key = key_combo_key (resolved_combo, i);
|
|
|
|
binding = g_hash_table_lookup (keys->key_bindings_index,
|
|
|
|
GINT_TO_POINTER (key));
|
|
|
|
|
|
|
|
if (binding != NULL)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return binding;
|
2009-08-25 20:54:54 +00:00
|
|
|
}
|
|
|
|
|
2012-12-21 10:32:55 +00:00
|
|
|
static guint
|
2014-04-07 19:59:38 +00:00
|
|
|
next_dynamic_keybinding_action (void)
|
|
|
|
{
|
2012-12-21 10:32:55 +00:00
|
|
|
static guint num_dynamic_bindings = 0;
|
|
|
|
return META_KEYBINDING_ACTION_LAST + (++num_dynamic_bindings);
|
|
|
|
}
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
static gboolean
|
2011-11-04 18:18:57 +00:00
|
|
|
add_keybinding_internal (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 14:42:42 +00:00
|
|
|
GSettings *settings,
|
2011-11-04 18:18:57 +00:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyHandlerFunc func,
|
|
|
|
int data,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify free_data)
|
2011-10-28 01:05:43 +00:00
|
|
|
{
|
|
|
|
MetaKeyHandler *handler;
|
|
|
|
|
2012-03-27 14:42:42 +00:00
|
|
|
if (!meta_prefs_add_keybinding (name, settings, action, flags))
|
2011-10-28 01:05:43 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
handler = g_new0 (MetaKeyHandler, 1);
|
|
|
|
handler->name = g_strdup (name);
|
|
|
|
handler->func = func;
|
|
|
|
handler->default_func = func;
|
|
|
|
handler->data = data;
|
|
|
|
handler->flags = flags;
|
2011-11-04 18:18:57 +00:00
|
|
|
handler->user_data = user_data;
|
|
|
|
handler->user_data_free_func = free_data;
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
g_hash_table_insert (key_handlers, g_strdup (name), handler);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-11-04 18:18:57 +00:00
|
|
|
static gboolean
|
|
|
|
add_builtin_keybinding (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 14:42:42 +00:00
|
|
|
GSettings *settings,
|
2011-11-04 18:18:57 +00:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
int handler_arg)
|
|
|
|
{
|
2012-03-27 14:42:42 +00:00
|
|
|
return add_keybinding_internal (display, name, settings,
|
2011-11-04 18:18:57 +00:00
|
|
|
flags | META_KEY_BINDING_BUILTIN,
|
|
|
|
action, handler, handler_arg, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_add_keybinding:
|
|
|
|
* @display: a #MetaDisplay
|
|
|
|
* @name: the binding's name
|
2012-03-27 14:42:42 +00:00
|
|
|
* @settings: the #GSettings object where @name is stored
|
2011-11-04 18:18:57 +00:00
|
|
|
* @flags: flags to specify binding details
|
|
|
|
* @handler: function to run when the keybinding is invoked
|
|
|
|
* @user_data: the data to pass to @handler
|
|
|
|
* @free_data: function to free @user_data
|
|
|
|
*
|
|
|
|
* Add a keybinding at runtime. The key @name in @schema needs to be of
|
|
|
|
* type %G_VARIANT_TYPE_STRING_ARRAY, with each string describing a
|
2013-02-13 14:44:06 +00:00
|
|
|
* keybinding in the form of "<Control>a" or "<Shift><Alt>F1". The parser
|
2011-11-04 18:18:57 +00:00
|
|
|
* is fairly liberal and allows lower or upper case, and also abbreviations
|
2013-02-13 14:44:06 +00:00
|
|
|
* such as "<Ctl>" and "<Ctrl>". If the key is set to the empty list or a
|
2011-11-04 18:18:57 +00:00
|
|
|
* list with a single element of either "" or "disabled", the keybinding is
|
|
|
|
* disabled.
|
|
|
|
*
|
|
|
|
* Use meta_display_remove_keybinding() to remove the binding.
|
|
|
|
*
|
2012-12-12 13:03:58 +00:00
|
|
|
* Returns: the corresponding keybinding action if the keybinding was
|
|
|
|
* added successfully, otherwise %META_KEYBINDING_ACTION_NONE
|
2011-11-04 18:18:57 +00:00
|
|
|
*/
|
2012-12-12 13:03:58 +00:00
|
|
|
guint
|
2011-11-04 18:18:57 +00:00
|
|
|
meta_display_add_keybinding (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 14:42:42 +00:00
|
|
|
GSettings *settings,
|
2011-11-04 18:18:57 +00:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify free_data)
|
|
|
|
{
|
2012-12-21 10:32:55 +00:00
|
|
|
guint new_action = next_dynamic_keybinding_action ();
|
2012-12-12 13:03:58 +00:00
|
|
|
|
|
|
|
if (!add_keybinding_internal (display, name, settings, flags, new_action,
|
|
|
|
handler, 0, user_data, free_data))
|
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
|
|
|
|
return new_action;
|
2011-11-04 18:18:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_remove_keybinding:
|
|
|
|
* @display: the #MetaDisplay
|
|
|
|
* @name: name of the keybinding to remove
|
|
|
|
*
|
|
|
|
* Remove keybinding @name; the function will fail if @name is not a known
|
|
|
|
* keybinding or has not been added with meta_display_add_keybinding().
|
|
|
|
*
|
2020-08-26 09:49:50 +00:00
|
|
|
* Returns: %TRUE if the binding has been removed successfully,
|
2011-11-04 18:18:57 +00:00
|
|
|
* otherwise %FALSE
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_display_remove_keybinding (MetaDisplay *display,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
if (!meta_prefs_remove_keybinding (name))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_hash_table_remove (key_handlers, name);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-01-07 03:11:23 +00:00
|
|
|
static guint
|
|
|
|
get_keybinding_action (MetaKeyBindingManager *keys,
|
2015-01-07 22:48:32 +00:00
|
|
|
MetaResolvedKeyCombo *resolved_combo)
|
2009-08-25 20:54:54 +00:00
|
|
|
{
|
|
|
|
MetaKeyBinding *binding;
|
|
|
|
|
2012-08-10 20:08:03 +00:00
|
|
|
/* This is much more vague than the MetaDisplay::overlay-key signal,
|
|
|
|
* which is only emitted if the overlay-key is the only key pressed;
|
|
|
|
* as this method is primarily intended for plugins to allow processing
|
|
|
|
* of mutter keybindings while holding a grab, the overlay-key-only-pressed
|
|
|
|
* tracking is left to the plugin here.
|
|
|
|
*/
|
2017-04-25 11:17:02 +00:00
|
|
|
if (resolved_key_combo_intersect (resolved_combo,
|
|
|
|
&keys->overlay_resolved_key_combo))
|
2012-08-10 20:08:03 +00:00
|
|
|
return META_KEYBINDING_ACTION_OVERLAY_KEY;
|
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
if (resolved_key_combo_intersect (resolved_combo,
|
|
|
|
&keys->locate_pointer_resolved_key_combo))
|
|
|
|
return META_KEYBINDING_ACTION_LOCATE_POINTER_KEY;
|
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
binding = get_keybinding (keys, resolved_combo);
|
2009-08-25 20:54:54 +00:00
|
|
|
if (binding)
|
2012-08-28 13:28:11 +00:00
|
|
|
{
|
|
|
|
MetaKeyGrab *grab = g_hash_table_lookup (external_grabs, binding->name);
|
|
|
|
if (grab)
|
|
|
|
return grab->action;
|
|
|
|
else
|
|
|
|
return (guint) meta_prefs_get_keybinding_action (binding->name);
|
|
|
|
}
|
2009-08-25 20:54:54 +00:00
|
|
|
else
|
2012-08-28 13:28:11 +00:00
|
|
|
{
|
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
}
|
2002-07-14 03:16:41 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
static xkb_mod_mask_t
|
|
|
|
mask_from_event_params (MetaKeyBindingManager *keys,
|
|
|
|
unsigned long mask)
|
2015-01-07 03:11:23 +00:00
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
return mask & 0xff & ~keys->ignored_modifier_mask;
|
2015-01-07 03:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_display_get_keybinding_action:
|
|
|
|
* @display: A #MetaDisplay
|
|
|
|
* @keycode: Raw keycode
|
|
|
|
* @mask: Event mask
|
|
|
|
*
|
|
|
|
* Get the keybinding action bound to @keycode. Builtin keybindings
|
|
|
|
* have a fixed associated #MetaKeyBindingAction, for bindings added
|
|
|
|
* dynamically the function will return the keybinding action
|
|
|
|
* meta_display_add_keybinding() returns on registration.
|
|
|
|
*
|
|
|
|
* Returns: The action that should be taken for the given key, or
|
|
|
|
* %META_KEYBINDING_ACTION_NONE.
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
meta_display_get_keybinding_action (MetaDisplay *display,
|
|
|
|
unsigned int keycode,
|
|
|
|
unsigned long mask)
|
|
|
|
{
|
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2017-04-25 11:17:02 +00:00
|
|
|
xkb_keycode_t code = (xkb_keycode_t) keycode;
|
|
|
|
MetaResolvedKeyCombo resolved_combo = { &code, 1 };
|
|
|
|
|
|
|
|
resolved_combo.mask = mask_from_event_params (keys, mask);
|
2015-01-07 22:48:32 +00:00
|
|
|
return get_keybinding_action (keys, &resolved_combo);
|
2015-01-07 03:11:23 +00:00
|
|
|
}
|
|
|
|
|
2014-08-14 21:32:41 +00:00
|
|
|
static void
|
2017-08-17 09:04:13 +00:00
|
|
|
reload_keybindings (MetaDisplay *display)
|
2012-12-13 01:50:43 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2014-08-14 18:25:43 +00:00
|
|
|
ungrab_key_bindings (display);
|
2010-05-02 15:35:33 +00:00
|
|
|
|
2014-08-14 18:25:43 +00:00
|
|
|
/* Deciphering the modmap depends on the loaded keysyms to find out
|
|
|
|
* what modifiers is Super and so forth, so we need to reload it
|
|
|
|
* even when only the keymap changes */
|
2014-08-14 19:33:45 +00:00
|
|
|
reload_modmap (keys);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2015-01-07 02:29:00 +00:00
|
|
|
reload_combos (keys);
|
2010-05-02 15:35:33 +00:00
|
|
|
|
2014-08-14 18:25:43 +00:00
|
|
|
grab_key_bindings (display);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2016-02-10 14:36:07 +00:00
|
|
|
static GArray *
|
|
|
|
calc_grab_modifiers (MetaKeyBindingManager *keys,
|
|
|
|
unsigned int modmask)
|
|
|
|
{
|
|
|
|
unsigned int ignored_mask;
|
|
|
|
XIGrabModifiers mods;
|
|
|
|
GArray *mods_array = g_array_new (FALSE, TRUE, sizeof (XIGrabModifiers));
|
|
|
|
|
2016-02-10 19:17:49 +00:00
|
|
|
/* The X server crashes if XIAnyModifier gets passed in with any
|
|
|
|
other bits. It doesn't make sense to ask for a grab of
|
|
|
|
XIAnyModifier plus other bits anyway so we avoid that. */
|
|
|
|
if (modmask & XIAnyModifier)
|
|
|
|
{
|
|
|
|
mods = (XIGrabModifiers) { XIAnyModifier, 0 };
|
|
|
|
g_array_append_val (mods_array, mods);
|
|
|
|
return mods_array;
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:36:07 +00:00
|
|
|
mods = (XIGrabModifiers) { modmask, 0 };
|
|
|
|
g_array_append_val (mods_array, mods);
|
|
|
|
|
|
|
|
for (ignored_mask = 1;
|
|
|
|
ignored_mask <= keys->ignored_modifier_mask;
|
|
|
|
++ignored_mask)
|
|
|
|
{
|
|
|
|
if (ignored_mask & keys->ignored_modifier_mask)
|
|
|
|
{
|
|
|
|
mods = (XIGrabModifiers) { modmask | ignored_mask, 0 };
|
|
|
|
g_array_append_val (mods_array, mods);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return mods_array;
|
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
meta_change_button_grab (MetaKeyBindingManager *keys,
|
|
|
|
Window xwindow,
|
|
|
|
gboolean grab,
|
|
|
|
gboolean sync,
|
|
|
|
int button,
|
|
|
|
int modmask)
|
2014-08-14 19:04:00 +00:00
|
|
|
{
|
2016-04-18 13:29:42 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
|
|
|
return;
|
|
|
|
|
2017-09-01 09:45:08 +00:00
|
|
|
MetaBackendX11 *backend = META_BACKEND_X11 (keys->backend);
|
2014-08-14 19:04:00 +00:00
|
|
|
Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
|
|
|
|
|
|
|
|
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
|
|
|
|
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
|
2016-02-10 14:36:07 +00:00
|
|
|
GArray *mods;
|
2014-08-14 19:04:00 +00:00
|
|
|
|
|
|
|
XISetMask (mask.mask, XI_ButtonPress);
|
|
|
|
XISetMask (mask.mask, XI_ButtonRelease);
|
|
|
|
XISetMask (mask.mask, XI_Motion);
|
|
|
|
|
2016-02-10 14:36:07 +00:00
|
|
|
mods = calc_grab_modifiers (keys, modmask);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
2016-02-10 14:36:07 +00:00
|
|
|
/* GrabModeSync means freeze until XAllowEvents */
|
|
|
|
if (grab)
|
|
|
|
XIGrabButton (xdisplay,
|
|
|
|
META_VIRTUAL_CORE_POINTER_ID,
|
|
|
|
button, xwindow, None,
|
|
|
|
sync ? XIGrabModeSync : XIGrabModeAsync,
|
|
|
|
XIGrabModeAsync, False,
|
|
|
|
&mask, mods->len, (XIGrabModifiers *)mods->data);
|
|
|
|
else
|
|
|
|
XIUngrabButton (xdisplay,
|
|
|
|
META_VIRTUAL_CORE_POINTER_ID,
|
|
|
|
button, xwindow, mods->len, (XIGrabModifiers *)mods->data);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
2016-02-10 14:36:07 +00:00
|
|
|
g_array_free (mods, TRUE);
|
2014-08-14 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
2014-08-14 19:52:32 +00:00
|
|
|
ClutterModifierType
|
2021-01-29 19:56:46 +00:00
|
|
|
meta_display_get_compositor_modifiers (MetaDisplay *display)
|
2014-08-14 19:52:32 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
return keys->window_grab_modifiers;
|
2014-08-14 19:52:32 +00:00
|
|
|
}
|
|
|
|
|
2014-08-14 20:02:19 +00:00
|
|
|
static void
|
|
|
|
meta_change_buttons_grab (MetaKeyBindingManager *keys,
|
|
|
|
Window xwindow,
|
|
|
|
gboolean grab,
|
|
|
|
gboolean sync,
|
|
|
|
int modmask)
|
|
|
|
{
|
|
|
|
#define MAX_BUTTON 3
|
|
|
|
|
|
|
|
int i;
|
|
|
|
for (i = 1; i <= MAX_BUTTON; i++)
|
|
|
|
meta_change_button_grab (keys, xwindow, grab, sync, i, modmask);
|
|
|
|
}
|
|
|
|
|
2014-08-14 19:04:00 +00:00
|
|
|
void
|
|
|
|
meta_display_grab_window_buttons (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2014-08-14 19:04:00 +00:00
|
|
|
/* Grab Alt + button1 for moving window.
|
|
|
|
* Grab Alt + button2 for resizing window.
|
|
|
|
* Grab Alt + button3 for popping up window menu.
|
|
|
|
* Grab Alt + Shift + button1 for snap-moving window.
|
|
|
|
*/
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose ("Grabbing window buttons for 0x%lx", xwindow);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
|
|
|
/* FIXME If we ignored errors here instead of spewing, we could
|
|
|
|
* put one big error trap around the loop and avoid a bunch of
|
|
|
|
* XSync()
|
|
|
|
*/
|
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
if (keys->window_grab_modifiers != 0)
|
2014-08-14 19:04:00 +00:00
|
|
|
{
|
2014-08-14 20:02:19 +00:00
|
|
|
meta_change_buttons_grab (keys, xwindow, TRUE, FALSE,
|
|
|
|
keys->window_grab_modifiers);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
|
|
|
/* In addition to grabbing Alt+Button1 for moving the window,
|
|
|
|
* grab Alt+Shift+Button1 for snap-moving the window. See bug
|
|
|
|
* 112478. Unfortunately, this doesn't work with
|
|
|
|
* Shift+Alt+Button1 for some reason; so at least part of the
|
|
|
|
* order still matters, which sucks (please FIXME).
|
|
|
|
*/
|
2014-08-14 19:33:45 +00:00
|
|
|
meta_change_button_grab (keys, xwindow,
|
2014-08-14 19:04:00 +00:00
|
|
|
TRUE,
|
|
|
|
FALSE,
|
2014-08-14 19:33:45 +00:00
|
|
|
1, keys->window_grab_modifiers | ShiftMask);
|
2014-08-14 19:04:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_ungrab_window_buttons (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2014-08-14 19:04:00 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
if (keys->window_grab_modifiers == 0)
|
2014-08-14 19:04:00 +00:00
|
|
|
return;
|
|
|
|
|
2014-08-14 20:02:19 +00:00
|
|
|
meta_change_buttons_grab (keys, xwindow, FALSE, FALSE,
|
|
|
|
keys->window_grab_modifiers);
|
2014-08-14 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-01-29 19:56:46 +00:00
|
|
|
update_window_grab_modifiers (MetaDisplay *display)
|
2014-08-14 19:04:00 +00:00
|
|
|
{
|
2021-01-29 19:56:46 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2014-08-14 19:04:00 +00:00
|
|
|
MetaVirtualModifier virtual_mods;
|
|
|
|
unsigned int mods;
|
|
|
|
|
|
|
|
virtual_mods = meta_prefs_get_mouse_button_mods ();
|
2014-08-14 19:33:45 +00:00
|
|
|
devirtualize_modifiers (keys, virtual_mods, &mods);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
2021-01-29 19:56:46 +00:00
|
|
|
if (keys->window_grab_modifiers != mods)
|
|
|
|
{
|
|
|
|
keys->window_grab_modifiers = mods;
|
|
|
|
g_object_notify (G_OBJECT (display), "compositor-modifiers");
|
|
|
|
}
|
2014-08-14 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_grab_focus_window_button (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2014-08-14 19:04:00 +00:00
|
|
|
/* Grab button 1 for activating unfocused windows */
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose ("Grabbing unfocused window buttons for %s", window->desc);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
|
|
|
if (window->have_focus_click_grab)
|
|
|
|
{
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose (" (well, not grabbing since we already have the grab)");
|
2014-08-14 19:04:00 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME If we ignored errors here instead of spewing, we could
|
|
|
|
* put one big error trap around the loop and avoid a bunch of
|
|
|
|
* XSync()
|
|
|
|
*/
|
|
|
|
|
2016-02-10 19:17:49 +00:00
|
|
|
meta_change_buttons_grab (keys, window->xwindow, TRUE, TRUE, XIAnyModifier);
|
2014-08-14 20:02:19 +00:00
|
|
|
window->have_focus_click_grab = TRUE;
|
2014-08-14 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_ungrab_focus_window_button (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose ("Ungrabbing unfocused window buttons for %s", window->desc);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
|
|
|
if (!window->have_focus_click_grab)
|
|
|
|
return;
|
|
|
|
|
2016-02-10 19:17:49 +00:00
|
|
|
meta_change_buttons_grab (keys, window->xwindow, FALSE, FALSE, XIAnyModifier);
|
2014-08-14 20:02:19 +00:00
|
|
|
window->have_focus_click_grab = FALSE;
|
2014-08-14 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
prefs_changed_callback (MetaPreference pref,
|
|
|
|
void *data)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaDisplay *display = data;
|
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
switch (pref)
|
|
|
|
{
|
2019-07-15 11:13:45 +00:00
|
|
|
case META_PREF_LOCATE_POINTER:
|
|
|
|
maybe_update_locate_pointer_keygrab (display,
|
|
|
|
meta_prefs_is_locate_pointer_enabled());
|
|
|
|
break;
|
2008-11-22 19:02:54 +00:00
|
|
|
case META_PREF_KEYBINDINGS:
|
2013-03-31 17:06:40 +00:00
|
|
|
ungrab_key_bindings (display);
|
2014-08-14 19:33:45 +00:00
|
|
|
rebuild_key_binding_table (keys);
|
|
|
|
rebuild_special_bindings (keys);
|
2015-01-07 02:29:00 +00:00
|
|
|
reload_combos (keys);
|
2013-03-31 17:06:40 +00:00
|
|
|
grab_key_bindings (display);
|
2002-04-28 04:52:26 +00:00
|
|
|
break;
|
2014-08-14 19:04:00 +00:00
|
|
|
case META_PREF_MOUSE_BUTTON_MODS:
|
|
|
|
{
|
|
|
|
GSList *windows, *l;
|
|
|
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
|
|
|
|
|
|
|
for (l = windows; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaWindow *w = l->data;
|
|
|
|
meta_display_ungrab_window_buttons (display, w->xwindow);
|
|
|
|
}
|
|
|
|
|
2021-01-29 19:56:46 +00:00
|
|
|
update_window_grab_modifiers (display);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
|
|
|
for (l = windows; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaWindow *w = l->data;
|
|
|
|
if (w->type != META_WINDOW_DOCK)
|
|
|
|
meta_display_grab_window_buttons (display, w->xwindow);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
void
|
|
|
|
meta_display_shutdown_keys (MetaDisplay *display)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2014-08-14 19:04:00 +00:00
|
|
|
meta_prefs_remove_listener (prefs_changed_callback, display);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_destroy (keys->key_bindings_index);
|
|
|
|
g_hash_table_destroy (keys->key_bindings);
|
2017-09-01 09:46:53 +00:00
|
|
|
|
|
|
|
clear_active_keyboard_layouts (keys);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2001-10-05 02:58:48 +00:00
|
|
|
/* Grab/ungrab, ignoring all annoying modifiers like NumLock etc. */
|
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
meta_change_keygrab (MetaKeyBindingManager *keys,
|
2015-01-07 03:02:17 +00:00
|
|
|
Window xwindow,
|
|
|
|
gboolean grab,
|
2015-01-07 22:48:32 +00:00
|
|
|
MetaResolvedKeyCombo *resolved_combo)
|
2001-10-05 02:58:48 +00:00
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaBackendX11 *backend_x11;
|
|
|
|
Display *xdisplay;
|
|
|
|
GArray *mods;
|
|
|
|
int i;
|
2012-11-20 23:04:42 +00:00
|
|
|
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
|
|
|
|
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
|
|
|
|
|
|
|
|
XISetMask (mask.mask, XI_KeyPress);
|
|
|
|
XISetMask (mask.mask, XI_KeyRelease);
|
|
|
|
|
2016-04-18 13:29:42 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
|
|
|
return;
|
|
|
|
|
2022-05-27 20:27:07 +00:00
|
|
|
backend_x11 = META_BACKEND_X11 (keys->backend);
|
|
|
|
xdisplay = meta_backend_x11_get_xdisplay (backend_x11);
|
2014-04-23 20:23:26 +00:00
|
|
|
|
2001-10-05 02:58:48 +00:00
|
|
|
/* Grab keycode/modmask, together with
|
2002-04-28 04:52:26 +00:00
|
|
|
* all combinations of ignored modifiers.
|
2001-10-05 02:58:48 +00:00
|
|
|
* X provides no better way to do this.
|
|
|
|
*/
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2016-02-10 14:36:07 +00:00
|
|
|
mods = calc_grab_modifiers (keys, resolved_combo->mask);
|
2012-11-20 23:04:42 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
for (i = 0; i < resolved_combo->len; i++)
|
|
|
|
{
|
|
|
|
xkb_keycode_t keycode = resolved_combo->keycodes[i];
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"%s keybinding keycode %d mask 0x%x on 0x%lx",
|
2017-04-25 11:17:02 +00:00
|
|
|
grab ? "Grabbing" : "Ungrabbing",
|
|
|
|
keycode, resolved_combo->mask, xwindow);
|
|
|
|
|
|
|
|
if (grab)
|
|
|
|
XIGrabKeycode (xdisplay,
|
|
|
|
META_VIRTUAL_CORE_KEYBOARD_ID,
|
|
|
|
keycode, xwindow,
|
|
|
|
XIGrabModeSync, XIGrabModeAsync,
|
|
|
|
False, &mask, mods->len, (XIGrabModifiers *)mods->data);
|
|
|
|
else
|
|
|
|
XIUngrabKeycode (xdisplay,
|
|
|
|
META_VIRTUAL_CORE_KEYBOARD_ID,
|
|
|
|
keycode, xwindow,
|
|
|
|
mods->len, (XIGrabModifiers *)mods->data);
|
|
|
|
}
|
2002-10-21 21:44:35 +00:00
|
|
|
|
2016-02-10 14:36:07 +00:00
|
|
|
g_array_free (mods, TRUE);
|
2001-10-05 02:58:48 +00:00
|
|
|
}
|
|
|
|
|
2014-03-03 13:08:34 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys;
|
2014-03-03 13:08:34 +00:00
|
|
|
Window xwindow;
|
2014-05-20 13:59:45 +00:00
|
|
|
gboolean only_per_window;
|
2014-03-03 13:08:34 +00:00
|
|
|
gboolean grab;
|
|
|
|
} ChangeKeygrabData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
change_keygrab_foreach (gpointer key,
|
|
|
|
gpointer value,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
ChangeKeygrabData *data = user_data;
|
|
|
|
MetaKeyBinding *binding = value;
|
2014-05-20 13:59:45 +00:00
|
|
|
gboolean binding_is_per_window = (binding->flags & META_KEY_BINDING_PER_WINDOW) != 0;
|
2014-03-03 13:08:34 +00:00
|
|
|
|
2014-05-20 13:59:45 +00:00
|
|
|
if (data->only_per_window != binding_is_per_window)
|
|
|
|
return;
|
|
|
|
|
2019-07-15 15:24:35 +00:00
|
|
|
/* Ignore the key bindings marked as META_KEY_BINDING_NO_AUTO_GRAB,
|
|
|
|
* those are handled separately
|
|
|
|
*/
|
|
|
|
if (binding->flags & META_KEY_BINDING_NO_AUTO_GRAB)
|
|
|
|
return;
|
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
if (binding->resolved_combo.len == 0)
|
2014-05-20 13:59:45 +00:00
|
|
|
return;
|
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
meta_change_keygrab (data->keys, data->xwindow, data->grab, &binding->resolved_combo);
|
2014-03-03 13:08:34 +00:00
|
|
|
}
|
|
|
|
|
2001-10-05 02:58:48 +00:00
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
change_binding_keygrabs (MetaKeyBindingManager *keys,
|
2019-07-15 16:37:20 +00:00
|
|
|
Window xwindow,
|
|
|
|
gboolean only_per_window,
|
|
|
|
gboolean grab)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2014-03-03 13:08:34 +00:00
|
|
|
ChangeKeygrabData data;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
data.keys = keys;
|
2014-03-03 13:08:34 +00:00
|
|
|
data.xwindow = xwindow;
|
2014-05-20 13:59:45 +00:00
|
|
|
data.only_per_window = only_per_window;
|
2014-03-03 13:08:34 +00:00
|
|
|
data.grab = grab;
|
2002-11-06 16:00:56 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_foreach (keys->key_bindings, change_keygrab_foreach, &data);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
2019-07-15 11:13:45 +00:00
|
|
|
static void
|
|
|
|
maybe_update_locate_pointer_keygrab (MetaDisplay *display,
|
|
|
|
gboolean grab)
|
|
|
|
{
|
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
|
|
|
if (!display->x11_display)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (keys->locate_pointer_resolved_key_combo.len != 0)
|
|
|
|
meta_change_keygrab (keys, display->x11_display->xroot,
|
|
|
|
(!!grab & !!meta_prefs_is_locate_pointer_enabled()),
|
|
|
|
&keys->locate_pointer_resolved_key_combo);
|
|
|
|
}
|
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
static void
|
2017-08-26 19:38:59 +00:00
|
|
|
meta_x11_display_change_keygrabs (MetaX11Display *x11_display,
|
|
|
|
gboolean grab)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2017-08-26 19:38:59 +00:00
|
|
|
MetaKeyBindingManager *keys = &x11_display->display->key_binding_manager;
|
2017-04-25 11:17:02 +00:00
|
|
|
int i;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
if (keys->overlay_resolved_key_combo.len != 0)
|
2017-08-26 19:38:59 +00:00
|
|
|
meta_change_keygrab (keys, x11_display->xroot,
|
2017-08-26 16:26:30 +00:00
|
|
|
grab, &keys->overlay_resolved_key_combo);
|
2013-03-31 17:06:40 +00:00
|
|
|
|
2019-07-15 11:13:45 +00:00
|
|
|
maybe_update_locate_pointer_keygrab (x11_display->display, grab);
|
2019-02-20 10:53:54 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
for (i = 0; i < keys->n_iso_next_group_combos; i++)
|
2017-08-26 19:38:59 +00:00
|
|
|
meta_change_keygrab (keys, x11_display->xroot,
|
2017-08-26 16:26:30 +00:00
|
|
|
grab, &keys->iso_next_group_combo[i]);
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2017-08-26 19:38:59 +00:00
|
|
|
change_binding_keygrabs (keys, x11_display->xroot,
|
2017-08-26 16:26:30 +00:00
|
|
|
FALSE, grab);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-26 19:38:59 +00:00
|
|
|
meta_x11_display_grab_keys (MetaX11Display *x11_display)
|
2001-06-23 05:49:35 +00:00
|
|
|
{
|
2017-08-26 19:38:59 +00:00
|
|
|
if (x11_display->keys_grabbed)
|
2002-04-28 04:52:26 +00:00
|
|
|
return;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2017-08-26 19:38:59 +00:00
|
|
|
meta_x11_display_change_keygrabs (x11_display, TRUE);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2017-08-26 19:38:59 +00:00
|
|
|
x11_display->keys_grabbed = TRUE;
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-26 19:38:59 +00:00
|
|
|
meta_x11_display_ungrab_keys (MetaX11Display *x11_display)
|
2001-06-23 05:49:35 +00:00
|
|
|
{
|
2017-08-26 19:38:59 +00:00
|
|
|
if (!x11_display->keys_grabbed)
|
2013-03-31 17:06:40 +00:00
|
|
|
return;
|
|
|
|
|
2017-08-26 19:38:59 +00:00
|
|
|
meta_x11_display_change_keygrabs (x11_display, FALSE);
|
2013-03-31 17:06:40 +00:00
|
|
|
|
2017-08-26 19:38:59 +00:00
|
|
|
x11_display->keys_grabbed = FALSE;
|
2013-03-31 17:06:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-08-14 19:33:45 +00:00
|
|
|
change_window_keygrabs (MetaKeyBindingManager *keys,
|
|
|
|
Window xwindow,
|
|
|
|
gboolean grab)
|
2013-03-31 17:06:40 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
change_binding_keygrabs (keys, xwindow, TRUE, grab);
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_grab_keys (MetaWindow *window)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaDisplay *display = window->display;
|
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2019-08-09 09:24:01 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
2019-05-24 17:40:07 +00:00
|
|
|
return;
|
2001-07-11 06:22:00 +00:00
|
|
|
if (window->all_keys_grabbed)
|
|
|
|
return;
|
2003-02-27 22:44:36 +00:00
|
|
|
|
2008-11-23 19:28:40 +00:00
|
|
|
if (window->type == META_WINDOW_DOCK
|
|
|
|
|| window->override_redirect)
|
2003-02-27 22:44:36 +00:00
|
|
|
{
|
|
|
|
if (window->keys_grabbed)
|
2014-08-14 19:33:45 +00:00
|
|
|
change_window_keygrabs (keys, window->xwindow, FALSE);
|
2003-02-27 22:44:36 +00:00
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
return;
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
if (window->keys_grabbed)
|
|
|
|
{
|
|
|
|
if (window->frame && !window->grab_on_frame)
|
2014-08-14 19:33:45 +00:00
|
|
|
change_window_keygrabs (keys, window->xwindow, FALSE);
|
2001-06-23 05:49:35 +00:00
|
|
|
else if (window->frame == NULL &&
|
|
|
|
window->grab_on_frame)
|
|
|
|
; /* continue to regrab on client window */
|
|
|
|
else
|
|
|
|
return; /* already all good */
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
change_window_keygrabs (keys,
|
|
|
|
meta_window_x11_get_toplevel_xwindow (window),
|
|
|
|
TRUE);
|
2001-06-23 05:49:35 +00:00
|
|
|
|
|
|
|
window->keys_grabbed = TRUE;
|
|
|
|
window->grab_on_frame = window->frame != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_ungrab_keys (MetaWindow *window)
|
|
|
|
{
|
2019-05-24 17:40:07 +00:00
|
|
|
if (!meta_is_wayland_compositor () && window->keys_grabbed)
|
2001-06-23 05:49:35 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaDisplay *display = window->display;
|
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
if (window->grab_on_frame &&
|
|
|
|
window->frame != NULL)
|
2014-08-14 19:33:45 +00:00
|
|
|
change_window_keygrabs (keys, window->frame->xwindow, FALSE);
|
2001-06-23 05:49:35 +00:00
|
|
|
else if (!window->grab_on_frame)
|
2014-08-14 19:33:45 +00:00
|
|
|
change_window_keygrabs (keys, window->xwindow, FALSE);
|
2002-06-09 00:09:01 +00:00
|
|
|
|
|
|
|
window->keys_grabbed = FALSE;
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-28 13:28:11 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_external_grab (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer user_data)
|
2012-08-28 13:28:11 +00:00
|
|
|
{
|
2015-01-07 03:11:23 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2015-01-07 22:48:32 +00:00
|
|
|
guint action = get_keybinding_action (keys, &binding->resolved_combo);
|
2013-10-03 22:03:53 +00:00
|
|
|
meta_display_accelerator_activate (display, action, event);
|
2012-08-28 13:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
guint
|
2018-07-18 18:33:16 +00:00
|
|
|
meta_display_grab_accelerator (MetaDisplay *display,
|
|
|
|
const char *accelerator,
|
|
|
|
MetaKeyBindingFlags flags)
|
2012-08-28 13:28:11 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2014-03-03 13:08:34 +00:00
|
|
|
MetaKeyBinding *binding;
|
2012-08-28 13:28:11 +00:00
|
|
|
MetaKeyGrab *grab;
|
2016-05-11 16:07:49 +00:00
|
|
|
MetaKeyCombo combo = { 0 };
|
2017-04-25 11:17:02 +00:00
|
|
|
MetaResolvedKeyCombo resolved_combo = { NULL, 0 };
|
2012-08-28 13:28:11 +00:00
|
|
|
|
2015-01-07 02:59:53 +00:00
|
|
|
if (!meta_parse_accelerator (accelerator, &combo))
|
2012-08-28 13:28:11 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Failed to parse accelerator");
|
|
|
|
meta_warning ("\"%s\" is not a valid accelerator", accelerator);
|
2012-08-28 13:28:11 +00:00
|
|
|
|
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
}
|
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
resolve_key_combo (keys, &combo, &resolved_combo);
|
2012-08-28 13:28:11 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
if (resolved_combo.len == 0)
|
2012-08-28 13:28:11 +00:00
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
if (get_keybinding (keys, &resolved_combo))
|
2017-04-25 11:17:02 +00:00
|
|
|
{
|
|
|
|
resolved_key_combo_reset (&resolved_combo);
|
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
}
|
2012-08-28 13:28:11 +00:00
|
|
|
|
2019-05-24 17:40:07 +00:00
|
|
|
if (!meta_is_wayland_compositor ())
|
|
|
|
{
|
|
|
|
meta_change_keygrab (keys, display->x11_display->xroot,
|
|
|
|
TRUE, &resolved_combo);
|
|
|
|
}
|
2012-08-28 13:28:11 +00:00
|
|
|
|
|
|
|
grab = g_new0 (MetaKeyGrab, 1);
|
|
|
|
grab->action = next_dynamic_keybinding_action ();
|
|
|
|
grab->name = meta_external_binding_name_for_action (grab->action);
|
2015-01-07 02:31:33 +00:00
|
|
|
grab->combo = combo;
|
2018-08-24 19:20:13 +00:00
|
|
|
grab->flags = flags;
|
2012-08-28 13:28:11 +00:00
|
|
|
|
|
|
|
g_hash_table_insert (external_grabs, grab->name, grab);
|
|
|
|
|
2020-10-19 17:57:57 +00:00
|
|
|
binding = g_new0 (MetaKeyBinding, 1);
|
2012-08-28 13:28:11 +00:00
|
|
|
binding->name = grab->name;
|
|
|
|
binding->handler = HANDLER ("external-grab");
|
2015-01-07 02:31:33 +00:00
|
|
|
binding->combo = combo;
|
2015-01-07 22:48:32 +00:00
|
|
|
binding->resolved_combo = resolved_combo;
|
2018-07-18 18:33:16 +00:00
|
|
|
binding->flags = flags;
|
2012-08-28 13:28:11 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_add (keys->key_bindings, binding);
|
|
|
|
index_binding (keys, binding);
|
2014-03-03 13:08:34 +00:00
|
|
|
|
2012-08-28 13:28:11 +00:00
|
|
|
return grab->action;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_display_ungrab_accelerator (MetaDisplay *display,
|
|
|
|
guint action)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2014-03-03 18:33:08 +00:00
|
|
|
MetaKeyBinding *binding;
|
2012-08-28 13:28:11 +00:00
|
|
|
MetaKeyGrab *grab;
|
2019-03-06 13:07:02 +00:00
|
|
|
g_autofree char *key = NULL;
|
2017-04-25 11:17:02 +00:00
|
|
|
MetaResolvedKeyCombo resolved_combo = { NULL, 0 };
|
2012-08-28 13:28:11 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (action != META_KEYBINDING_ACTION_NONE, FALSE);
|
|
|
|
|
|
|
|
key = meta_external_binding_name_for_action (action);
|
|
|
|
grab = g_hash_table_lookup (external_grabs, key);
|
|
|
|
if (!grab)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
resolve_key_combo (keys, &grab->combo, &resolved_combo);
|
|
|
|
binding = get_keybinding (keys, &resolved_combo);
|
2014-03-03 18:33:08 +00:00
|
|
|
if (binding)
|
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
int i;
|
2014-03-03 13:08:34 +00:00
|
|
|
|
2019-05-24 17:40:07 +00:00
|
|
|
if (!meta_is_wayland_compositor ())
|
|
|
|
{
|
|
|
|
meta_change_keygrab (keys, display->x11_display->xroot,
|
|
|
|
FALSE, &binding->resolved_combo);
|
|
|
|
}
|
2014-03-03 18:33:08 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
for (i = 0; i < binding->resolved_combo.len; i++)
|
|
|
|
{
|
|
|
|
guint32 index_key = key_combo_key (&binding->resolved_combo, i);
|
|
|
|
g_hash_table_remove (keys->key_bindings_index, GINT_TO_POINTER (index_key));
|
|
|
|
}
|
2014-03-03 13:08:34 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
g_hash_table_remove (keys->key_bindings, binding);
|
2014-03-03 18:33:08 +00:00
|
|
|
}
|
2012-08-28 13:28:11 +00:00
|
|
|
|
|
|
|
g_hash_table_remove (external_grabs, key);
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_key_combo_reset (&resolved_combo);
|
2012-08-28 13:28:11 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-06-27 05:08:32 +00:00
|
|
|
static gboolean
|
2022-05-27 20:27:07 +00:00
|
|
|
grab_keyboard (MetaBackend *backend,
|
|
|
|
Window xwindow,
|
|
|
|
uint32_t timestamp,
|
|
|
|
int grab_mode)
|
2002-06-27 05:08:32 +00:00
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaBackendX11 *backend_x11;
|
|
|
|
Display *xdisplay;
|
2003-01-21 22:40:25 +00:00
|
|
|
int grab_status;
|
2012-11-20 22:11:13 +00:00
|
|
|
|
|
|
|
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
|
|
|
|
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
|
|
|
|
|
|
|
|
XISetMask (mask.mask, XI_KeyPress);
|
|
|
|
XISetMask (mask.mask, XI_KeyRelease);
|
|
|
|
|
2016-04-18 13:29:42 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
|
|
|
return TRUE;
|
|
|
|
|
2002-07-02 05:03:28 +00:00
|
|
|
/* Grab the keyboard, so we get key releases and all key
|
2002-06-27 05:08:32 +00:00
|
|
|
* presses
|
|
|
|
*/
|
2014-04-23 20:23:26 +00:00
|
|
|
|
2022-05-27 20:27:07 +00:00
|
|
|
backend_x11 = META_BACKEND_X11 (backend);
|
|
|
|
xdisplay = meta_backend_x11_get_xdisplay (backend_x11);
|
2002-06-27 05:08:32 +00:00
|
|
|
|
2013-03-29 01:38:43 +00:00
|
|
|
/* Strictly, we only need to set grab_mode on the keyboard device
|
|
|
|
* while the pointer should always be XIGrabModeAsync. Unfortunately
|
|
|
|
* there is a bug in the X server, only fixed (link below) in 1.15,
|
|
|
|
* which swaps these arguments for keyboard devices. As such, we set
|
|
|
|
* both the device and the paired device mode which works around
|
|
|
|
* that bug and also works on fixed X servers.
|
|
|
|
*
|
|
|
|
* http://cgit.freedesktop.org/xorg/xserver/commit/?id=9003399708936481083424b4ff8f18a16b88b7b3
|
|
|
|
*/
|
2014-04-23 20:23:26 +00:00
|
|
|
grab_status = XIGrabDevice (xdisplay,
|
2012-11-20 22:11:13 +00:00
|
|
|
META_VIRTUAL_CORE_KEYBOARD_ID,
|
|
|
|
xwindow,
|
|
|
|
timestamp,
|
|
|
|
None,
|
2013-03-29 01:38:43 +00:00
|
|
|
grab_mode, grab_mode,
|
2013-05-29 18:51:43 +00:00
|
|
|
False, /* owner_events */
|
2012-11-20 22:11:13 +00:00
|
|
|
&mask);
|
|
|
|
|
2014-04-24 14:57:20 +00:00
|
|
|
return (grab_status == Success);
|
2002-06-27 05:08:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-05-27 20:27:07 +00:00
|
|
|
ungrab_keyboard (MetaBackend *backend,
|
|
|
|
uint32_t timestamp)
|
2002-06-27 05:08:32 +00:00
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaBackendX11 *backend_x11;
|
|
|
|
Display *xdisplay;
|
|
|
|
|
2016-04-18 13:29:42 +00:00
|
|
|
if (meta_is_wayland_compositor ())
|
|
|
|
return;
|
|
|
|
|
2022-05-27 20:27:07 +00:00
|
|
|
backend_x11 = META_BACKEND_X11 (backend);
|
|
|
|
xdisplay = meta_backend_x11_get_xdisplay (backend_x11);
|
2002-06-27 05:08:32 +00:00
|
|
|
|
2014-04-23 20:23:26 +00:00
|
|
|
XIUngrabDevice (xdisplay, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
|
2002-06-27 05:08:32 +00:00
|
|
|
}
|
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
gboolean
|
2006-08-21 18:38:21 +00:00
|
|
|
meta_window_grab_all_keys (MetaWindow *window,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 16:32:33 +00:00
|
|
|
guint32 timestamp)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaDisplay *display = meta_window_get_display (window);
|
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2001-07-11 06:22:00 +00:00
|
|
|
Window grabwindow;
|
2019-05-24 17:40:07 +00:00
|
|
|
gboolean retval = TRUE;
|
2013-11-15 02:34:20 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
if (window->all_keys_grabbed)
|
|
|
|
return FALSE;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
if (window->keys_grabbed)
|
|
|
|
meta_window_ungrab_keys (window);
|
|
|
|
|
|
|
|
/* Make sure the window is focused, otherwise the grab
|
|
|
|
* won't do a lot of good.
|
|
|
|
*/
|
2002-01-03 23:28:19 +00:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Focusing %s because we're grabbing all its keys",
|
2002-01-03 23:28:19 +00:00
|
|
|
window->desc);
|
2006-08-21 18:38:21 +00:00
|
|
|
meta_window_focus (window, timestamp);
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2019-05-24 17:40:07 +00:00
|
|
|
if (!meta_is_wayland_compositor ())
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2019-05-24 17:40:07 +00:00
|
|
|
grabwindow = meta_window_x11_get_toplevel_xwindow (window);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Grabbing all keys on window %s", window->desc);
|
2022-05-27 20:27:07 +00:00
|
|
|
retval = grab_keyboard (backend, grabwindow, timestamp, XIGrabModeAsync);
|
2020-01-09 02:12:41 +00:00
|
|
|
}
|
|
|
|
if (retval)
|
|
|
|
{
|
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
window->all_keys_grabbed = TRUE;
|
|
|
|
window->grab_on_frame = window->frame != NULL;
|
2001-07-11 06:22:00 +00:00
|
|
|
}
|
2002-01-03 23:28:19 +00:00
|
|
|
|
2002-06-27 05:08:32 +00:00
|
|
|
return retval;
|
2001-07-11 06:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-05-24 17:40:07 +00:00
|
|
|
meta_window_ungrab_all_keys (MetaWindow *window,
|
|
|
|
guint32 timestamp)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2020-01-09 02:12:41 +00:00
|
|
|
if (window->all_keys_grabbed)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2020-01-09 02:12:41 +00:00
|
|
|
if (!meta_is_wayland_compositor())
|
2022-05-27 20:27:07 +00:00
|
|
|
{
|
|
|
|
MetaDisplay *display = meta_window_get_display (window);
|
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
|
|
|
|
|
|
|
ungrab_keyboard (backend, timestamp);
|
|
|
|
}
|
2002-01-03 23:28:19 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
window->grab_on_frame = FALSE;
|
|
|
|
window->all_keys_grabbed = FALSE;
|
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
|
|
|
|
/* Re-establish our standard bindings */
|
|
|
|
meta_window_grab_keys (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-29 01:38:43 +00:00
|
|
|
void
|
2014-10-13 04:52:30 +00:00
|
|
|
meta_display_freeze_keyboard (MetaDisplay *display, guint32 timestamp)
|
2013-03-29 01:38:43 +00:00
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2014-09-10 16:30:14 +00:00
|
|
|
|
|
|
|
if (!META_IS_BACKEND_X11 (backend))
|
|
|
|
return;
|
|
|
|
|
2014-10-13 04:52:30 +00:00
|
|
|
Window window = meta_backend_x11_get_xwindow (META_BACKEND_X11 (backend));
|
2022-05-27 20:27:07 +00:00
|
|
|
grab_keyboard (backend, window, timestamp, XIGrabModeSync);
|
2013-03-29 01:38:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_ungrab_keyboard (MetaDisplay *display, guint32 timestamp)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
|
|
|
|
|
|
|
ungrab_keyboard (backend, timestamp);
|
2013-03-29 01:38:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_unfreeze_keyboard (MetaDisplay *display, guint32 timestamp)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2014-04-23 20:23:26 +00:00
|
|
|
|
|
|
|
if (!META_IS_BACKEND_X11 (backend))
|
|
|
|
return;
|
|
|
|
|
|
|
|
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
|
|
|
|
|
|
|
XIAllowEvents (xdisplay, META_VIRTUAL_CORE_KEYBOARD_ID,
|
2013-03-29 01:38:43 +00:00
|
|
|
XIAsyncDevice, timestamp);
|
|
|
|
/* We shouldn't need to unfreeze the pointer device here, however we
|
|
|
|
* have to, due to the workaround we do in grab_keyboard().
|
|
|
|
*/
|
2014-04-23 20:23:26 +00:00
|
|
|
XIAllowEvents (xdisplay, META_VIRTUAL_CORE_POINTER_ID,
|
2013-03-29 01:38:43 +00:00
|
|
|
XIAsyncDevice, timestamp);
|
|
|
|
}
|
|
|
|
|
2012-12-13 01:50:43 +00:00
|
|
|
static gboolean
|
2014-04-07 19:41:37 +00:00
|
|
|
is_modifier (xkb_keysym_t keysym)
|
|
|
|
{
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XKB_KEY_Shift_L:
|
|
|
|
case XKB_KEY_Shift_R:
|
|
|
|
case XKB_KEY_Control_L:
|
|
|
|
case XKB_KEY_Control_R:
|
|
|
|
case XKB_KEY_Caps_Lock:
|
|
|
|
case XKB_KEY_Shift_Lock:
|
|
|
|
case XKB_KEY_Meta_L:
|
|
|
|
case XKB_KEY_Meta_R:
|
|
|
|
case XKB_KEY_Alt_L:
|
|
|
|
case XKB_KEY_Alt_R:
|
|
|
|
case XKB_KEY_Super_L:
|
|
|
|
case XKB_KEY_Super_R:
|
|
|
|
case XKB_KEY_Hyper_L:
|
|
|
|
case XKB_KEY_Hyper_R:
|
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
2001-08-19 18:09:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-25 20:54:54 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
invoke_handler (MetaDisplay *display,
|
|
|
|
MetaKeyHandler *handler,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2009-08-25 20:54:54 +00:00
|
|
|
{
|
|
|
|
if (handler->func)
|
2017-08-26 19:43:17 +00:00
|
|
|
(* handler->func) (display,
|
2011-10-28 01:05:43 +00:00
|
|
|
handler->flags & META_KEY_BINDING_PER_WINDOW ?
|
2012-12-13 01:50:43 +00:00
|
|
|
window : NULL,
|
2009-08-25 20:54:54 +00:00
|
|
|
event,
|
|
|
|
binding,
|
|
|
|
handler->user_data);
|
|
|
|
else
|
2017-08-26 19:43:17 +00:00
|
|
|
(* handler->default_func) (display,
|
2011-10-28 01:05:43 +00:00
|
|
|
handler->flags & META_KEY_BINDING_PER_WINDOW ?
|
2012-12-13 01:50:43 +00:00
|
|
|
window: NULL,
|
2009-08-25 20:54:54 +00:00
|
|
|
event,
|
|
|
|
binding,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
keybinding: Check for handler functions as well
With the addition of the locate-pointer special keybinding (defaults to
the [Control] key), we have now two separate special modifier keys which
can be triggered separately, one for the locate-pointer action and
another one for overlay.
When processing those special modifier keys, mutter must ensure that the
key was pressed alone, being a modifier, the key could otherwise be part
of another key combo.
As result, if both special modifiers keys are pressed simultaneously,
mutter will try to trigger the function for the second key being
pressed, and since those special modifier keys have no default handler
function set, that will crash mutter.
Check if the handler has a function associated and treat the keybinding
as not found if no handler function is set, as with the special modifier
keys.
https://gitlab.gnome.org/GNOME/mutter/issues/823
2019-09-24 14:58:32 +00:00
|
|
|
static gboolean
|
|
|
|
meta_key_binding_has_handler_func (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return (!!binding->handler->func || !!binding->handler->default_func);
|
|
|
|
}
|
|
|
|
|
2008-03-11 03:37:54 +00:00
|
|
|
static gboolean
|
2014-03-03 13:08:34 +00:00
|
|
|
process_event (MetaDisplay *display,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
2014-02-26 17:56:17 +00:00
|
|
|
ClutterKeyEvent *event)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2017-04-25 11:17:02 +00:00
|
|
|
xkb_keycode_t keycode = (xkb_keycode_t) event->hardware_keycode;
|
|
|
|
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
|
2014-03-03 18:33:08 +00:00
|
|
|
MetaKeyBinding *binding;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-06-16 03:03:08 +00:00
|
|
|
/* we used to have release-based bindings but no longer. */
|
2013-10-03 22:03:53 +00:00
|
|
|
if (event->type == CLUTTER_KEY_RELEASE)
|
2008-03-11 03:37:54 +00:00
|
|
|
return FALSE;
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2017-04-25 11:17:02 +00:00
|
|
|
resolved_combo.mask = mask_from_event_params (keys, event->modifier_state);
|
2015-01-07 03:11:23 +00:00
|
|
|
|
2015-01-07 22:48:32 +00:00
|
|
|
binding = get_keybinding (keys, &resolved_combo);
|
2015-01-07 03:11:23 +00:00
|
|
|
|
2014-03-03 18:33:08 +00:00
|
|
|
if (!binding ||
|
2014-03-20 14:24:43 +00:00
|
|
|
(!window && binding->flags & META_KEY_BINDING_PER_WINDOW))
|
|
|
|
goto not_found;
|
|
|
|
|
2019-09-24 14:55:25 +00:00
|
|
|
if (binding->handler == NULL)
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_bug ("Binding %s has no handler", binding->name);
|
2019-09-24 14:55:25 +00:00
|
|
|
|
keybinding: Check for handler functions as well
With the addition of the locate-pointer special keybinding (defaults to
the [Control] key), we have now two separate special modifier keys which
can be triggered separately, one for the locate-pointer action and
another one for overlay.
When processing those special modifier keys, mutter must ensure that the
key was pressed alone, being a modifier, the key could otherwise be part
of another key combo.
As result, if both special modifiers keys are pressed simultaneously,
mutter will try to trigger the function for the second key being
pressed, and since those special modifier keys have no default handler
function set, that will crash mutter.
Check if the handler has a function associated and treat the keybinding
as not found if no handler function is set, as with the special modifier
keys.
https://gitlab.gnome.org/GNOME/mutter/issues/823
2019-09-24 14:58:32 +00:00
|
|
|
if (!meta_key_binding_has_handler_func (binding))
|
|
|
|
goto not_found;
|
|
|
|
|
2017-03-17 12:34:52 +00:00
|
|
|
if (display->focus_window &&
|
|
|
|
!(binding->handler->flags & META_KEY_BINDING_NON_MASKABLE))
|
|
|
|
{
|
|
|
|
ClutterInputDevice *source;
|
|
|
|
|
|
|
|
source = clutter_event_get_source_device ((ClutterEvent *) event);
|
|
|
|
if (meta_window_shortcuts_inhibited (display->focus_window, source))
|
|
|
|
goto not_found;
|
|
|
|
}
|
|
|
|
|
2014-03-20 14:24:43 +00:00
|
|
|
/* If the compositor filtered out the keybindings, that
|
|
|
|
* means they don't want the binding to trigger, so we do
|
|
|
|
* the same thing as if the binding didn't exist. */
|
2014-03-18 21:31:22 +00:00
|
|
|
if (meta_compositor_filter_keybinding (display->compositor, binding))
|
2014-03-03 18:33:08 +00:00
|
|
|
goto not_found;
|
|
|
|
|
2018-06-25 15:26:09 +00:00
|
|
|
if (event->flags & CLUTTER_EVENT_FLAG_REPEATED &&
|
|
|
|
binding->flags & META_KEY_BINDING_IGNORE_AUTOREPEAT)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Ignore autorepeat for handler %s",
|
2018-06-25 15:26:09 +00:00
|
|
|
binding->name);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-09-24 14:55:25 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Running handler for %s",
|
2019-09-24 14:55:25 +00:00
|
|
|
binding->name);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2014-03-03 18:33:08 +00:00
|
|
|
/* Global keybindings count as a let-the-terminal-lose-focus
|
|
|
|
* due to new window mapping until the user starts
|
|
|
|
* interacting with the terminal again.
|
|
|
|
*/
|
|
|
|
display->allow_terminal_deactivation = TRUE;
|
2006-01-15 17:03:57 +00:00
|
|
|
|
2017-08-26 19:43:17 +00:00
|
|
|
invoke_handler (display, binding->handler, window, event, binding);
|
2009-02-03 13:20:51 +00:00
|
|
|
|
2014-03-03 18:33:08 +00:00
|
|
|
return TRUE;
|
2002-06-16 03:03:08 +00:00
|
|
|
|
2014-03-03 18:33:08 +00:00
|
|
|
not_found:
|
2002-06-16 03:03:08 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"No handler found for this event in this binding table");
|
2008-03-11 03:37:54 +00:00
|
|
|
return FALSE;
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
2002-06-27 05:08:32 +00:00
|
|
|
|
2011-07-09 00:48:01 +00:00
|
|
|
static gboolean
|
2019-02-20 10:53:54 +00:00
|
|
|
process_special_modifier_key (MetaDisplay *display,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaWindow *window,
|
|
|
|
gboolean *modifier_press_only,
|
|
|
|
MetaResolvedKeyCombo *resolved_key_combo,
|
|
|
|
GFunc trigger_callback)
|
2011-07-09 00:48:01 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2017-09-01 09:45:08 +00:00
|
|
|
MetaBackend *backend = keys->backend;
|
2014-05-07 13:27:42 +00:00
|
|
|
Display *xdisplay;
|
2014-04-23 20:23:26 +00:00
|
|
|
|
2014-05-07 13:27:42 +00:00
|
|
|
if (META_IS_BACKEND_X11 (backend))
|
|
|
|
xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
|
|
|
else
|
|
|
|
xdisplay = NULL;
|
2014-04-23 20:23:26 +00:00
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
if (*modifier_press_only)
|
2011-07-09 00:48:01 +00:00
|
|
|
{
|
2019-02-20 10:53:54 +00:00
|
|
|
if (! resolved_key_combo_has_keycode (resolved_key_combo,
|
2017-04-25 11:17:02 +00:00
|
|
|
event->hardware_keycode))
|
2011-07-09 00:48:01 +00:00
|
|
|
{
|
2019-02-20 10:53:54 +00:00
|
|
|
*modifier_press_only = FALSE;
|
2011-07-09 00:48:01 +00:00
|
|
|
|
keybindings: Avoid double calls to process_event() on the same event
If you first press a key that triggers the "special modifier key" paths
(ctrl, super), and then press another key that doesn't match (yet?) any
keybindings (eg. ctrl+alt, super+x), the second key press goes twice
through process_event(), once in the processing of this so far special
combination and another while we let the event through.
In order to keep things consistent, handle it differently depending on
whether we are a wayland compositor or not. For X11, consider the event
handled after the call to process_event() in process_special_modifier_key().
For Wayland, as XIAllowEvents is not the mechanism that allows clients see
the key event, we can just fall through the regular paths, without this
special handling.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1014
2020-03-12 18:26:37 +00:00
|
|
|
/* If this is a wayland session, we can avoid the shenanigans
|
|
|
|
* about passive grabs below, and let the event continue to
|
|
|
|
* be processed through the regular paths.
|
|
|
|
*/
|
|
|
|
if (!xdisplay)
|
|
|
|
return FALSE;
|
|
|
|
|
2011-07-09 00:48:01 +00:00
|
|
|
/* OK, the user hit modifier+key rather than pressing and
|
2019-02-20 10:53:54 +00:00
|
|
|
* releasing the modifier key alone. We want to handle the key
|
2011-07-09 00:48:01 +00:00
|
|
|
* sequence "normally". Unfortunately, using
|
|
|
|
* XAllowEvents(..., ReplayKeyboard, ...) doesn't quite
|
|
|
|
* work, since global keybindings won't be activated ("this
|
|
|
|
* time, however, the function ignores any passive grabs at
|
|
|
|
* above (toward the root of) the grab_window of the grab
|
|
|
|
* just released.") So, we first explicitly check for one of
|
|
|
|
* our global keybindings, and if not found, we then replay
|
|
|
|
* the event. Other clients with global grabs will be out of
|
|
|
|
* luck.
|
|
|
|
*/
|
2017-08-26 19:43:17 +00:00
|
|
|
if (process_event (display, window, event))
|
2011-07-09 00:48:01 +00:00
|
|
|
{
|
|
|
|
/* As normally, after we've handled a global key
|
|
|
|
* binding, we unfreeze the keyboard but keep the grab
|
|
|
|
* (this is important for something like cycling
|
|
|
|
* windows */
|
2014-05-07 13:27:42 +00:00
|
|
|
|
|
|
|
if (xdisplay)
|
|
|
|
XIAllowEvents (xdisplay,
|
2020-11-17 13:59:42 +00:00
|
|
|
meta_input_device_x11_get_device_id (event->device),
|
2014-05-07 13:27:42 +00:00
|
|
|
XIAsyncDevice, event->time);
|
2011-07-09 00:48:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Replay the event so it gets delivered to our
|
|
|
|
* per-window key bindings or to the application */
|
2014-05-07 13:27:42 +00:00
|
|
|
if (xdisplay)
|
|
|
|
XIAllowEvents (xdisplay,
|
2020-11-17 13:59:42 +00:00
|
|
|
meta_input_device_x11_get_device_id (event->device),
|
2014-05-07 13:27:42 +00:00
|
|
|
XIReplayDevice, event->time);
|
2011-07-09 00:48:01 +00:00
|
|
|
}
|
|
|
|
}
|
2013-10-03 22:03:53 +00:00
|
|
|
else if (event->type == CLUTTER_KEY_RELEASE)
|
2011-07-09 00:48:01 +00:00
|
|
|
{
|
2013-03-04 16:23:46 +00:00
|
|
|
MetaKeyBinding *binding;
|
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
*modifier_press_only = FALSE;
|
2013-10-03 22:03:53 +00:00
|
|
|
|
2011-07-09 00:48:01 +00:00
|
|
|
/* We want to unfreeze events, but keep the grab so that if the user
|
|
|
|
* starts typing into the overlay we get all the keys */
|
2014-05-07 13:27:42 +00:00
|
|
|
if (xdisplay)
|
|
|
|
XIAllowEvents (xdisplay,
|
2020-11-17 13:59:42 +00:00
|
|
|
meta_input_device_x11_get_device_id (event->device),
|
2014-05-07 13:27:42 +00:00
|
|
|
XIAsyncDevice, event->time);
|
2012-08-29 21:07:34 +00:00
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
binding = get_keybinding (keys, resolved_key_combo);
|
2013-03-04 16:23:46 +00:00
|
|
|
if (binding &&
|
2014-03-18 21:31:22 +00:00
|
|
|
meta_compositor_filter_keybinding (display->compositor, binding))
|
2013-03-04 16:23:46 +00:00
|
|
|
return TRUE;
|
2019-02-20 10:53:54 +00:00
|
|
|
trigger_callback (display, NULL);
|
2011-07-09 00:48:01 +00:00
|
|
|
}
|
2013-08-05 15:00:32 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* In some rare race condition, mutter might not receive the Super_L
|
|
|
|
* KeyRelease event because:
|
|
|
|
* - the compositor might end the modal mode and call XIUngrabDevice
|
|
|
|
* while the key is still down
|
|
|
|
* - passive grabs are only activated on KeyPress and not KeyRelease.
|
|
|
|
*
|
2019-02-20 10:53:54 +00:00
|
|
|
* In this case, modifier_press_only might be wrong.
|
2013-08-05 15:00:32 +00:00
|
|
|
* Mutter still ought to acknowledge events, otherwise the X server
|
|
|
|
* will not send the next events.
|
|
|
|
*
|
|
|
|
* https://bugzilla.gnome.org/show_bug.cgi?id=666101
|
|
|
|
*/
|
2014-05-07 13:27:42 +00:00
|
|
|
if (xdisplay)
|
|
|
|
XIAllowEvents (xdisplay,
|
2020-11-17 13:59:42 +00:00
|
|
|
meta_input_device_x11_get_device_id (event->device),
|
2014-05-07 13:27:42 +00:00
|
|
|
XIAsyncDevice, event->time);
|
2013-08-05 15:00:32 +00:00
|
|
|
}
|
2011-07-09 00:48:01 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2013-10-03 22:03:53 +00:00
|
|
|
else if (event->type == CLUTTER_KEY_PRESS &&
|
2020-04-27 15:01:22 +00:00
|
|
|
((event->modifier_state & ~(IGNORED_MODIFIERS)) & CLUTTER_MODIFIER_MASK) == 0 &&
|
2019-02-20 10:53:54 +00:00
|
|
|
resolved_key_combo_has_keycode (resolved_key_combo,
|
2017-04-25 11:17:02 +00:00
|
|
|
event->hardware_keycode))
|
2011-07-09 00:48:01 +00:00
|
|
|
{
|
2019-02-20 10:53:54 +00:00
|
|
|
*modifier_press_only = TRUE;
|
2011-07-09 00:48:01 +00:00
|
|
|
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
|
2019-02-20 10:53:54 +00:00
|
|
|
* on the next event if it's not the release of the modifier key */
|
2014-05-07 13:27:42 +00:00
|
|
|
if (xdisplay)
|
|
|
|
XIAllowEvents (xdisplay,
|
2020-11-17 13:59:42 +00:00
|
|
|
meta_input_device_x11_get_device_id (event->device),
|
2014-05-07 13:27:42 +00:00
|
|
|
XISyncDevice, event->time);
|
2011-07-09 00:48:01 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
process_overlay_key (MetaDisplay *display,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2019-08-22 13:14:21 +00:00
|
|
|
if (display->focus_window && !keys->overlay_key_only_pressed)
|
|
|
|
{
|
|
|
|
ClutterInputDevice *source;
|
|
|
|
|
|
|
|
source = clutter_event_get_source_device ((ClutterEvent *) event);
|
|
|
|
if (meta_window_shortcuts_inhibited (display->focus_window, source))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
return process_special_modifier_key (display,
|
|
|
|
event,
|
|
|
|
window,
|
|
|
|
&keys->overlay_key_only_pressed,
|
|
|
|
&keys->overlay_resolved_key_combo,
|
|
|
|
(GFunc) meta_display_overlay_key_activate);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_locate_pointer (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
meta_compositor_locate_pointer (display->compositor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
process_locate_pointer_key (MetaDisplay *display,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
|
|
|
return process_special_modifier_key (display,
|
|
|
|
event,
|
|
|
|
window,
|
|
|
|
&keys->locate_pointer_key_only_pressed,
|
|
|
|
&keys->locate_pointer_resolved_key_combo,
|
|
|
|
(GFunc) handle_locate_pointer);
|
|
|
|
}
|
|
|
|
|
2013-04-10 11:34:26 +00:00
|
|
|
static gboolean
|
|
|
|
process_iso_next_group (MetaDisplay *display,
|
2013-10-03 22:03:53 +00:00
|
|
|
ClutterKeyEvent *event)
|
2013-04-10 11:34:26 +00:00
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2013-04-10 11:34:26 +00:00
|
|
|
gboolean activate;
|
2017-04-25 11:17:02 +00:00
|
|
|
xkb_keycode_t keycode = (xkb_keycode_t) event->hardware_keycode;
|
|
|
|
xkb_mod_mask_t mask;
|
|
|
|
int i, j;
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2013-11-25 13:06:10 +00:00
|
|
|
if (event->type == CLUTTER_KEY_RELEASE)
|
2013-04-10 11:34:26 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
activate = FALSE;
|
2017-04-25 11:17:02 +00:00
|
|
|
mask = mask_from_event_params (keys, event->modifier_state);
|
2014-09-02 16:11:31 +00:00
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
for (i = 0; i < keys->n_iso_next_group_combos; ++i)
|
2013-04-10 11:34:26 +00:00
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
for (j = 0; j < keys->iso_next_group_combo[i].len; ++j)
|
2013-04-10 11:34:26 +00:00
|
|
|
{
|
2017-04-25 11:17:02 +00:00
|
|
|
if (keycode == keys->iso_next_group_combo[i].keycodes[j] &&
|
|
|
|
mask == keys->iso_next_group_combo[i].mask)
|
|
|
|
{
|
|
|
|
/* If the signal handler returns TRUE the keyboard will
|
|
|
|
remain frozen. It's the signal handler's responsibility
|
|
|
|
to unfreeze it. */
|
|
|
|
if (!meta_display_modifiers_accelerator_activate (display))
|
|
|
|
meta_display_unfreeze_keyboard (display, event->time);
|
|
|
|
activate = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2013-04-10 11:34:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return activate;
|
|
|
|
}
|
|
|
|
|
2014-05-08 18:53:50 +00:00
|
|
|
static gboolean
|
|
|
|
process_key_event (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event)
|
2001-06-23 05:49:35 +00:00
|
|
|
{
|
2008-03-11 03:37:54 +00:00
|
|
|
gboolean keep_grab;
|
2002-06-27 05:08:32 +00:00
|
|
|
gboolean all_keys_grabbed;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2014-04-28 21:28:15 +00:00
|
|
|
all_keys_grabbed = window ? window->all_keys_grabbed : FALSE;
|
2011-07-09 00:48:01 +00:00
|
|
|
if (!all_keys_grabbed)
|
|
|
|
{
|
2019-08-22 13:34:58 +00:00
|
|
|
if (process_overlay_key (display, event, window))
|
2011-07-09 00:48:01 +00:00
|
|
|
return TRUE;
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2019-08-22 13:34:58 +00:00
|
|
|
if (process_locate_pointer_key (display, event, window))
|
|
|
|
return FALSE; /* Continue with the event even if handled */
|
2019-02-20 10:53:54 +00:00
|
|
|
|
2019-08-22 13:34:58 +00:00
|
|
|
if (process_iso_next_group (display, event))
|
2013-04-10 11:34:26 +00:00
|
|
|
return TRUE;
|
2011-07-09 00:48:01 +00:00
|
|
|
}
|
|
|
|
|
2014-04-30 13:30:35 +00:00
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
|
|
|
|
2014-04-30 13:30:35 +00:00
|
|
|
if (META_IS_BACKEND_X11 (backend))
|
|
|
|
{
|
|
|
|
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
|
|
|
XIAllowEvents (xdisplay,
|
2020-11-17 13:59:42 +00:00
|
|
|
meta_input_device_x11_get_device_id (event->device),
|
2014-04-30 13:30:35 +00:00
|
|
|
XIAsyncDevice, event->time);
|
|
|
|
}
|
|
|
|
}
|
2011-07-09 00:48:01 +00:00
|
|
|
|
|
|
|
keep_grab = TRUE;
|
2008-03-11 03:37:54 +00:00
|
|
|
if (all_keys_grabbed)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2008-03-11 03:37:54 +00:00
|
|
|
if (display->grab_op == META_GRAB_OP_NONE)
|
2009-08-11 23:41:50 +00:00
|
|
|
return TRUE;
|
2014-08-15 18:05:04 +00:00
|
|
|
|
2008-03-11 03:37:54 +00:00
|
|
|
/* If we get here we have a global grab, because
|
2012-12-13 01:50:43 +00:00
|
|
|
* we're in some special keyboard mode such as window move
|
|
|
|
* mode.
|
|
|
|
*/
|
2014-08-15 18:05:04 +00:00
|
|
|
if (window == display->grab_window)
|
2008-03-11 03:37:54 +00:00
|
|
|
{
|
2014-08-15 18:05:04 +00:00
|
|
|
if (display->grab_op & META_GRAB_OP_WINDOW_FLAG_KEYBOARD)
|
|
|
|
{
|
|
|
|
if (display->grab_op == META_GRAB_OP_KEYBOARD_MOVING)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Processing event for keyboard move");
|
2017-08-26 19:43:17 +00:00
|
|
|
keep_grab = process_keyboard_move_grab (display, window, event);
|
2014-08-15 18:05:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Processing event for keyboard resize");
|
2017-08-26 19:43:17 +00:00
|
|
|
keep_grab = process_keyboard_resize_grab (display, window, event);
|
2014-08-15 18:05:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-03-11 03:37:54 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Processing event for mouse-only move/resize");
|
2017-08-26 19:43:17 +00:00
|
|
|
keep_grab = process_mouse_move_resize_grab (display, window, event);
|
2008-03-11 03:37:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!keep_grab)
|
2013-10-03 22:03:53 +00:00
|
|
|
meta_display_end_grab_op (display, event->time);
|
2009-08-11 23:41:50 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2008-03-11 03:37:54 +00:00
|
|
|
/* Do the normal keybindings */
|
2017-08-26 19:43:17 +00:00
|
|
|
return process_event (display, window, event);
|
2001-08-19 18:09:10 +00:00
|
|
|
}
|
|
|
|
|
2014-05-08 18:53:50 +00:00
|
|
|
/* Handle a key event. May be called recursively: some key events cause
|
|
|
|
* grabs to be ended and then need to be processed again in their own
|
|
|
|
* right. This cannot cause infinite recursion because we never call
|
|
|
|
* ourselves when there wasn't a grab, and we always clear the grab
|
|
|
|
* first; the invariant is enforced using an assertion. See #112560.
|
|
|
|
*
|
|
|
|
* The return value is whether we handled the key event.
|
|
|
|
*
|
|
|
|
* FIXME: We need to prove there are no race conditions here.
|
|
|
|
* FIXME: Does it correctly handle alt-Tab being followed by another
|
|
|
|
* grabbing keypress without letting go of alt?
|
|
|
|
* FIXME: An iterative solution would probably be simpler to understand
|
|
|
|
* (and help us solve the other fixmes).
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_keybindings_process_event (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
const ClutterEvent *event)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
|
|
|
|
2014-05-08 18:53:50 +00:00
|
|
|
switch (event->type)
|
|
|
|
{
|
2014-05-08 18:58:40 +00:00
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
2019-03-14 09:46:21 +00:00
|
|
|
case CLUTTER_TOUCH_BEGIN:
|
|
|
|
case CLUTTER_TOUCH_END:
|
2021-01-29 19:06:57 +00:00
|
|
|
case CLUTTER_SCROLL:
|
2014-08-14 19:33:45 +00:00
|
|
|
keys->overlay_key_only_pressed = FALSE;
|
2019-02-20 10:53:54 +00:00
|
|
|
keys->locate_pointer_key_only_pressed = FALSE;
|
2014-05-08 18:58:40 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2014-05-08 18:53:50 +00:00
|
|
|
case CLUTTER_KEY_PRESS:
|
|
|
|
case CLUTTER_KEY_RELEASE:
|
|
|
|
return process_key_event (display, window, (ClutterKeyEvent *) event);
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-21 18:38:21 +00:00
|
|
|
static gboolean
|
2013-10-03 22:03:53 +00:00
|
|
|
process_mouse_move_resize_grab (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event)
|
2006-08-21 18:38:21 +00:00
|
|
|
{
|
|
|
|
/* don't care about releases, but eat them, don't end grab */
|
2013-10-03 22:03:53 +00:00
|
|
|
if (event->type == CLUTTER_KEY_RELEASE)
|
2006-08-21 18:38:21 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
if (event->keyval == CLUTTER_KEY_Escape)
|
2006-08-21 18:38:21 +00:00
|
|
|
{
|
2017-09-27 13:11:54 +00:00
|
|
|
MetaTileMode tile_mode;
|
|
|
|
|
2016-01-10 14:16:09 +00:00
|
|
|
/* Hide the tiling preview if necessary */
|
2017-08-26 19:10:38 +00:00
|
|
|
if (display->preview_tile_mode != META_TILE_NONE)
|
|
|
|
meta_display_hide_tile_preview (display);
|
2016-01-10 14:16:09 +00:00
|
|
|
|
|
|
|
/* Restore the original tile mode */
|
2017-09-27 13:11:54 +00:00
|
|
|
tile_mode = display->grab_tile_mode;
|
2016-01-10 14:16:09 +00:00
|
|
|
window->tile_monitor_number = display->grab_tile_monitor_number;
|
|
|
|
|
2006-08-21 18:38:21 +00:00
|
|
|
/* End move or resize and restore to original state. If the
|
|
|
|
* window was a maximized window that had been "shaken loose" we
|
|
|
|
* need to remaximize it. In normal cases, we need to do a
|
2009-05-07 17:53:47 +00:00
|
|
|
* moveresize now to get the position back to the original.
|
2006-08-21 18:38:21 +00:00
|
|
|
*/
|
2017-09-27 13:11:54 +00:00
|
|
|
if (window->shaken_loose || tile_mode == META_TILE_MAXIMIZED)
|
2014-03-13 22:32:20 +00:00
|
|
|
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
2017-09-27 13:11:54 +00:00
|
|
|
else if (tile_mode != META_TILE_NONE)
|
2017-09-27 12:37:57 +00:00
|
|
|
meta_window_restore_tile (window,
|
|
|
|
tile_mode,
|
|
|
|
display->grab_initial_window_pos.width,
|
|
|
|
display->grab_initial_window_pos.height);
|
2009-05-07 17:53:47 +00:00
|
|
|
else
|
2014-05-20 21:47:10 +00:00
|
|
|
meta_window_move_resize_frame (display->grab_window,
|
|
|
|
TRUE,
|
|
|
|
display->grab_initial_window_pos.x,
|
|
|
|
display->grab_initial_window_pos.y,
|
|
|
|
display->grab_initial_window_pos.width,
|
|
|
|
display->grab_initial_window_pos.height);
|
2006-08-21 18:38:21 +00:00
|
|
|
|
2008-03-11 03:37:54 +00:00
|
|
|
/* End grab */
|
2006-08-21 18:38:21 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
static gboolean
|
2013-10-03 22:03:53 +00:00
|
|
|
process_keyboard_move_grab (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event)
|
2001-08-19 18:09:10 +00:00
|
|
|
{
|
2020-05-24 01:07:51 +00:00
|
|
|
MetaEdgeResistanceFlags flags;
|
2001-08-19 18:09:10 +00:00
|
|
|
gboolean handled;
|
2014-05-21 12:46:18 +00:00
|
|
|
MetaRectangle frame_rect;
|
2001-08-19 18:09:10 +00:00
|
|
|
int x, y;
|
|
|
|
int incr;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
handled = FALSE;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
/* don't care about releases, but eat them, don't end grab */
|
2013-10-03 22:03:53 +00:00
|
|
|
if (event->type == CLUTTER_KEY_RELEASE)
|
2001-08-19 18:09:10 +00:00
|
|
|
return TRUE;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
/* don't end grab on modifier key presses */
|
2014-04-07 19:41:37 +00:00
|
|
|
if (is_modifier (event->keyval))
|
2001-08-19 18:09:10 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2014-05-21 12:46:18 +00:00
|
|
|
meta_window_get_frame_rect (window, &frame_rect);
|
|
|
|
x = frame_rect.x;
|
|
|
|
y = frame_rect.y;
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2020-05-23 18:06:14 +00:00
|
|
|
flags = META_EDGE_RESISTANCE_KEYBOARD_OP | META_EDGE_RESISTANCE_WINDOWS;
|
2020-05-24 01:07:51 +00:00
|
|
|
|
|
|
|
if ((event->modifier_state & CLUTTER_SHIFT_MASK) != 0)
|
|
|
|
flags |= META_EDGE_RESISTANCE_SNAP;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
#define SMALL_INCREMENT 1
|
|
|
|
#define NORMAL_INCREMENT 10
|
|
|
|
|
2020-05-24 01:07:51 +00:00
|
|
|
if (flags & META_EDGE_RESISTANCE_SNAP)
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
incr = 1;
|
2013-10-03 22:03:53 +00:00
|
|
|
else if (event->modifier_state & CLUTTER_CONTROL_MASK)
|
2001-08-19 18:09:10 +00:00
|
|
|
incr = SMALL_INCREMENT;
|
|
|
|
else
|
|
|
|
incr = NORMAL_INCREMENT;
|
2001-07-12 05:53:56 +00:00
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
if (event->keyval == CLUTTER_KEY_Escape)
|
2003-04-25 03:32:41 +00:00
|
|
|
{
|
2006-08-21 18:38:21 +00:00
|
|
|
/* End move and restore to original state. If the window was a
|
|
|
|
* maximized window that had been "shaken loose" we need to
|
|
|
|
* remaximize it. In normal cases, we need to do a moveresize
|
2009-05-07 17:53:47 +00:00
|
|
|
* now to get the position back to the original.
|
2003-10-12 06:25:38 +00:00
|
|
|
*/
|
2006-08-21 18:38:21 +00:00
|
|
|
if (window->shaken_loose)
|
2014-03-13 22:32:20 +00:00
|
|
|
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
2009-05-07 17:53:47 +00:00
|
|
|
else
|
2014-05-20 21:47:10 +00:00
|
|
|
meta_window_move_resize_frame (display->grab_window,
|
|
|
|
TRUE,
|
|
|
|
display->grab_initial_window_pos.x,
|
|
|
|
display->grab_initial_window_pos.y,
|
|
|
|
display->grab_initial_window_pos.width,
|
|
|
|
display->grab_initial_window_pos.height);
|
2003-04-25 03:32:41 +00:00
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
/* When moving by increments, we still snap to edges if the move
|
|
|
|
* to the edge is smaller than the increment. This is because
|
|
|
|
* Shift + arrow to snap is sort of a hidden feature. This way
|
|
|
|
* people using just arrows shouldn't get too frustrated.
|
|
|
|
*/
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2001-08-19 18:09:10 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_KP_Home:
|
|
|
|
case CLUTTER_KEY_KP_Prior:
|
|
|
|
case CLUTTER_KEY_Up:
|
|
|
|
case CLUTTER_KEY_KP_Up:
|
2001-08-19 18:09:10 +00:00
|
|
|
y -= incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_KP_End:
|
|
|
|
case CLUTTER_KEY_KP_Next:
|
|
|
|
case CLUTTER_KEY_Down:
|
|
|
|
case CLUTTER_KEY_KP_Down:
|
2001-08-19 18:09:10 +00:00
|
|
|
y += incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2003-04-25 03:32:41 +00:00
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2003-04-25 03:32:41 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_KP_Home:
|
|
|
|
case CLUTTER_KEY_KP_End:
|
|
|
|
case CLUTTER_KEY_Left:
|
|
|
|
case CLUTTER_KEY_KP_Left:
|
2001-08-19 18:09:10 +00:00
|
|
|
x -= incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_KP_Prior:
|
|
|
|
case CLUTTER_KEY_KP_Next:
|
|
|
|
case CLUTTER_KEY_Right:
|
|
|
|
case CLUTTER_KEY_KP_Right:
|
2001-08-19 18:09:10 +00:00
|
|
|
x += incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2001-07-12 05:53:56 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
if (handled)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
{
|
2003-10-12 06:25:38 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Computed new window location %d,%d due to keypress",
|
2003-10-12 06:25:38 +00:00
|
|
|
x, y);
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
|
2012-12-13 01:50:43 +00:00
|
|
|
meta_window_edge_resistance_for_move (window,
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
&x,
|
|
|
|
&y,
|
2020-05-24 01:07:51 +00:00
|
|
|
flags);
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
|
2014-05-21 12:46:18 +00:00
|
|
|
meta_window_move_frame (window, TRUE, x, y);
|
2003-10-12 06:25:38 +00:00
|
|
|
meta_window_update_keyboard_move (window);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
}
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
static gboolean
|
2013-10-03 22:03:53 +00:00
|
|
|
process_keyboard_resize_grab_op_change (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
|
|
|
gboolean handled;
|
|
|
|
|
2005-08-03 02:22:00 +00:00
|
|
|
handled = FALSE;
|
2002-06-19 04:12:49 +00:00
|
|
|
switch (display->grab_op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Up:
|
|
|
|
case CLUTTER_KEY_KP_Up:
|
2012-12-13 01:50:43 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Down:
|
|
|
|
case CLUTTER_KEY_KP_Down:
|
2002-06-19 04:12:49 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Left:
|
|
|
|
case CLUTTER_KEY_KP_Left:
|
2002-06-19 04:12:49 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Right:
|
|
|
|
case CLUTTER_KEY_KP_Right:
|
2002-06-19 04:12:49 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Left:
|
|
|
|
case CLUTTER_KEY_KP_Left:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Right:
|
|
|
|
case CLUTTER_KEY_KP_Right:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Left:
|
|
|
|
case CLUTTER_KEY_KP_Left:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Right:
|
|
|
|
case CLUTTER_KEY_KP_Right:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Up:
|
|
|
|
case CLUTTER_KEY_KP_Up:
|
2012-12-13 01:50:43 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Down:
|
|
|
|
case CLUTTER_KEY_KP_Down:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Up:
|
|
|
|
case CLUTTER_KEY_KP_Up:
|
2012-12-13 01:50:43 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Down:
|
|
|
|
case CLUTTER_KEY_KP_Down:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handled)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
{
|
2003-10-12 06:25:38 +00:00
|
|
|
meta_window_update_keyboard_resize (window, TRUE);
|
2012-12-13 01:50:43 +00:00
|
|
|
return TRUE;
|
2003-10-12 06:25:38 +00:00
|
|
|
}
|
2002-06-19 04:12:49 +00:00
|
|
|
|
2005-08-03 02:22:00 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-10-03 22:03:53 +00:00
|
|
|
process_keyboard_resize_grab (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event)
|
2005-08-03 02:22:00 +00:00
|
|
|
{
|
2014-05-20 22:28:56 +00:00
|
|
|
MetaRectangle frame_rect;
|
2005-08-03 02:22:00 +00:00
|
|
|
gboolean handled;
|
|
|
|
int height_inc;
|
|
|
|
int width_inc;
|
|
|
|
int width, height;
|
2020-05-24 01:07:51 +00:00
|
|
|
MetaEdgeResistanceFlags flags;
|
2020-02-14 08:44:43 +00:00
|
|
|
MetaGravity gravity;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2005-08-03 02:22:00 +00:00
|
|
|
handled = FALSE;
|
|
|
|
|
|
|
|
/* don't care about releases, but eat them, don't end grab */
|
2013-10-03 22:03:53 +00:00
|
|
|
if (event->type == CLUTTER_KEY_RELEASE)
|
2005-08-03 02:22:00 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* don't end grab on modifier key presses */
|
2014-04-07 19:41:37 +00:00
|
|
|
if (is_modifier (event->keyval))
|
2005-08-03 02:22:00 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
if (event->keyval == CLUTTER_KEY_Escape)
|
2005-08-03 02:22:00 +00:00
|
|
|
{
|
2009-05-07 17:53:47 +00:00
|
|
|
/* End resize and restore to original state. */
|
2014-05-20 21:47:10 +00:00
|
|
|
meta_window_move_resize_frame (display->grab_window,
|
|
|
|
TRUE,
|
|
|
|
display->grab_initial_window_pos.x,
|
|
|
|
display->grab_initial_window_pos.y,
|
|
|
|
display->grab_initial_window_pos.width,
|
|
|
|
display->grab_initial_window_pos.height);
|
2005-08-03 02:22:00 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-08-26 19:43:17 +00:00
|
|
|
if (process_keyboard_resize_grab_op_change (display, window, event))
|
2005-08-03 02:22:00 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2009-05-07 17:53:47 +00:00
|
|
|
width = window->rect.width;
|
|
|
|
height = window->rect.height;
|
2002-06-19 04:12:49 +00:00
|
|
|
|
2014-05-20 22:28:56 +00:00
|
|
|
meta_window_get_frame_rect (window, &frame_rect);
|
|
|
|
width = frame_rect.width;
|
|
|
|
height = frame_rect.height;
|
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
gravity = meta_resize_gravity_from_grab_op (display->grab_op);
|
|
|
|
|
2020-05-24 01:07:51 +00:00
|
|
|
flags = META_EDGE_RESISTANCE_KEYBOARD_OP;
|
|
|
|
|
|
|
|
if ((event->modifier_state & CLUTTER_SHIFT_MASK) != 0)
|
|
|
|
flags |= META_EDGE_RESISTANCE_SNAP;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
#define SMALL_INCREMENT 1
|
|
|
|
#define NORMAL_INCREMENT 10
|
|
|
|
|
2020-05-24 01:07:51 +00:00
|
|
|
if (flags & META_EDGE_RESISTANCE_SNAP)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
height_inc = 1;
|
|
|
|
width_inc = 1;
|
2002-06-19 04:12:49 +00:00
|
|
|
}
|
2013-10-03 22:03:53 +00:00
|
|
|
else if (event->modifier_state & CLUTTER_CONTROL_MASK)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width_inc = SMALL_INCREMENT;
|
|
|
|
height_inc = SMALL_INCREMENT;
|
2012-12-13 01:50:43 +00:00
|
|
|
}
|
2002-06-19 04:12:49 +00:00
|
|
|
else
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width_inc = NORMAL_INCREMENT;
|
|
|
|
height_inc = NORMAL_INCREMENT;
|
2002-06-19 04:12:49 +00:00
|
|
|
}
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
|
|
|
|
/* If this is a resize increment window, make the amount we resize
|
|
|
|
* the window by match that amount (well, unless snap resizing...)
|
2002-06-19 04:12:49 +00:00
|
|
|
*/
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window->size_hints.width_inc > 1)
|
|
|
|
width_inc = window->size_hints.width_inc;
|
|
|
|
if (window->size_hints.height_inc > 1)
|
|
|
|
height_inc = window->size_hints.height_inc;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
switch (event->keyval)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Up:
|
|
|
|
case CLUTTER_KEY_KP_Up:
|
2002-06-19 04:12:49 +00:00
|
|
|
switch (gravity)
|
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH:
|
|
|
|
case META_GRAVITY_NORTH_WEST:
|
|
|
|
case META_GRAVITY_NORTH_EAST:
|
2002-06-19 04:12:49 +00:00
|
|
|
/* Move bottom edge up */
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
height -= height_inc;
|
2002-06-19 04:12:49 +00:00
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_SOUTH:
|
|
|
|
case META_GRAVITY_SOUTH_WEST:
|
|
|
|
case META_GRAVITY_SOUTH_EAST:
|
2002-06-19 04:12:49 +00:00
|
|
|
/* Move top edge up */
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
height += height_inc;
|
2002-06-19 04:12:49 +00:00
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_EAST:
|
|
|
|
case META_GRAVITY_WEST:
|
|
|
|
case META_GRAVITY_CENTER:
|
|
|
|
case META_GRAVITY_NONE:
|
|
|
|
case META_GRAVITY_STATIC:
|
2002-06-19 04:12:49 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Down:
|
|
|
|
case CLUTTER_KEY_KP_Down:
|
2002-06-19 04:12:49 +00:00
|
|
|
switch (gravity)
|
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH:
|
|
|
|
case META_GRAVITY_NORTH_WEST:
|
|
|
|
case META_GRAVITY_NORTH_EAST:
|
2002-06-19 04:12:49 +00:00
|
|
|
/* Move bottom edge down */
|
|
|
|
height += height_inc;
|
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_SOUTH:
|
|
|
|
case META_GRAVITY_SOUTH_WEST:
|
|
|
|
case META_GRAVITY_SOUTH_EAST:
|
2002-06-19 04:12:49 +00:00
|
|
|
/* Move top edge down */
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
height -= height_inc;
|
2002-06-19 04:12:49 +00:00
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_EAST:
|
|
|
|
case META_GRAVITY_WEST:
|
|
|
|
case META_GRAVITY_CENTER:
|
|
|
|
case META_GRAVITY_NONE:
|
|
|
|
case META_GRAVITY_STATIC:
|
2002-06-19 04:12:49 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Left:
|
|
|
|
case CLUTTER_KEY_KP_Left:
|
2002-07-03 02:32:40 +00:00
|
|
|
switch (gravity)
|
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_EAST:
|
|
|
|
case META_GRAVITY_SOUTH_EAST:
|
|
|
|
case META_GRAVITY_NORTH_EAST:
|
2005-08-03 02:22:00 +00:00
|
|
|
/* Move left edge left */
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width += width_inc;
|
2002-07-03 02:32:40 +00:00
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_WEST:
|
|
|
|
case META_GRAVITY_SOUTH_WEST:
|
|
|
|
case META_GRAVITY_NORTH_WEST:
|
2002-07-03 02:32:40 +00:00
|
|
|
/* Move right edge left */
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width -= width_inc;
|
2002-07-03 02:32:40 +00:00
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH:
|
|
|
|
case META_GRAVITY_SOUTH:
|
|
|
|
case META_GRAVITY_CENTER:
|
|
|
|
case META_GRAVITY_NONE:
|
|
|
|
case META_GRAVITY_STATIC:
|
2002-07-03 02:32:40 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-07-03 02:32:40 +00:00
|
|
|
handled = TRUE;
|
2002-06-19 04:12:49 +00:00
|
|
|
break;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2013-10-03 22:03:53 +00:00
|
|
|
case CLUTTER_KEY_Right:
|
|
|
|
case CLUTTER_KEY_KP_Right:
|
2002-07-03 02:32:40 +00:00
|
|
|
switch (gravity)
|
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_EAST:
|
|
|
|
case META_GRAVITY_SOUTH_EAST:
|
|
|
|
case META_GRAVITY_NORTH_EAST:
|
2002-07-03 02:32:40 +00:00
|
|
|
/* Move left edge right */
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width -= width_inc;
|
2002-07-03 02:32:40 +00:00
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_WEST:
|
|
|
|
case META_GRAVITY_SOUTH_WEST:
|
|
|
|
case META_GRAVITY_NORTH_WEST:
|
2002-07-03 02:32:40 +00:00
|
|
|
/* Move right edge right */
|
|
|
|
width += width_inc;
|
|
|
|
break;
|
|
|
|
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH:
|
|
|
|
case META_GRAVITY_SOUTH:
|
|
|
|
case META_GRAVITY_CENTER:
|
|
|
|
case META_GRAVITY_NONE:
|
|
|
|
case META_GRAVITY_STATIC:
|
2002-07-03 02:32:40 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-07-03 02:32:40 +00:00
|
|
|
handled = TRUE;
|
2002-06-19 04:12:49 +00:00
|
|
|
break;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fixup hack (just paranoia, not sure it's required) */
|
|
|
|
if (height < 1)
|
|
|
|
height = 1;
|
|
|
|
if (width < 1)
|
|
|
|
width = 1;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
if (handled)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
{
|
2003-10-12 06:25:38 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
"Computed new window size due to keypress: "
|
2020-10-02 15:47:22 +00:00
|
|
|
"%dx%d, gravity %s",
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width, height, meta_gravity_to_string (gravity));
|
2012-12-13 01:50:43 +00:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
/* Do any edge resistance/snapping */
|
|
|
|
meta_window_edge_resistance_for_resize (window,
|
|
|
|
&width,
|
|
|
|
&height,
|
|
|
|
gravity,
|
2020-05-24 01:07:51 +00:00
|
|
|
flags);
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
|
2014-05-20 22:28:56 +00:00
|
|
|
meta_window_resize_frame_with_gravity (window,
|
|
|
|
TRUE,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
gravity);
|
2009-05-07 17:53:47 +00:00
|
|
|
|
2003-10-12 06:25:38 +00:00
|
|
|
meta_window_update_keyboard_resize (window, FALSE);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
}
|
2002-06-19 04:12:49 +00:00
|
|
|
|
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2013-05-17 12:08:57 +00:00
|
|
|
static void
|
|
|
|
handle_switch_to_last_workspace (MetaDisplay *display,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
|
|
|
|
gint target = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1;
|
|
|
|
MetaWorkspace *workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, target);
|
2013-05-17 12:08:57 +00:00
|
|
|
meta_workspace_activate (workspace, event->time);
|
|
|
|
}
|
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_switch_to_workspace (MetaDisplay *display,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2008-10-06 00:24:07 +00:00
|
|
|
gint which = binding->handler->data;
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
|
2001-06-06 04:47:37 +00:00
|
|
|
MetaWorkspace *workspace;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2014-04-17 14:54:37 +00:00
|
|
|
if (which < 0)
|
|
|
|
{
|
|
|
|
/* Negative workspace numbers are directions with respect to the
|
|
|
|
* current workspace.
|
|
|
|
*/
|
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
workspace = meta_workspace_get_neighbor (workspace_manager->active_workspace,
|
2014-04-17 14:54:37 +00:00
|
|
|
which);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, which);
|
2014-04-17 14:54:37 +00:00
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2001-08-03 13:56:39 +00:00
|
|
|
if (workspace)
|
|
|
|
{
|
2012-11-15 21:35:42 +00:00
|
|
|
meta_workspace_activate (workspace, event->time);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We could offer to create it I suppose */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-08 21:09:05 +00:00
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_maximize_vertically (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-12-08 21:09:05 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->has_resize_func)
|
2002-12-08 21:09:05 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window->maximized_vertically)
|
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
|
|
|
|
else
|
|
|
|
meta_window_maximize (window, META_MAXIMIZE_VERTICAL);
|
2002-12-08 21:09:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_maximize_horizontally (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-12-08 21:09:05 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->has_resize_func)
|
2002-12-08 21:09:05 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window->maximized_horizontally)
|
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
|
|
|
|
else
|
|
|
|
meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL);
|
2002-12-08 21:09:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-24 18:55:23 +00:00
|
|
|
static void
|
2013-11-19 19:02:42 +00:00
|
|
|
handle_always_on_top (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2013-07-24 18:55:23 +00:00
|
|
|
{
|
|
|
|
if (window->wm_state_above == FALSE)
|
|
|
|
meta_window_make_above (window);
|
|
|
|
else
|
|
|
|
meta_window_unmake_above (window);
|
|
|
|
}
|
|
|
|
|
2006-11-05 22:23:44 +00:00
|
|
|
static void
|
2014-05-22 20:09:14 +00:00
|
|
|
handle_move_to_corner_backend (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
2020-02-14 08:44:43 +00:00
|
|
|
MetaGravity gravity)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
|
|
|
MetaRectangle work_area;
|
2013-11-19 17:24:45 +00:00
|
|
|
MetaRectangle frame_rect;
|
2006-11-05 22:23:44 +00:00
|
|
|
int new_x, new_y;
|
|
|
|
|
2018-09-25 17:59:43 +00:00
|
|
|
if (!window->monitor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
meta_window_get_work_area_current_monitor (window, &work_area);
|
2013-11-19 17:24:45 +00:00
|
|
|
meta_window_get_frame_rect (window, &frame_rect);
|
2006-11-05 22:23:44 +00:00
|
|
|
|
2014-05-22 20:09:14 +00:00
|
|
|
switch (gravity)
|
2014-05-22 19:44:34 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH_WEST:
|
|
|
|
case META_GRAVITY_WEST:
|
|
|
|
case META_GRAVITY_SOUTH_WEST:
|
2014-05-22 20:09:14 +00:00
|
|
|
new_x = work_area.x;
|
|
|
|
break;
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH:
|
|
|
|
case META_GRAVITY_SOUTH:
|
2014-05-22 19:44:50 +00:00
|
|
|
new_x = frame_rect.x;
|
2014-05-22 20:09:14 +00:00
|
|
|
break;
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH_EAST:
|
|
|
|
case META_GRAVITY_EAST:
|
|
|
|
case META_GRAVITY_SOUTH_EAST:
|
2014-05-22 20:09:14 +00:00
|
|
|
new_x = work_area.x + work_area.width - frame_rect.width;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2014-05-22 19:44:34 +00:00
|
|
|
}
|
2006-11-05 22:23:44 +00:00
|
|
|
|
2014-05-22 20:09:14 +00:00
|
|
|
switch (gravity)
|
2014-05-22 19:44:34 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_NORTH_WEST:
|
|
|
|
case META_GRAVITY_NORTH:
|
|
|
|
case META_GRAVITY_NORTH_EAST:
|
2014-05-22 20:09:14 +00:00
|
|
|
new_y = work_area.y;
|
|
|
|
break;
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_WEST:
|
|
|
|
case META_GRAVITY_EAST:
|
2014-05-22 19:44:50 +00:00
|
|
|
new_y = frame_rect.y;
|
2014-05-22 20:09:14 +00:00
|
|
|
break;
|
2020-02-14 08:44:43 +00:00
|
|
|
case META_GRAVITY_SOUTH_WEST:
|
|
|
|
case META_GRAVITY_SOUTH:
|
|
|
|
case META_GRAVITY_SOUTH_EAST:
|
2014-05-22 20:09:14 +00:00
|
|
|
new_y = work_area.y + work_area.height - frame_rect.height;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2014-05-22 19:44:34 +00:00
|
|
|
}
|
2006-11-05 22:23:44 +00:00
|
|
|
|
2012-03-12 19:40:12 +00:00
|
|
|
meta_window_move_frame (window,
|
|
|
|
TRUE,
|
|
|
|
new_x,
|
|
|
|
new_y);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_corner_nw (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_WEST);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_corner_ne (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_EAST);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_corner_sw (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_WEST);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_corner_se (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_EAST);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_side_n (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_side_s (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_side_e (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_EAST);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_side_w (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 22:23:44 +00:00
|
|
|
{
|
2020-02-14 08:44:43 +00:00
|
|
|
handle_move_to_corner_backend (display, window, META_GRAVITY_WEST);
|
2006-11-05 22:23:44 +00:00
|
|
|
}
|
|
|
|
|
2008-09-01 01:32:39 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_center (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2008-09-01 01:32:39 +00:00
|
|
|
{
|
|
|
|
MetaRectangle work_area;
|
2013-11-19 17:24:45 +00:00
|
|
|
MetaRectangle frame_rect;
|
2008-09-01 01:32:39 +00:00
|
|
|
|
2020-04-30 13:34:38 +00:00
|
|
|
meta_window_get_work_area_current_monitor (window, &work_area);
|
2013-11-19 17:24:45 +00:00
|
|
|
meta_window_get_frame_rect (window, &frame_rect);
|
2008-09-01 01:32:39 +00:00
|
|
|
|
2014-05-21 12:51:24 +00:00
|
|
|
meta_window_move_frame (window,
|
|
|
|
TRUE,
|
|
|
|
work_area.x + (work_area.width - frame_rect.width ) / 2,
|
|
|
|
work_area.y + (work_area.height - frame_rect.height) / 2);
|
2008-09-01 01:32:39 +00:00
|
|
|
}
|
|
|
|
|
2001-10-15 03:39:41 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_show_desktop (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-10-15 03:39:41 +00:00
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
|
|
|
|
|
|
|
|
if (workspace_manager->active_workspace->showing_desktop)
|
2003-05-16 21:59:08 +00:00
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_unshow_desktop (workspace_manager);
|
|
|
|
meta_workspace_focus_default_window (workspace_manager->active_workspace,
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
|
|
|
NULL,
|
2012-11-15 21:35:42 +00:00
|
|
|
event->time);
|
2003-05-16 21:59:08 +00:00
|
|
|
}
|
2001-10-15 03:39:41 +00:00
|
|
|
else
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_show_desktop (workspace_manager, event->time);
|
2001-10-15 03:39:41 +00:00
|
|
|
}
|
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_activate_window_menu (MetaDisplay *display,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-06-23 05:49:35 +00:00
|
|
|
{
|
|
|
|
if (display->focus_window)
|
2014-05-22 12:35:11 +00:00
|
|
|
{
|
|
|
|
int x, y;
|
2014-05-22 14:32:31 +00:00
|
|
|
MetaRectangle frame_rect;
|
|
|
|
cairo_rectangle_int_t child_rect;
|
2014-05-22 12:35:11 +00:00
|
|
|
|
2014-05-22 14:32:31 +00:00
|
|
|
meta_window_get_frame_rect (display->focus_window, &frame_rect);
|
|
|
|
meta_window_get_client_area_rect (display->focus_window, &child_rect);
|
2014-05-22 12:35:11 +00:00
|
|
|
|
2014-05-22 14:32:31 +00:00
|
|
|
x = frame_rect.x + child_rect.x;
|
2014-08-18 02:57:51 +00:00
|
|
|
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_RTL)
|
2014-05-22 14:32:31 +00:00
|
|
|
x += child_rect.width;
|
2014-05-22 12:35:11 +00:00
|
|
|
|
2014-05-22 14:32:31 +00:00
|
|
|
y = frame_rect.y + child_rect.y;
|
2014-05-23 21:14:51 +00:00
|
|
|
meta_window_show_menu (display->focus_window, META_WINDOW_MENU_WM, x, y);
|
2014-05-22 12:35:11 +00:00
|
|
|
}
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
2001-06-24 02:22:10 +00:00
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
do_choose_window (MetaDisplay *display,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
2013-04-23 16:52:25 +00:00
|
|
|
gboolean backward)
|
2001-06-24 02:22:10 +00:00
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
|
2008-10-06 00:24:07 +00:00
|
|
|
MetaTabList type = binding->handler->data;
|
2014-05-15 19:02:22 +00:00
|
|
|
MetaWindow *window;
|
2008-10-06 00:24:07 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Tab list = %u", type);
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2014-05-15 19:02:22 +00:00
|
|
|
window = meta_display_get_tab_next (display,
|
|
|
|
type,
|
2017-08-27 19:02:40 +00:00
|
|
|
workspace_manager->active_workspace,
|
2014-05-15 19:02:22 +00:00
|
|
|
NULL,
|
|
|
|
backward);
|
2002-07-06 16:50:48 +00:00
|
|
|
|
2014-05-15 19:02:46 +00:00
|
|
|
if (window)
|
|
|
|
meta_window_activate (window, event->time);
|
2001-06-24 02:22:10 +00:00
|
|
|
}
|
2001-06-24 03:18:10 +00:00
|
|
|
|
2002-07-06 16:50:48 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_switch (MetaDisplay *display,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-06-24 03:18:10 +00:00
|
|
|
{
|
2014-05-29 18:38:13 +00:00
|
|
|
gboolean backwards = meta_key_binding_is_reversed (binding);
|
2017-08-26 19:43:17 +00:00
|
|
|
do_choose_window (display, event_window, event, binding, backwards);
|
2002-06-09 03:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_cycle (MetaDisplay *display,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
2014-05-29 18:38:13 +00:00
|
|
|
gboolean backwards = meta_key_binding_is_reversed (binding);
|
2017-08-26 19:43:17 +00:00
|
|
|
do_choose_window (display, event_window, event, binding, backwards);
|
2009-08-25 20:54:54 +00:00
|
|
|
}
|
2008-10-06 00:24:07 +00:00
|
|
|
|
2002-04-05 15:52:49 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_toggle_fullscreen (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-05 15:52:49 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->fullscreen)
|
|
|
|
meta_window_unmake_fullscreen (window);
|
|
|
|
else if (window->has_fullscreen_func)
|
|
|
|
meta_window_make_fullscreen (window);
|
2002-04-05 15:52:49 +00:00
|
|
|
}
|
2002-01-11 03:31:14 +00:00
|
|
|
|
2003-06-27 14:49:56 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_toggle_above (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2003-06-27 14:49:56 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->wm_state_above)
|
|
|
|
meta_window_unmake_above (window);
|
|
|
|
else
|
|
|
|
meta_window_make_above (window);
|
2003-06-27 14:49:56 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 16:29:56 +00:00
|
|
|
static void
|
2016-01-10 14:16:09 +00:00
|
|
|
handle_toggle_tiled (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2011-11-15 16:29:56 +00:00
|
|
|
{
|
2016-01-10 14:16:09 +00:00
|
|
|
MetaTileMode mode = binding->handler->data;
|
2011-11-15 16:29:56 +00:00
|
|
|
|
2016-01-10 14:16:09 +00:00
|
|
|
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
|
|
|
|
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
|
|
|
|
{
|
2020-04-02 17:04:43 +00:00
|
|
|
meta_window_untile (window);
|
2016-01-10 14:16:09 +00:00
|
|
|
}
|
|
|
|
else if (meta_window_can_tile_side_by_side (window))
|
|
|
|
{
|
|
|
|
window->tile_monitor_number = window->monitor->number;
|
|
|
|
/* Maximization constraints beat tiling constraints, so if the window
|
|
|
|
* is maximized, tiling won't have any effect unless we unmaximize it
|
|
|
|
* horizontally first; rather than calling meta_window_unmaximize(),
|
|
|
|
* we just set the flag and rely on meta_window_tile() syncing it to
|
|
|
|
* save an additional roundtrip.
|
|
|
|
*/
|
|
|
|
window->maximized_horizontally = FALSE;
|
2017-09-27 13:11:54 +00:00
|
|
|
meta_window_tile (window, mode);
|
2016-01-10 14:16:09 +00:00
|
|
|
}
|
2011-11-15 16:29:56 +00:00
|
|
|
}
|
|
|
|
|
2002-01-11 03:31:14 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_toggle_maximized (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (META_WINDOW_MAXIMIZED (window))
|
2014-03-13 22:32:20 +00:00
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
|
2008-11-22 19:02:54 +00:00
|
|
|
else if (window->has_maximize_func)
|
2014-03-13 22:32:20 +00:00
|
|
|
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2002-08-21 06:47:16 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_maximize (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-21 06:47:16 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->has_maximize_func)
|
2014-03-13 22:32:20 +00:00
|
|
|
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
2002-08-21 06:47:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_unmaximize (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-21 06:47:16 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->maximized_vertically || window->maximized_horizontally)
|
2014-03-13 22:32:20 +00:00
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
|
2002-08-21 06:47:16 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_toggle_shaded (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->shaded)
|
2012-11-15 21:35:42 +00:00
|
|
|
meta_window_unshade (window, event->time);
|
2008-11-22 19:02:54 +00:00
|
|
|
else if (window->has_shade_func)
|
2012-11-15 21:35:42 +00:00
|
|
|
meta_window_shade (window, event->time);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_close (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->has_close_func)
|
2012-11-15 21:35:42 +00:00
|
|
|
meta_window_delete (window, event->time);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2002-05-25 02:30:00 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_minimize (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-05-25 02:30:00 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->has_minimize_func)
|
|
|
|
meta_window_minimize (window);
|
2002-05-25 02:30:00 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_begin_move (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->has_move_func)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
meta_window_begin_grab_op (window,
|
|
|
|
META_GRAB_OP_KEYBOARD_MOVING,
|
2006-10-13 00:28:34 +00:00
|
|
|
FALSE,
|
2012-11-15 21:35:42 +00:00
|
|
|
event->time);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_begin_resize (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->has_resize_func)
|
2002-07-10 03:51:01 +00:00
|
|
|
{
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
meta_window_begin_grab_op (window,
|
|
|
|
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
|
2006-10-13 00:28:34 +00:00
|
|
|
FALSE,
|
2012-11-15 21:35:42 +00:00
|
|
|
event->time);
|
2002-07-10 03:51:01 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_toggle_on_all_workspaces (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2011-02-28 10:41:23 +00:00
|
|
|
if (window->on_all_workspaces_requested)
|
2008-11-22 19:02:54 +00:00
|
|
|
meta_window_unstick (window);
|
|
|
|
else
|
|
|
|
meta_window_stick (window);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2013-05-17 12:08:57 +00:00
|
|
|
static void
|
|
|
|
handle_move_to_workspace_last (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
|
2013-05-17 12:08:57 +00:00
|
|
|
gint which;
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
|
|
|
if (window->always_sticky)
|
|
|
|
return;
|
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
which = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1;
|
|
|
|
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, which);
|
2013-05-17 12:08:57 +00:00
|
|
|
meta_window_change_workspace (window, workspace);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_move_to_workspace (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
|
2008-10-06 00:24:07 +00:00
|
|
|
gint which = binding->handler->data;
|
|
|
|
gboolean flip = (which < 0);
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWorkspace *workspace;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2008-09-06 22:01:56 +00:00
|
|
|
/* If which is zero or positive, it's a workspace number, and the window
|
|
|
|
* should move to the workspace with that number.
|
|
|
|
*
|
|
|
|
* However, if it's negative, it's a direction with respect to the current
|
|
|
|
* position; it's expressed as a member of the MetaMotionDirection enum,
|
|
|
|
* all of whose members are negative. Such a change is called a flip.
|
|
|
|
*/
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
if (window->always_sticky)
|
2002-05-26 15:54:38 +00:00
|
|
|
return;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
workspace = NULL;
|
2008-09-06 22:01:56 +00:00
|
|
|
if (flip)
|
2012-12-13 01:50:43 +00:00
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
workspace = meta_workspace_get_neighbor (workspace_manager->active_workspace,
|
2002-04-28 04:52:26 +00:00
|
|
|
which);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, which);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
if (workspace)
|
|
|
|
{
|
2002-05-25 02:33:55 +00:00
|
|
|
/* Activate second, so the window is never unmapped */
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_window_change_workspace (window, workspace);
|
2003-05-17 00:00:55 +00:00
|
|
|
if (flip)
|
2005-02-22 02:11:25 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Resetting mouse_mode to FALSE due to "
|
2020-10-02 15:47:22 +00:00
|
|
|
"handle_move_to_workspace() call with flip set.");
|
2017-08-26 19:39:46 +00:00
|
|
|
meta_display_clear_mouse_mode (workspace->display);
|
2005-02-22 02:11:25 +00:00
|
|
|
meta_workspace_activate_with_focus (workspace,
|
|
|
|
window,
|
2012-11-15 21:35:42 +00:00
|
|
|
event->time);
|
2005-02-22 02:11:25 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We could offer to create it I suppose */
|
2012-12-13 01:50:43 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2013-12-11 16:57:45 +00:00
|
|
|
static void
|
|
|
|
handle_move_to_monitor (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2016-12-01 07:15:52 +00:00
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2013-12-11 16:57:45 +00:00
|
|
|
gint which = binding->handler->data;
|
2016-12-01 07:15:52 +00:00
|
|
|
MetaLogicalMonitor *current, *new;
|
2013-12-11 16:57:45 +00:00
|
|
|
|
2015-04-09 04:20:24 +00:00
|
|
|
current = window->monitor;
|
2016-12-01 07:15:52 +00:00
|
|
|
new = meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
current, which);
|
2013-12-11 16:57:45 +00:00
|
|
|
|
|
|
|
if (new == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
meta_window_move_to_monitor (window, new->number);
|
|
|
|
}
|
|
|
|
|
2012-12-13 01:50:43 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_raise_or_lower (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-05-29 03:11:24 +00:00
|
|
|
{
|
|
|
|
/* Get window at pointer */
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
MetaWindow *above = NULL;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
/* Check if top */
|
2017-08-26 17:03:51 +00:00
|
|
|
if (meta_stack_get_top (window->display->stack) == window)
|
2008-11-22 19:02:54 +00:00
|
|
|
{
|
|
|
|
meta_window_lower (window);
|
|
|
|
return;
|
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
/* else check if windows in same layer are intersecting it */
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2017-08-26 17:03:51 +00:00
|
|
|
above = meta_stack_get_above (window->display->stack, window, TRUE);
|
2002-05-29 03:11:24 +00:00
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
while (above)
|
|
|
|
{
|
|
|
|
MetaRectangle tmp, win_rect, above_rect;
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2017-02-06 16:17:02 +00:00
|
|
|
if (above->mapped && meta_window_should_be_showing (above))
|
2008-11-22 19:02:54 +00:00
|
|
|
{
|
2013-11-19 17:24:45 +00:00
|
|
|
meta_window_get_frame_rect (window, &win_rect);
|
|
|
|
meta_window_get_frame_rect (above, &above_rect);
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
/* Check if obscured */
|
|
|
|
if (meta_rectangle_intersect (&win_rect, &above_rect, &tmp))
|
2002-10-20 15:22:40 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
meta_window_raise (window);
|
|
|
|
return;
|
2002-10-20 15:22:40 +00:00
|
|
|
}
|
2008-11-22 19:02:54 +00:00
|
|
|
}
|
2012-12-13 01:50:43 +00:00
|
|
|
|
2017-08-26 17:03:51 +00:00
|
|
|
above = meta_stack_get_above (window->display->stack, above, TRUE);
|
2002-05-29 03:11:24 +00:00
|
|
|
}
|
2008-11-22 19:02:54 +00:00
|
|
|
|
|
|
|
/* window is not obscured */
|
|
|
|
meta_window_lower (window);
|
2002-05-29 03:11:24 +00:00
|
|
|
}
|
|
|
|
|
2002-08-15 05:14:49 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_raise (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-15 05:14:49 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
meta_window_raise (window);
|
2002-08-15 05:14:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_lower (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-15 05:14:49 +00:00
|
|
|
{
|
2008-11-22 19:02:54 +00:00
|
|
|
meta_window_lower (window);
|
2002-08-15 05:14:49 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_set_spew_mark (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-01-11 03:31:14 +00:00
|
|
|
{
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose ("-- MARK MARK MARK MARK --");
|
2002-01-11 03:31:14 +00:00
|
|
|
}
|
|
|
|
|
2014-05-29 16:11:26 +00:00
|
|
|
#ifdef HAVE_NATIVE_BACKEND
|
2013-07-16 12:37:49 +00:00
|
|
|
static void
|
2013-10-03 22:03:53 +00:00
|
|
|
handle_switch_vt (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2013-07-16 12:37:49 +00:00
|
|
|
{
|
2022-05-27 17:55:16 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2014-02-02 00:22:56 +00:00
|
|
|
gint vt = binding->handler->data;
|
2014-02-02 00:34:24 +00:00
|
|
|
GError *error = NULL;
|
2014-01-16 18:40:41 +00:00
|
|
|
|
2022-05-27 17:55:16 +00:00
|
|
|
if (!meta_backend_native_activate_vt (META_BACKEND_NATIVE (backend),
|
|
|
|
vt, &error))
|
2014-02-02 00:22:56 +00:00
|
|
|
{
|
2014-02-02 00:34:24 +00:00
|
|
|
g_warning ("Failed to switch VT: %s", error->message);
|
|
|
|
g_error_free (error);
|
2014-02-02 00:22:56 +00:00
|
|
|
}
|
2013-07-16 12:37:49 +00:00
|
|
|
}
|
2014-05-29 16:11:26 +00:00
|
|
|
#endif /* HAVE_NATIVE_BACKEND */
|
2013-07-16 12:37:49 +00:00
|
|
|
|
2017-06-07 17:07:26 +00:00
|
|
|
static void
|
|
|
|
handle_switch_monitor (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2017-06-07 17:07:26 +00:00
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaMonitorSwitchConfigType config_type =
|
|
|
|
meta_monitor_manager_get_switch_config (monitor_manager);
|
|
|
|
|
|
|
|
if (!meta_monitor_manager_can_switch_config (monitor_manager))
|
|
|
|
return;
|
|
|
|
|
|
|
|
config_type = (config_type + 1) % (META_MONITOR_SWITCH_CONFIG_UNKNOWN);
|
|
|
|
meta_monitor_manager_switch_config (monitor_manager, config_type);
|
|
|
|
}
|
|
|
|
|
2017-05-05 15:51:06 +00:00
|
|
|
static void
|
|
|
|
handle_rotate_monitor (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2017-05-05 15:51:06 +00:00
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
|
|
|
|
meta_monitor_manager_rotate_monitor (monitor_manager);
|
|
|
|
}
|
|
|
|
|
2017-03-17 12:34:52 +00:00
|
|
|
static void
|
|
|
|
handle_restore_shortcuts (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
ClutterKeyEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
|
|
|
ClutterInputDevice *source;
|
|
|
|
|
2019-02-18 09:21:57 +00:00
|
|
|
if (!display->focus_window)
|
|
|
|
return;
|
|
|
|
|
2017-03-17 12:34:52 +00:00
|
|
|
source = clutter_event_get_source_device ((ClutterEvent *) event);
|
|
|
|
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS, "Restoring normal keyboard shortcuts");
|
2017-03-17 12:34:52 +00:00
|
|
|
|
|
|
|
meta_window_force_restore_shortcuts (display->focus_window, source);
|
|
|
|
}
|
|
|
|
|
2012-09-01 20:09:39 +00:00
|
|
|
/**
|
|
|
|
* meta_keybindings_set_custom_handler:
|
|
|
|
* @name: The name of the keybinding to set
|
2014-05-28 19:44:23 +00:00
|
|
|
* @handler: (nullable): The new handler function
|
2012-09-01 20:09:39 +00:00
|
|
|
* @user_data: User data to pass to the callback
|
|
|
|
* @free_data: Will be called when this handler is overridden.
|
|
|
|
*
|
|
|
|
* Allows users to register a custom handler for a
|
|
|
|
* builtin key binding.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the binding known as @name was found,
|
|
|
|
* %FALSE otherwise.
|
|
|
|
*/
|
2009-01-29 15:07:57 +00:00
|
|
|
gboolean
|
|
|
|
meta_keybindings_set_custom_handler (const gchar *name,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
gpointer user_data,
|
2009-03-25 14:50:40 +00:00
|
|
|
GDestroyNotify free_data)
|
2009-01-29 15:07:57 +00:00
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyHandler *key_handler = HANDLER (name);
|
2009-01-29 15:07:57 +00:00
|
|
|
|
|
|
|
if (!key_handler)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (key_handler->user_data_free_func && key_handler->user_data)
|
2009-01-29 15:29:43 +00:00
|
|
|
key_handler->user_data_free_func (key_handler->user_data);
|
2009-01-29 15:07:57 +00:00
|
|
|
|
|
|
|
key_handler->func = handler;
|
|
|
|
key_handler->user_data = user_data;
|
|
|
|
key_handler->user_data_free_func = free_data;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
static void
|
|
|
|
init_builtin_key_bindings (MetaDisplay *display)
|
|
|
|
{
|
2012-03-27 14:42:42 +00:00
|
|
|
GSettings *common_keybindings = g_settings_new (SCHEMA_COMMON_KEYBINDINGS);
|
|
|
|
GSettings *mutter_keybindings = g_settings_new (SCHEMA_MUTTER_KEYBINDINGS);
|
2013-07-16 12:37:49 +00:00
|
|
|
GSettings *mutter_wayland_keybindings = g_settings_new (SCHEMA_MUTTER_WAYLAND_KEYBINDINGS);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-1",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_1,
|
|
|
|
handle_switch_to_workspace, 0);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-2",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_2,
|
|
|
|
handle_switch_to_workspace, 1);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-3",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_3,
|
|
|
|
handle_switch_to_workspace, 2);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-4",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_4,
|
|
|
|
handle_switch_to_workspace, 3);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-5",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_5,
|
|
|
|
handle_switch_to_workspace, 4);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-6",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_6,
|
|
|
|
handle_switch_to_workspace, 5);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-7",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_7,
|
|
|
|
handle_switch_to_workspace, 6);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-8",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_8,
|
|
|
|
handle_switch_to_workspace, 7);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-9",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_9,
|
|
|
|
handle_switch_to_workspace, 8);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-10",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_10,
|
|
|
|
handle_switch_to_workspace, 9);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-11",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_11,
|
|
|
|
handle_switch_to_workspace, 10);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-12",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_NONE |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_12,
|
|
|
|
handle_switch_to_workspace, 11);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-left",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_LEFT,
|
2014-04-17 14:54:37 +00:00
|
|
|
handle_switch_to_workspace, META_MOTION_LEFT);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-right",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_RIGHT,
|
2014-04-17 14:54:37 +00:00
|
|
|
handle_switch_to_workspace, META_MOTION_RIGHT);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-up",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_UP,
|
2014-04-17 14:54:37 +00:00
|
|
|
handle_switch_to_workspace, META_MOTION_UP);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-down",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
|
2014-04-17 14:54:37 +00:00
|
|
|
handle_switch_to_workspace, META_MOTION_DOWN);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2013-05-17 12:08:57 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-last",
|
|
|
|
common_keybindings,
|
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_LAST,
|
|
|
|
handle_switch_to_last_workspace, 0);
|
|
|
|
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
/* The ones which have inverses. These can't be bound to any keystroke
|
|
|
|
* containing Shift because Shift will invert their "backward" state.
|
|
|
|
*
|
|
|
|
* TODO: "NORMAL" and "DOCKS" should be renamed to the same name as their
|
|
|
|
* action, for obviousness.
|
|
|
|
*
|
|
|
|
* TODO: handle_switch and handle_cycle should probably really be the
|
|
|
|
* same function checking a bit in the parameter for difference.
|
|
|
|
*/
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-group",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_GROUP,
|
|
|
|
handle_switch, META_TAB_LIST_GROUP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-group-backward",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_IS_REVERSED,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD,
|
|
|
|
handle_switch, META_TAB_LIST_GROUP);
|
|
|
|
|
2012-11-23 02:48:14 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-applications",
|
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
2012-11-23 02:48:14 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS,
|
|
|
|
handle_switch, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-applications-backward",
|
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_IS_REVERSED,
|
2012-11-23 02:48:14 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS_BACKWARD,
|
|
|
|
handle_switch, META_TAB_LIST_NORMAL);
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-windows",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_WINDOWS,
|
|
|
|
handle_switch, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-windows-backward",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_IS_REVERSED,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD,
|
|
|
|
handle_switch, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-panels",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_PANELS,
|
|
|
|
handle_switch, META_TAB_LIST_DOCKS);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-panels-backward",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_IS_REVERSED,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD,
|
|
|
|
handle_switch, META_TAB_LIST_DOCKS);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-group",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_CYCLE_GROUP,
|
|
|
|
handle_cycle, META_TAB_LIST_GROUP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-group-backward",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_IS_REVERSED,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD,
|
|
|
|
handle_cycle, META_TAB_LIST_GROUP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-windows",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_CYCLE_WINDOWS,
|
|
|
|
handle_cycle, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-windows-backward",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_IS_REVERSED,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD,
|
|
|
|
handle_cycle, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-panels",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_CYCLE_PANELS,
|
|
|
|
handle_cycle, META_TAB_LIST_DOCKS);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-panels-backward",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2014-06-27 14:07:44 +00:00
|
|
|
META_KEY_BINDING_IS_REVERSED,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD,
|
|
|
|
handle_cycle, META_TAB_LIST_DOCKS);
|
|
|
|
|
2012-12-13 01:50:43 +00:00
|
|
|
/***********************************/
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"show-desktop",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_SHOW_DESKTOP,
|
|
|
|
handle_show_desktop, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"panel-run-dialog",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_PANEL_RUN_DIALOG,
|
2021-08-18 15:47:26 +00:00
|
|
|
NULL, META_KEYBINDING_ACTION_PANEL_RUN_DIALOG);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"set-spew-mark",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_SET_SPEW_MARK,
|
|
|
|
handle_set_spew_mark, 0);
|
|
|
|
|
2017-06-07 17:07:26 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-monitor",
|
|
|
|
mutter_keybindings,
|
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_SWITCH_MONITOR,
|
|
|
|
handle_switch_monitor, 0);
|
|
|
|
|
2017-05-05 15:51:06 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"rotate-monitor",
|
|
|
|
mutter_keybindings,
|
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_ROTATE_MONITOR,
|
|
|
|
handle_rotate_monitor, 0);
|
|
|
|
|
2014-05-29 16:11:26 +00:00
|
|
|
#ifdef HAVE_NATIVE_BACKEND
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2014-05-29 16:09:10 +00:00
|
|
|
if (META_IS_BACKEND_NATIVE (backend))
|
2013-07-16 12:37:49 +00:00
|
|
|
{
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-1",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2013-07-16 12:37:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 1);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-2",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2013-07-16 12:37:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 2);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-3",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2013-07-16 12:37:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 3);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-4",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2013-07-16 12:37:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 4);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-5",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2013-07-16 12:37:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 5);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-6",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2013-07-16 12:37:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 6);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-7",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2013-07-16 12:37:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 7);
|
2015-02-19 21:07:49 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-8",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2015-02-19 21:07:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 8);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-9",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2015-02-19 21:07:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 9);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-10",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2015-02-19 21:07:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 10);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-11",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2015-02-19 21:07:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 11);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-session-12",
|
|
|
|
mutter_wayland_keybindings,
|
2017-03-17 12:34:52 +00:00
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
2015-02-19 21:07:49 +00:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_switch_vt, 12);
|
2013-07-16 12:37:49 +00:00
|
|
|
}
|
2014-05-29 16:11:26 +00:00
|
|
|
#endif /* HAVE_NATIVE_BACKEND */
|
2013-07-16 12:37:49 +00:00
|
|
|
|
2017-03-17 12:34:52 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"restore-shortcuts",
|
|
|
|
mutter_wayland_keybindings,
|
|
|
|
META_KEY_BINDING_NON_MASKABLE,
|
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handle_restore_shortcuts, 0);
|
|
|
|
|
2012-12-13 01:50:43 +00:00
|
|
|
/************************ PER WINDOW BINDINGS ************************/
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2012-12-13 01:50:43 +00:00
|
|
|
/* These take a window as an extra parameter; they have no effect
|
|
|
|
* if no window is active.
|
|
|
|
*/
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"activate-window-menu",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_ACTIVATE_WINDOW_MENU,
|
|
|
|
handle_activate_window_menu, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-fullscreen",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_TOGGLE_FULLSCREEN,
|
|
|
|
handle_toggle_fullscreen, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-maximized",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
|
|
|
|
handle_toggle_maximized, 0);
|
|
|
|
|
2011-11-15 16:29:56 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-tiled-left",
|
2012-03-27 14:42:42 +00:00
|
|
|
mutter_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-11-15 16:29:56 +00:00
|
|
|
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
|
2016-01-10 14:16:09 +00:00
|
|
|
handle_toggle_tiled, META_TILE_LEFT);
|
2011-11-15 16:29:56 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-tiled-right",
|
2012-03-27 14:42:42 +00:00
|
|
|
mutter_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-11-15 16:29:56 +00:00
|
|
|
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
|
2016-01-10 14:16:09 +00:00
|
|
|
handle_toggle_tiled, META_TILE_RIGHT);
|
2011-11-15 16:29:56 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-above",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_TOGGLE_ABOVE,
|
|
|
|
handle_toggle_above, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"maximize",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MAXIMIZE,
|
|
|
|
handle_maximize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"unmaximize",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_UNMAXIMIZE,
|
|
|
|
handle_unmaximize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-shaded",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_TOGGLE_SHADED,
|
|
|
|
handle_toggle_shaded, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"minimize",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MINIMIZE,
|
|
|
|
handle_minimize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"close",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_CLOSE,
|
|
|
|
handle_close, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"begin-move",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_BEGIN_MOVE,
|
|
|
|
handle_begin_move, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"begin-resize",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_BEGIN_RESIZE,
|
|
|
|
handle_begin_resize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-on-all-workspaces",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_TOGGLE_ON_ALL_WORKSPACES,
|
|
|
|
handle_toggle_on_all_workspaces, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-1",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_1,
|
|
|
|
handle_move_to_workspace, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-2",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_2,
|
|
|
|
handle_move_to_workspace, 1);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-3",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_3,
|
|
|
|
handle_move_to_workspace, 2);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-4",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_4,
|
|
|
|
handle_move_to_workspace, 3);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-5",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_5,
|
|
|
|
handle_move_to_workspace, 4);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-6",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_6,
|
|
|
|
handle_move_to_workspace, 5);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-7",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_7,
|
|
|
|
handle_move_to_workspace, 6);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-8",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_8,
|
|
|
|
handle_move_to_workspace, 7);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-9",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_9,
|
|
|
|
handle_move_to_workspace, 8);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-10",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_10,
|
|
|
|
handle_move_to_workspace, 9);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-11",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_11,
|
|
|
|
handle_move_to_workspace, 10);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-12",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_12,
|
|
|
|
handle_move_to_workspace, 11);
|
|
|
|
|
2013-05-17 12:08:57 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-last",
|
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2013-05-17 12:08:57 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_LAST,
|
|
|
|
handle_move_to_workspace_last, 0);
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-left",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_LEFT,
|
|
|
|
handle_move_to_workspace, META_MOTION_LEFT);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-right",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_RIGHT,
|
|
|
|
handle_move_to_workspace, META_MOTION_RIGHT);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-up",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP,
|
|
|
|
handle_move_to_workspace, META_MOTION_UP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-down",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
|
|
|
handle_move_to_workspace, META_MOTION_DOWN);
|
|
|
|
|
2013-12-11 16:57:45 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-monitor-left",
|
|
|
|
common_keybindings,
|
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_LEFT,
|
2017-08-26 19:22:34 +00:00
|
|
|
handle_move_to_monitor, META_DISPLAY_LEFT);
|
2013-12-11 16:57:45 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-monitor-right",
|
|
|
|
common_keybindings,
|
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT,
|
2017-08-26 19:22:34 +00:00
|
|
|
handle_move_to_monitor, META_DISPLAY_RIGHT);
|
2013-12-11 16:57:45 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-monitor-down",
|
|
|
|
common_keybindings,
|
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_DOWN,
|
2017-08-26 19:22:34 +00:00
|
|
|
handle_move_to_monitor, META_DISPLAY_DOWN);
|
2013-12-11 16:57:45 +00:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-monitor-up",
|
|
|
|
common_keybindings,
|
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP,
|
2017-08-26 19:22:34 +00:00
|
|
|
handle_move_to_monitor, META_DISPLAY_UP);
|
2013-12-11 16:57:45 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"raise-or-lower",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_RAISE_OR_LOWER,
|
|
|
|
handle_raise_or_lower, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"raise",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_RAISE,
|
|
|
|
handle_raise, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"lower",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_LOWER,
|
|
|
|
handle_lower, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"maximize-vertically",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MAXIMIZE_VERTICALLY,
|
|
|
|
handle_maximize_vertically, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"maximize-horizontally",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MAXIMIZE_HORIZONTALLY,
|
|
|
|
handle_maximize_horizontally, 0);
|
|
|
|
|
2013-07-24 18:55:23 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"always-on-top",
|
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2013-07-24 18:55:23 +00:00
|
|
|
META_KEYBINDING_ACTION_ALWAYS_ON_TOP,
|
|
|
|
handle_always_on_top, 0);
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-nw",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_NW,
|
|
|
|
handle_move_to_corner_nw, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-ne",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_NE,
|
|
|
|
handle_move_to_corner_ne, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-sw",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_SW,
|
|
|
|
handle_move_to_corner_sw, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-se",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_SE,
|
|
|
|
handle_move_to_corner_se, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-n",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_N,
|
|
|
|
handle_move_to_side_n, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-s",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_S,
|
|
|
|
handle_move_to_side_s, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-e",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_E,
|
|
|
|
handle_move_to_side_e, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-w",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_W,
|
|
|
|
handle_move_to_side_w, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-center",
|
2012-03-27 14:42:42 +00:00
|
|
|
common_keybindings,
|
2018-06-25 15:26:09 +00:00
|
|
|
META_KEY_BINDING_PER_WINDOW |
|
|
|
|
META_KEY_BINDING_IGNORE_AUTOREPEAT,
|
2011-10-28 01:05:43 +00:00
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CENTER,
|
|
|
|
handle_move_to_center, 0);
|
2012-03-27 14:42:42 +00:00
|
|
|
|
|
|
|
g_object_unref (common_keybindings);
|
|
|
|
g_object_unref (mutter_keybindings);
|
2014-02-25 16:09:06 +00:00
|
|
|
g_object_unref (mutter_wayland_keybindings);
|
2011-10-28 01:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_init_keys (MetaDisplay *display)
|
|
|
|
{
|
2014-08-14 19:33:45 +00:00
|
|
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2012-08-29 21:07:34 +00:00
|
|
|
MetaKeyHandler *handler;
|
|
|
|
|
2017-09-01 09:45:08 +00:00
|
|
|
keys->backend = backend;
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
/* Keybindings */
|
2014-08-14 19:33:45 +00:00
|
|
|
keys->ignored_modifier_mask = 0;
|
|
|
|
keys->hyper_mask = 0;
|
|
|
|
keys->super_mask = 0;
|
|
|
|
keys->meta_mask = 0;
|
|
|
|
|
2015-01-09 02:42:37 +00:00
|
|
|
keys->key_bindings = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) meta_key_binding_free);
|
2014-08-14 19:33:45 +00:00
|
|
|
keys->key_bindings_index = g_hash_table_new (NULL, NULL);
|
|
|
|
|
|
|
|
reload_modmap (keys);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
key_handlers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
|
(GDestroyNotify) key_handler_free);
|
2012-08-29 21:07:34 +00:00
|
|
|
|
|
|
|
handler = g_new0 (MetaKeyHandler, 1);
|
|
|
|
handler->name = g_strdup ("overlay-key");
|
2019-07-17 12:34:24 +00:00
|
|
|
handler->flags = META_KEY_BINDING_BUILTIN | META_KEY_BINDING_NO_AUTO_GRAB;
|
2012-08-29 21:07:34 +00:00
|
|
|
|
2019-05-16 08:58:27 +00:00
|
|
|
g_hash_table_insert (key_handlers, g_strdup (handler->name), handler);
|
2012-08-29 21:07:34 +00:00
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
handler = g_new0 (MetaKeyHandler, 1);
|
|
|
|
handler->name = g_strdup ("locate-pointer-key");
|
2019-07-15 15:29:53 +00:00
|
|
|
handler->flags = META_KEY_BINDING_BUILTIN | META_KEY_BINDING_NO_AUTO_GRAB;
|
2019-02-20 10:53:54 +00:00
|
|
|
|
2019-05-16 08:58:27 +00:00
|
|
|
g_hash_table_insert (key_handlers, g_strdup (handler->name), handler);
|
2019-02-20 10:53:54 +00:00
|
|
|
|
2013-04-10 11:34:26 +00:00
|
|
|
handler = g_new0 (MetaKeyHandler, 1);
|
|
|
|
handler->name = g_strdup ("iso-next-group");
|
|
|
|
handler->flags = META_KEY_BINDING_BUILTIN;
|
|
|
|
|
2019-05-16 08:58:27 +00:00
|
|
|
g_hash_table_insert (key_handlers, g_strdup (handler->name), handler);
|
2013-04-10 11:34:26 +00:00
|
|
|
|
2012-08-28 13:28:11 +00:00
|
|
|
handler = g_new0 (MetaKeyHandler, 1);
|
|
|
|
handler->name = g_strdup ("external-grab");
|
|
|
|
handler->func = handle_external_grab;
|
|
|
|
handler->default_func = handle_external_grab;
|
|
|
|
|
2019-05-16 08:58:27 +00:00
|
|
|
g_hash_table_insert (key_handlers, g_strdup (handler->name), handler);
|
2012-08-28 13:28:11 +00:00
|
|
|
|
|
|
|
external_grabs = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
|
|
NULL,
|
|
|
|
(GDestroyNotify)meta_key_grab_free);
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
init_builtin_key_bindings (display);
|
|
|
|
|
2014-08-14 19:33:45 +00:00
|
|
|
rebuild_key_binding_table (keys);
|
|
|
|
rebuild_special_bindings (keys);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2015-01-07 02:29:00 +00:00
|
|
|
reload_combos (keys);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2021-01-29 19:56:46 +00:00
|
|
|
update_window_grab_modifiers (display);
|
2014-08-14 19:04:00 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
/* Keys are actually grabbed in meta_screen_grab_keys() */
|
|
|
|
|
2014-08-14 19:04:00 +00:00
|
|
|
meta_prefs_add_listener (prefs_changed_callback, display);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2017-08-17 09:04:13 +00:00
|
|
|
g_signal_connect_swapped (backend, "keymap-changed",
|
|
|
|
G_CALLBACK (reload_keybindings), display);
|
|
|
|
g_signal_connect_swapped (backend, "keymap-layout-group-changed",
|
|
|
|
G_CALLBACK (reload_keybindings), display);
|
2011-10-28 01:05:43 +00:00
|
|
|
}
|