2006-10-01 18:30:10 -04: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 06:29:20 -04:00
|
|
|
/* Mutter Keybindings */
|
2001-06-06 00:47:37 -04:00
|
|
|
/*
|
2004-02-22 20:48:29 -05:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
|
|
|
* Copyright (C) 2002 Red Hat Inc.
|
|
|
|
* Copyright (C) 2003 Rob Adams
|
2006-01-10 14:43:21 -05:00
|
|
|
* Copyright (C) 2004-2006 Elijah Newren
|
2001-06-06 00:47:37 -04: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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-26 23:39:10 -05:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#define _SVID_SOURCE /* for putenv() */
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
#include <config.h>
|
2009-01-29 09:16:01 -05:00
|
|
|
#include "keybindings-private.h"
|
2008-09-18 11:09:11 -04:00
|
|
|
#include "workspace-private.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/errors.h>
|
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 09:58:50 -05:00
|
|
|
#include "edge-resistance.h"
|
2001-06-23 01:49:35 -04:00
|
|
|
#include "ui.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include "frame.h"
|
2001-07-12 01:53:56 -04:00
|
|
|
#include "place.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/prefs.h>
|
|
|
|
#include <meta/util.h>
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
#include <X11/keysym.h>
|
2002-04-28 00:52:26 -04:00
|
|
|
#include <string.h>
|
2003-09-29 12:55:26 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2004-10-20 19:16:08 -04:00
|
|
|
#ifdef HAVE_XKB
|
|
|
|
#include <X11/XKBlib.h>
|
|
|
|
#endif
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
#define SCHEMA_COMMON_KEYBINDINGS "org.gnome.desktop.wm.keybindings"
|
|
|
|
#define SCHEMA_MUTTER_KEYBINDINGS "org.gnome.mutter.keybindings"
|
|
|
|
|
2002-02-08 01:01:58 -05:00
|
|
|
static gboolean all_bindings_disabled = FALSE;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
static gboolean add_builtin_keybinding (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 10:42:42 -04:00
|
|
|
GSettings *settings,
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
int handler_arg);
|
2008-10-05 20:24:07 -04:00
|
|
|
|
2011-11-04 14:18:57 -04:00
|
|
|
static void
|
|
|
|
meta_key_binding_free (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
g_slice_free (MetaKeyBinding, binding);
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaKeyBinding *
|
|
|
|
meta_key_binding_copy (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return g_slice_dup (MetaKeyBinding, binding);
|
|
|
|
}
|
|
|
|
|
2012-04-10 01:25:13 -04:00
|
|
|
G_DEFINE_BOXED_TYPE(MetaKeyBinding,
|
|
|
|
meta_key_binding,
|
|
|
|
meta_key_binding_copy,
|
|
|
|
meta_key_binding_free)
|
2011-11-04 14:18:57 -04:00
|
|
|
|
|
|
|
const char *
|
|
|
|
meta_key_binding_get_name (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return binding->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaVirtualModifier
|
|
|
|
meta_key_binding_get_modifiers (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return binding->modifiers;
|
|
|
|
}
|
|
|
|
|
|
|
|
guint
|
|
|
|
meta_key_binding_get_mask (MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
return binding->mask;
|
|
|
|
}
|
|
|
|
|
2008-10-05 20:24:07 -04: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void handle_workspace_switch (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy);
|
2008-10-05 20:24:07 -04:00
|
|
|
|
2006-08-21 14:38:21 -04:00
|
|
|
static gboolean process_mouse_move_resize_grab (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
static gboolean process_keyboard_move_grab (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2001-08-19 14:09:10 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
|
|
|
|
2002-06-19 00:12:49 -04:00
|
|
|
static gboolean process_keyboard_resize_grab (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-06-19 00:12:49 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
static gboolean process_tab_grab (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2001-08-19 14:09:10 -04:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2002-06-09 00:04:19 -04:00
|
|
|
static gboolean process_workspace_switch_grab (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-06-09 00:04:19 -04:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
static void regrab_key_bindings (MetaDisplay *display);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
static GHashTable *key_handlers;
|
|
|
|
|
|
|
|
#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 01:49:35 -04:00
|
|
|
|
|
|
|
static void
|
2002-04-28 00:52:26 -04:00
|
|
|
reload_keymap (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->keymap)
|
|
|
|
meta_XFree (display->keymap);
|
|
|
|
|
2010-11-22 18:21:47 -05:00
|
|
|
/* This is expensive to compute, so we'll lazily load if and when we first
|
|
|
|
* need it */
|
|
|
|
display->above_tab_keycode = 0;
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
display->keymap = XGetKeyboardMapping (display->xdisplay,
|
|
|
|
display->min_keycode,
|
|
|
|
display->max_keycode -
|
2004-10-15 18:43:52 -04:00
|
|
|
display->min_keycode + 1,
|
2002-04-28 00:52:26 -04:00
|
|
|
&display->keysyms_per_keycode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_modmap (MetaDisplay *display)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
XModifierKeymap *modmap;
|
|
|
|
int map_size;
|
2001-06-06 00:47:37 -04:00
|
|
|
int i;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
if (display->modmap)
|
|
|
|
XFreeModifiermap (display->modmap);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
modmap = XGetModifierMapping (display->xdisplay);
|
|
|
|
display->modmap = modmap;
|
|
|
|
|
|
|
|
display->ignored_modifier_mask = 0;
|
|
|
|
|
|
|
|
/* Multiple bits may get set in each of these */
|
|
|
|
display->num_lock_mask = 0;
|
|
|
|
display->scroll_lock_mask = 0;
|
2002-07-13 23:16:41 -04:00
|
|
|
display->meta_mask = 0;
|
|
|
|
display->hyper_mask = 0;
|
|
|
|
display->super_mask = 0;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
/* there are 8 modifiers, and the first 3 are shift, shift lock,
|
|
|
|
* and control
|
|
|
|
*/
|
|
|
|
map_size = 8 * modmap->max_keypermod;
|
|
|
|
i = 3 * modmap->max_keypermod;
|
|
|
|
while (i < map_size)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
/* get the key code at this point in the map,
|
|
|
|
* see if its keysym is one we're interested in
|
|
|
|
*/
|
2006-04-13 09:16:42 -04:00
|
|
|
int keycode = modmap->modifiermap[i];
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
if (keycode >= display->min_keycode &&
|
|
|
|
keycode <= display->max_keycode)
|
|
|
|
{
|
|
|
|
int j = 0;
|
|
|
|
KeySym *syms = display->keymap +
|
|
|
|
(keycode - display->min_keycode) * display->keysyms_per_keycode;
|
|
|
|
|
|
|
|
while (j < display->keysyms_per_keycode)
|
|
|
|
{
|
2002-06-15 23:03:08 -04:00
|
|
|
if (syms[j] != 0)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
str = XKeysymToString (syms[j]);
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Keysym %s bound to modifier 0x%x\n",
|
2002-12-19 15:18:54 -05:00
|
|
|
str ? str : "none",
|
2002-06-15 23:03:08 -04:00
|
|
|
(1 << ( i / modmap->max_keypermod)));
|
|
|
|
}
|
|
|
|
|
2002-04-30 23:23:46 -04:00
|
|
|
if (syms[j] == XK_Num_Lock)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
|
|
|
/* Mod1Mask is 1 << 3 for example, i.e. the
|
|
|
|
* fourth modifier, i / keyspermod is the modifier
|
|
|
|
* index
|
|
|
|
*/
|
|
|
|
|
|
|
|
display->num_lock_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
|
}
|
|
|
|
else if (syms[j] == XK_Scroll_Lock)
|
|
|
|
{
|
|
|
|
display->scroll_lock_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
|
}
|
2002-07-13 23:16:41 -04:00
|
|
|
else if (syms[j] == XK_Super_L ||
|
|
|
|
syms[j] == XK_Super_R)
|
|
|
|
{
|
|
|
|
display->super_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
|
}
|
|
|
|
else if (syms[j] == XK_Hyper_L ||
|
|
|
|
syms[j] == XK_Hyper_R)
|
|
|
|
{
|
|
|
|
display->hyper_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
|
}
|
|
|
|
else if (syms[j] == XK_Meta_L ||
|
|
|
|
syms[j] == XK_Meta_R)
|
|
|
|
{
|
|
|
|
display->meta_mask |= (1 << ( i / modmap->max_keypermod));
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
++j;
|
|
|
|
}
|
|
|
|
}
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2002-04-30 23:33:06 -04:00
|
|
|
display->ignored_modifier_mask = (display->num_lock_mask |
|
2002-05-10 22:38:58 -04:00
|
|
|
display->scroll_lock_mask |
|
|
|
|
LockMask);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2002-07-13 23:16:41 -04:00
|
|
|
"Ignoring modmask 0x%x num lock 0x%x scroll lock 0x%x hyper 0x%x super 0x%x meta 0x%x\n",
|
2002-04-28 00:52:26 -04:00
|
|
|
display->ignored_modifier_mask,
|
|
|
|
display->num_lock_mask,
|
2002-07-13 23:16:41 -04:00
|
|
|
display->scroll_lock_mask,
|
|
|
|
display->hyper_mask,
|
|
|
|
display->super_mask,
|
|
|
|
display->meta_mask);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2010-11-22 18:21:47 -05:00
|
|
|
static guint
|
|
|
|
keysym_to_keycode (MetaDisplay *display,
|
|
|
|
guint keysym)
|
|
|
|
{
|
|
|
|
if (keysym == META_KEY_ABOVE_TAB)
|
|
|
|
return meta_display_get_above_tab_keycode (display);
|
|
|
|
else
|
|
|
|
return XKeysymToKeycode (display->xdisplay, keysym);
|
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static void
|
|
|
|
reload_keycodes (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Reloading keycodes for binding tables\n");
|
2010-11-22 16:10:34 -05:00
|
|
|
|
|
|
|
if (display->overlay_key_combo.keysym != 0)
|
2008-12-02 18:13:11 -05:00
|
|
|
{
|
2010-11-22 18:21:47 -05:00
|
|
|
display->overlay_key_combo.keycode =
|
|
|
|
keysym_to_keycode (display, display->overlay_key_combo.keysym);
|
2008-12-02 18:13:11 -05:00
|
|
|
}
|
2012-08-29 15:03:31 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
display->overlay_key_combo.keycode = 0;
|
|
|
|
}
|
2008-12-02 18:13:11 -05:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
if (display->key_bindings)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2008-11-22 14:02:54 -05:00
|
|
|
while (i < display->n_key_bindings)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2010-05-02 11:27:25 -04:00
|
|
|
if (display->key_bindings[i].keysym != 0)
|
|
|
|
{
|
2010-11-22 18:21:47 -05:00
|
|
|
display->key_bindings[i].keycode =
|
|
|
|
keysym_to_keycode (display, display->key_bindings[i].keysym);
|
2010-05-02 11:27:25 -04:00
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-13 23:16:41 -04:00
|
|
|
static void
|
|
|
|
reload_modifiers (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Reloading keycodes for binding tables\n");
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
if (display->key_bindings)
|
2002-07-13 23:16:41 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2008-11-22 14:02:54 -05:00
|
|
|
while (i < display->n_key_bindings)
|
2002-07-13 23:16:41 -04:00
|
|
|
{
|
2002-10-07 19:14:40 -04:00
|
|
|
meta_display_devirtualize_modifiers (display,
|
2008-11-22 14:02:54 -05:00
|
|
|
display->key_bindings[i].modifiers,
|
|
|
|
&display->key_bindings[i].mask);
|
2003-02-22 15:31:51 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
" Devirtualized mods 0x%x -> 0x%x (%s)\n",
|
2008-11-22 14:02:54 -05:00
|
|
|
display->key_bindings[i].modifiers,
|
|
|
|
display->key_bindings[i].mask,
|
|
|
|
display->key_bindings[i].name);
|
2002-07-13 23:16:41 -04:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
2003-02-22 15:31:51 -05:00
|
|
|
static int
|
2011-10-27 21:05:43 -04:00
|
|
|
count_bindings (GList *prefs)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
GList *p;
|
2003-02-22 15:31:51 -05:00
|
|
|
int count;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2003-02-22 15:31:51 -05:00
|
|
|
count = 0;
|
2011-10-27 21:05:43 -04:00
|
|
|
p = prefs;
|
|
|
|
while (p)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyPref *pref = (MetaKeyPref*)p->data;
|
|
|
|
GSList *tmp = pref->bindings;
|
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 13:23:09 -04:00
|
|
|
|
|
|
|
while (tmp)
|
2002-04-28 00:52:26 -04: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 13:23:09 -04:00
|
|
|
MetaKeyCombo *combo = tmp->data;
|
|
|
|
|
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 15:06:26 -04:00
|
|
|
if (combo && (combo->keysym != None || combo->keycode != 0))
|
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 13:23:09 -04:00
|
|
|
{
|
|
|
|
count += 1;
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
if (pref->add_shift &&
|
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 13:23:09 -04:00
|
|
|
(combo->modifiers & META_VIRTUAL_SHIFT_MASK) == 0)
|
|
|
|
count += 1;
|
|
|
|
}
|
2003-02-22 15:31:51 -05: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 13:23:09 -04:00
|
|
|
tmp = tmp->next;
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
p = p->next;
|
2008-11-22 14:02:54 -05:00
|
|
|
}
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
return count;
|
2008-11-22 14:02:54 -05:00
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static void
|
2011-10-27 21:05:43 -04:00
|
|
|
rebuild_binding_table (MetaDisplay *display,
|
|
|
|
MetaKeyBinding **bindings_p,
|
|
|
|
int *n_bindings_p,
|
|
|
|
GList *prefs)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
GList *p;
|
2002-04-28 00:52:26 -04:00
|
|
|
int n_bindings;
|
2011-10-27 21:05:43 -04:00
|
|
|
int i;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
n_bindings = count_bindings (prefs);
|
2003-02-22 15:31:51 -05:00
|
|
|
g_free (*bindings_p);
|
|
|
|
*bindings_p = g_new0 (MetaKeyBinding, n_bindings);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
i = 0;
|
|
|
|
p = prefs;
|
|
|
|
while (p)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyPref *pref = (MetaKeyPref*)p->data;
|
|
|
|
GSList *tmp = pref->bindings;
|
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 13:23:09 -04:00
|
|
|
|
|
|
|
while (tmp)
|
2002-04-28 00:52:26 -04: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 13:23:09 -04:00
|
|
|
MetaKeyCombo *combo = tmp->data;
|
2003-02-22 15:31:51 -05: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 15:06:26 -04:00
|
|
|
if (combo && (combo->keysym != None || combo->keycode != 0))
|
2003-02-22 15:31:51 -05:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyHandler *handler = HANDLER (pref->name);
|
|
|
|
|
|
|
|
(*bindings_p)[i].name = pref->name;
|
|
|
|
(*bindings_p)[i].handler = handler;
|
|
|
|
(*bindings_p)[i].keysym = combo->keysym;
|
|
|
|
(*bindings_p)[i].keycode = combo->keycode;
|
|
|
|
(*bindings_p)[i].modifiers = combo->modifiers;
|
|
|
|
(*bindings_p)[i].mask = 0;
|
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 13:23:09 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
++i;
|
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 13:23:09 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
if (pref->add_shift &&
|
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 13:23:09 -04:00
|
|
|
(combo->modifiers & META_VIRTUAL_SHIFT_MASK) == 0)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Binding %s also needs Shift grabbed\n",
|
2011-10-27 21:05:43 -04:00
|
|
|
pref->name);
|
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 13:23:09 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
(*bindings_p)[i].name = pref->name;
|
|
|
|
(*bindings_p)[i].handler = handler;
|
|
|
|
(*bindings_p)[i].keysym = combo->keysym;
|
|
|
|
(*bindings_p)[i].keycode = combo->keycode;
|
|
|
|
(*bindings_p)[i].modifiers = combo->modifiers |
|
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 13:23:09 -04:00
|
|
|
META_VIRTUAL_SHIFT_MASK;
|
2011-10-27 21:05:43 -04:00
|
|
|
(*bindings_p)[i].mask = 0;
|
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 13:23:09 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
++i;
|
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 13:23:09 -04:00
|
|
|
}
|
2003-02-22 15:31:51 -05: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 13:23:09 -04:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
p = p->next;
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
g_assert (i == n_bindings);
|
2003-02-22 15:31:51 -05:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
*n_bindings_p = i;
|
2003-02-22 15:31:51 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
" %d bindings in table\n",
|
|
|
|
*n_bindings_p);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-11-22 14:02:54 -05:00
|
|
|
rebuild_key_binding_table (MetaDisplay *display)
|
2003-02-22 15:31:51 -05:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
GList *prefs;
|
|
|
|
|
2003-02-22 15:31:51 -05:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2008-11-22 14:02:54 -05:00
|
|
|
"Rebuilding key binding table from preferences\n");
|
2011-10-27 21:05:43 -04:00
|
|
|
|
|
|
|
prefs = meta_prefs_get_keybindings ();
|
2003-02-22 15:31:51 -05:00
|
|
|
rebuild_binding_table (display,
|
2008-11-22 14:02:54 -05:00
|
|
|
&display->key_bindings,
|
|
|
|
&display->n_key_bindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
prefs);
|
|
|
|
g_list_free (prefs);
|
2003-02-22 15:31:51 -05:00
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2008-12-02 18:13:11 -05:00
|
|
|
static void
|
|
|
|
rebuild_special_bindings (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
MetaKeyCombo combo;
|
|
|
|
|
|
|
|
meta_prefs_get_overlay_binding (&combo);
|
2012-08-29 15:03:31 -04:00
|
|
|
display->overlay_key_combo = combo;
|
2008-12-02 18:13:11 -05:00
|
|
|
}
|
|
|
|
|
2003-02-22 15:31:51 -05:00
|
|
|
static void
|
2008-11-22 14:02:54 -05:00
|
|
|
regrab_key_bindings (MetaDisplay *display)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
|
|
|
GSList *tmp;
|
2008-11-22 14:02:54 -05:00
|
|
|
GSList *windows;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2002-11-06 11:00:56 -05:00
|
|
|
meta_error_trap_push (display); /* for efficiency push outer trap */
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
tmp = display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = tmp->data;
|
|
|
|
|
|
|
|
meta_screen_ungrab_keys (screen);
|
|
|
|
meta_screen_grab_keys (screen);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2002-11-06 11:00:56 -05:00
|
|
|
|
2009-06-15 15:32:23 -04:00
|
|
|
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
2002-04-28 00:52:26 -04:00
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
|
|
|
meta_window_ungrab_keys (w);
|
|
|
|
meta_window_grab_keys (w);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
static MetaKeyBinding *
|
|
|
|
display_get_keybinding (MetaDisplay *display,
|
|
|
|
unsigned int keysym,
|
|
|
|
unsigned int keycode,
|
|
|
|
unsigned long mask)
|
2002-07-13 23:16:41 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
i = display->n_key_bindings - 1;
|
2002-07-13 23:16:41 -04:00
|
|
|
while (i >= 0)
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (display->key_bindings[i].keysym == keysym &&
|
|
|
|
display->key_bindings[i].keycode == keycode &&
|
|
|
|
display->key_bindings[i].mask == mask)
|
2002-07-13 23:16:41 -04:00
|
|
|
{
|
2009-08-25 16:54:54 -04:00
|
|
|
return &display->key_bindings[i];
|
2002-07-13 23:16:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
--i;
|
|
|
|
}
|
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
static gboolean
|
2011-11-04 14:18:57 -04:00
|
|
|
add_keybinding_internal (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 10:42:42 -04:00
|
|
|
GSettings *settings,
|
2011-11-04 14:18:57 -04:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyHandlerFunc func,
|
|
|
|
int data,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify free_data)
|
2011-10-27 21:05:43 -04:00
|
|
|
{
|
|
|
|
MetaKeyHandler *handler;
|
|
|
|
|
2012-03-27 10:42:42 -04:00
|
|
|
if (!meta_prefs_add_keybinding (name, settings, action, flags))
|
2011-10-27 21:05:43 -04: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 14:18:57 -04:00
|
|
|
handler->user_data = user_data;
|
|
|
|
handler->user_data_free_func = free_data;
|
2011-10-27 21:05:43 -04:00
|
|
|
|
|
|
|
g_hash_table_insert (key_handlers, g_strdup (name), handler);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-11-04 14:18:57 -04:00
|
|
|
static gboolean
|
|
|
|
add_builtin_keybinding (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 10:42:42 -04:00
|
|
|
GSettings *settings,
|
2011-11-04 14:18:57 -04:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
int handler_arg)
|
|
|
|
{
|
2012-03-27 10:42:42 -04:00
|
|
|
return add_keybinding_internal (display, name, settings,
|
2011-11-04 14:18:57 -04: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 10:42:42 -04:00
|
|
|
* @settings: the #GSettings object where @name is stored
|
2011-11-04 14:18:57 -04: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
|
|
|
|
* keybinding in the form of "<Control>a" or "<Shift><Alt>F1". The parser
|
|
|
|
* is fairly liberal and allows lower or upper case, and also abbreviations
|
|
|
|
* such as "<Ctl>" and "<Ctrl>". If the key is set to the empty list or a
|
|
|
|
* list with a single element of either "" or "disabled", the keybinding is
|
|
|
|
* disabled.
|
|
|
|
* If %META_KEY_BINDING_REVERSES is specified in @flags, the binding
|
|
|
|
* may be reversed by holding down the "shift" key; therefore, "<Shift>"
|
|
|
|
* cannot be one of the keys used. @handler is expected to check for the
|
|
|
|
* "shift" modifier in this case and reverse its action.
|
|
|
|
*
|
|
|
|
* Use meta_display_remove_keybinding() to remove the binding.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the keybinding was added successfully,
|
|
|
|
* otherwise %FALSE
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_display_add_keybinding (MetaDisplay *display,
|
|
|
|
const char *name,
|
2012-03-27 10:42:42 -04:00
|
|
|
GSettings *settings,
|
2011-11-04 14:18:57 -04:00
|
|
|
MetaKeyBindingFlags flags,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify free_data)
|
|
|
|
{
|
2012-03-27 10:42:42 -04:00
|
|
|
return add_keybinding_internal (display, name, settings, flags,
|
2011-11-04 14:18:57 -04:00
|
|
|
META_KEYBINDING_ACTION_NONE,
|
|
|
|
handler, 0, user_data, free_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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().
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the binding has been removed sucessfully,
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
2010-03-16 18:05:13 -04:00
|
|
|
/**
|
|
|
|
* meta_display_get_keybinding_action:
|
|
|
|
* @display: A #MetaDisplay
|
|
|
|
* @keycode: Raw keycode
|
|
|
|
* @mask: Event mask
|
|
|
|
*
|
2011-11-04 14:18:57 -04:00
|
|
|
* Get the #MetaKeyBindingAction bound to %keycode. Only builtin
|
|
|
|
* keybindings have an associated #MetaKeyBindingAction, for
|
|
|
|
* bindings added dynamically with meta_display_add_keybinding()
|
|
|
|
* the function will always return %META_KEYBINDING_ACTION_NONE.
|
|
|
|
*
|
2010-10-14 11:24:38 -04:00
|
|
|
* Returns: The action that should be taken for the given key, or
|
|
|
|
* %META_KEYBINDING_ACTION_NONE.
|
2010-03-16 18:05:13 -04:00
|
|
|
*/
|
|
|
|
MetaKeyBindingAction
|
|
|
|
meta_display_get_keybinding_action (MetaDisplay *display,
|
|
|
|
unsigned int keycode,
|
|
|
|
unsigned long mask)
|
2009-08-25 16:54:54 -04:00
|
|
|
{
|
|
|
|
MetaKeyBinding *binding;
|
2010-10-14 11:24:38 -04:00
|
|
|
KeySym keysym;
|
2009-08-25 16:54:54 -04:00
|
|
|
|
2012-08-10 16:08:03 -04: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.
|
|
|
|
*/
|
2012-08-29 17:06:45 -04:00
|
|
|
if (keycode == (unsigned int)display->overlay_key_combo.keycode)
|
2012-08-10 16:08:03 -04:00
|
|
|
return META_KEYBINDING_ACTION_OVERLAY_KEY;
|
|
|
|
|
2010-10-14 11:24:38 -04:00
|
|
|
keysym = XKeycodeToKeysym (display->xdisplay, keycode, 0);
|
2010-03-18 17:56:20 -04:00
|
|
|
mask = mask & 0xff & ~display->ignored_modifier_mask;
|
2009-08-25 16:54:54 -04:00
|
|
|
binding = display_get_keybinding (display, keysym, keycode, mask);
|
|
|
|
|
2011-01-14 11:46:31 -05:00
|
|
|
if (!binding && keycode == meta_display_get_above_tab_keycode (display))
|
|
|
|
binding = display_get_keybinding (display, META_KEY_ABOVE_TAB, keycode, mask);
|
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
if (binding)
|
|
|
|
return meta_prefs_get_keybinding_action (binding->name);
|
|
|
|
else
|
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
2002-07-13 23:16:41 -04:00
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
void
|
|
|
|
meta_display_process_mapping_event (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
2010-05-02 11:35:33 -04:00
|
|
|
gboolean keymap_changed = FALSE;
|
|
|
|
gboolean modmap_changed = FALSE;
|
|
|
|
|
2010-05-02 11:27:25 -04:00
|
|
|
#ifdef HAVE_XKB
|
|
|
|
if (event->type == display->xkb_base_event_type)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"XKB mapping changed, will redo keybindings\n");
|
|
|
|
|
2010-05-02 11:35:33 -04:00
|
|
|
keymap_changed = TRUE;
|
|
|
|
modmap_changed = TRUE;
|
2010-05-02 11:27:25 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
2002-04-28 00:52:26 -04:00
|
|
|
if (event->xmapping.request == MappingModifier)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Received MappingModifier event, will reload modmap and redo keybindings\n");
|
|
|
|
|
2010-05-02 11:35:33 -04:00
|
|
|
modmap_changed = TRUE;
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
else if (event->xmapping.request == MappingKeyboard)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Received MappingKeyboard event, will reload keycodes and redo keybindings\n");
|
|
|
|
|
2010-05-02 11:35:33 -04:00
|
|
|
keymap_changed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now to do the work itself */
|
|
|
|
|
|
|
|
if (keymap_changed || modmap_changed)
|
|
|
|
{
|
|
|
|
if (keymap_changed)
|
|
|
|
reload_keymap (display);
|
|
|
|
|
|
|
|
/* 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 */
|
2002-04-28 00:52:26 -04:00
|
|
|
reload_modmap (display);
|
2010-05-02 11:35:33 -04:00
|
|
|
|
|
|
|
if (keymap_changed)
|
|
|
|
reload_keycodes (display);
|
|
|
|
|
|
|
|
reload_modifiers (display);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
regrab_key_bindings (display);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
bindings_changed_callback (MetaPreference pref,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
|
|
|
|
display = data;
|
|
|
|
|
|
|
|
switch (pref)
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
case META_PREF_KEYBINDINGS:
|
|
|
|
rebuild_key_binding_table (display);
|
2008-12-02 18:13:11 -05:00
|
|
|
rebuild_special_bindings (display);
|
2002-04-28 00:52:26 -04:00
|
|
|
reload_keycodes (display);
|
2002-07-13 23:16:41 -04:00
|
|
|
reload_modifiers (display);
|
2008-11-22 14:02:54 -05:00
|
|
|
regrab_key_bindings (display);
|
2002-04-28 00:52:26 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
void
|
|
|
|
meta_display_shutdown_keys (MetaDisplay *display)
|
|
|
|
{
|
2002-08-06 00:11:23 -04:00
|
|
|
/* Note that display->xdisplay is invalid in this function */
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_prefs_remove_listener (bindings_changed_callback, display);
|
|
|
|
|
|
|
|
if (display->keymap)
|
|
|
|
meta_XFree (display->keymap);
|
|
|
|
|
|
|
|
if (display->modmap)
|
|
|
|
XFreeModifiermap (display->modmap);
|
2008-11-22 14:02:54 -05:00
|
|
|
g_free (display->key_bindings);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char*
|
|
|
|
keysym_name (int keysym)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
name = XKeysymToString (keysym);
|
|
|
|
if (name == NULL)
|
|
|
|
name = "(unknown)";
|
|
|
|
|
|
|
|
return name;
|
2001-06-23 01:49:35 -04:00
|
|
|
}
|
|
|
|
|
2001-10-04 22:58:48 -04:00
|
|
|
/* Grab/ungrab, ignoring all annoying modifiers like NumLock etc. */
|
|
|
|
static void
|
|
|
|
meta_change_keygrab (MetaDisplay *display,
|
|
|
|
Window xwindow,
|
|
|
|
gboolean grab,
|
|
|
|
int keysym,
|
2003-02-22 15:31:51 -05:00
|
|
|
unsigned int keycode,
|
2001-10-04 22:58:48 -04:00
|
|
|
int modmask)
|
|
|
|
{
|
2003-05-20 23:45:58 -04:00
|
|
|
unsigned int ignored_mask;
|
2001-10-04 22:58:48 -04:00
|
|
|
|
|
|
|
/* Grab keycode/modmask, together with
|
2002-04-28 00:52:26 -04:00
|
|
|
* all combinations of ignored modifiers.
|
2001-10-04 22:58:48 -04:00
|
|
|
* X provides no better way to do this.
|
|
|
|
*/
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
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 15:06:26 -04:00
|
|
|
"%s keybinding %s keycode %d mask 0x%x on 0x%lx\n",
|
2002-04-28 00:52:26 -04:00
|
|
|
grab ? "Grabbing" : "Ungrabbing",
|
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 15:06:26 -04:00
|
|
|
keysym_name (keysym), keycode,
|
2002-06-08 23:44:16 -04:00
|
|
|
modmask, xwindow);
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
/* efficiency, avoid so many XSync() */
|
|
|
|
meta_error_trap_push (display);
|
2001-10-04 22:58:48 -04:00
|
|
|
|
|
|
|
ignored_mask = 0;
|
2003-05-20 23:45:58 -04:00
|
|
|
while (ignored_mask <= display->ignored_modifier_mask)
|
2001-10-04 22:58:48 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
if (ignored_mask & ~(display->ignored_modifier_mask))
|
2001-10-04 22:58:48 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
/* Not a combination of ignored modifiers
|
2001-10-04 22:58:48 -04:00
|
|
|
* (it contains some non-ignored modifiers)
|
|
|
|
*/
|
|
|
|
++ignored_mask;
|
|
|
|
continue;
|
|
|
|
}
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
if (meta_is_debugging ())
|
|
|
|
meta_error_trap_push_with_return (display);
|
2001-10-04 22:58:48 -04:00
|
|
|
if (grab)
|
|
|
|
XGrabKey (display->xdisplay, keycode,
|
|
|
|
modmask | ignored_mask,
|
|
|
|
xwindow,
|
|
|
|
True,
|
2002-02-08 01:01:58 -05:00
|
|
|
GrabModeAsync, GrabModeSync);
|
2001-10-04 22:58:48 -04:00
|
|
|
else
|
|
|
|
XUngrabKey (display->xdisplay, keycode,
|
|
|
|
modmask | ignored_mask,
|
|
|
|
xwindow);
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
if (meta_is_debugging ())
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
2010-10-25 14:44:30 -04:00
|
|
|
result = meta_error_trap_pop_with_return (display);
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
if (grab && result != Success)
|
|
|
|
{
|
|
|
|
if (result == BadAccess)
|
|
|
|
meta_warning (_("Some other program is already using the key %s with modifiers %x as a binding\n"), keysym_name (keysym), modmask | ignored_mask);
|
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Failed to grab key %s with modifiers %x\n",
|
|
|
|
keysym_name (keysym), modmask | ignored_mask);
|
|
|
|
}
|
2001-10-04 22:58:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
++ignored_mask;
|
|
|
|
}
|
2002-10-21 17:44:35 -04:00
|
|
|
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2001-10-04 22:58:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_grab_key (MetaDisplay *display,
|
|
|
|
Window xwindow,
|
|
|
|
int keysym,
|
2003-02-22 15:31:51 -05:00
|
|
|
unsigned int keycode,
|
2001-10-04 22:58:48 -04:00
|
|
|
int modmask)
|
|
|
|
{
|
|
|
|
meta_change_keygrab (display, xwindow, TRUE, keysym, keycode, modmask);
|
|
|
|
}
|
|
|
|
|
2001-06-23 01:49:35 -04:00
|
|
|
static void
|
|
|
|
grab_keys (MetaKeyBinding *bindings,
|
2002-04-28 00:52:26 -04:00
|
|
|
int n_bindings,
|
2001-06-23 01:49:35 -04:00
|
|
|
MetaDisplay *display,
|
2008-11-22 14:02:54 -05:00
|
|
|
Window xwindow,
|
|
|
|
gboolean binding_per_window)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
g_assert (n_bindings == 0 || bindings != NULL);
|
2002-11-06 11:00:56 -05:00
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
i = 0;
|
2002-04-28 00:52:26 -04:00
|
|
|
while (i < n_bindings)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (!!binding_per_window ==
|
2011-10-27 21:05:43 -04:00
|
|
|
!!(bindings[i].handler->flags & META_KEY_BINDING_PER_WINDOW) &&
|
2008-11-22 14:02:54 -05:00
|
|
|
bindings[i].keycode != 0)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2001-10-04 22:58:48 -04:00
|
|
|
meta_grab_key (display, xwindow,
|
|
|
|
bindings[i].keysym,
|
|
|
|
bindings[i].keycode,
|
|
|
|
bindings[i].mask);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-11-06 11:00:56 -05:00
|
|
|
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
2001-06-23 01:49:35 -04:00
|
|
|
static void
|
2002-04-28 00:52:26 -04:00
|
|
|
ungrab_all_keys (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2002-11-06 11:00:56 -05:00
|
|
|
if (meta_is_debugging ())
|
|
|
|
meta_error_trap_push_with_return (display);
|
|
|
|
else
|
|
|
|
meta_error_trap_push (display);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
XUngrabKey (display->xdisplay, AnyKey, AnyModifier,
|
|
|
|
xwindow);
|
2002-11-06 11:00:56 -05:00
|
|
|
|
|
|
|
if (meta_is_debugging ())
|
|
|
|
{
|
|
|
|
int result;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2010-10-25 14:44:30 -04:00
|
|
|
result = meta_error_trap_pop_with_return (display);
|
2002-11-06 11:00:56 -05:00
|
|
|
|
|
|
|
if (result != Success)
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ungrabbing all keys on 0x%lx failed\n", xwindow);
|
|
|
|
}
|
|
|
|
else
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_screen_grab_keys (MetaScreen *screen)
|
2001-06-23 01:49:35 -04:00
|
|
|
{
|
2008-12-02 18:13:11 -05:00
|
|
|
MetaDisplay *display = screen->display;
|
2002-06-30 23:20:29 -04:00
|
|
|
if (screen->all_keys_grabbed)
|
|
|
|
return;
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
if (screen->keys_grabbed)
|
|
|
|
return;
|
2008-12-02 18:13:11 -05:00
|
|
|
|
|
|
|
if (display->overlay_key_combo.keycode != 0)
|
|
|
|
meta_grab_key (display, screen->xroot,
|
|
|
|
display->overlay_key_combo.keysym,
|
|
|
|
display->overlay_key_combo.keycode,
|
|
|
|
display->overlay_key_combo.modifiers);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
grab_keys (screen->display->key_bindings,
|
|
|
|
screen->display->n_key_bindings,
|
|
|
|
screen->display, screen->xroot,
|
|
|
|
FALSE);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
screen->keys_grabbed = TRUE;
|
2001-06-23 01:49:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_ungrab_keys (MetaScreen *screen)
|
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
if (screen->keys_grabbed)
|
|
|
|
{
|
|
|
|
ungrab_all_keys (screen->display, screen->xroot);
|
|
|
|
screen->keys_grabbed = FALSE;
|
|
|
|
}
|
2001-06-23 01:49:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_grab_keys (MetaWindow *window)
|
|
|
|
{
|
2001-07-11 02:22:00 -04:00
|
|
|
if (window->all_keys_grabbed)
|
|
|
|
return;
|
2003-02-27 17:44:36 -05:00
|
|
|
|
2008-11-23 14:28:40 -05:00
|
|
|
if (window->type == META_WINDOW_DOCK
|
|
|
|
|| window->override_redirect)
|
2003-02-27 17:44:36 -05:00
|
|
|
{
|
|
|
|
if (window->keys_grabbed)
|
|
|
|
ungrab_all_keys (window->display, window->xwindow);
|
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
return;
|
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2001-06-23 01:49:35 -04:00
|
|
|
if (window->keys_grabbed)
|
|
|
|
{
|
|
|
|
if (window->frame && !window->grab_on_frame)
|
2002-04-28 00:52:26 -04:00
|
|
|
ungrab_all_keys (window->display, window->xwindow);
|
2001-06-23 01:49:35 -04:00
|
|
|
else if (window->frame == NULL &&
|
|
|
|
window->grab_on_frame)
|
|
|
|
; /* continue to regrab on client window */
|
|
|
|
else
|
|
|
|
return; /* already all good */
|
|
|
|
}
|
2001-06-23 02:54:28 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
grab_keys (window->display->key_bindings,
|
|
|
|
window->display->n_key_bindings,
|
2002-04-28 00:52:26 -04:00
|
|
|
window->display,
|
2008-11-22 14:02:54 -05:00
|
|
|
window->frame ? window->frame->xwindow : window->xwindow,
|
|
|
|
TRUE);
|
2001-06-23 01:49:35 -04:00
|
|
|
|
|
|
|
window->keys_grabbed = TRUE;
|
|
|
|
window->grab_on_frame = window->frame != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_ungrab_keys (MetaWindow *window)
|
|
|
|
{
|
|
|
|
if (window->keys_grabbed)
|
|
|
|
{
|
|
|
|
if (window->grab_on_frame &&
|
|
|
|
window->frame != NULL)
|
2002-04-28 00:52:26 -04:00
|
|
|
ungrab_all_keys (window->display,
|
|
|
|
window->frame->xwindow);
|
2001-06-23 01:49:35 -04:00
|
|
|
else if (!window->grab_on_frame)
|
2002-04-28 00:52:26 -04:00
|
|
|
ungrab_all_keys (window->display,
|
|
|
|
window->xwindow);
|
2002-06-08 20:09:01 -04:00
|
|
|
|
|
|
|
window->keys_grabbed = FALSE;
|
2001-06-23 01:49:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-21 17:40:25 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
|
|
|
static const char*
|
|
|
|
grab_status_to_string (int status)
|
|
|
|
{
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case AlreadyGrabbed:
|
|
|
|
return "AlreadyGrabbed";
|
|
|
|
case GrabSuccess:
|
|
|
|
return "GrabSuccess";
|
|
|
|
case GrabNotViewable:
|
|
|
|
return "GrabNotViewable";
|
|
|
|
case GrabFrozen:
|
|
|
|
return "GrabFrozen";
|
|
|
|
case GrabInvalidTime:
|
|
|
|
return "GrabInvalidTime";
|
|
|
|
default:
|
|
|
|
return "(unknown)";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
static gboolean
|
2002-07-02 01:03:28 -04:00
|
|
|
grab_keyboard (MetaDisplay *display,
|
2006-09-09 16:19:56 -04:00
|
|
|
Window xwindow,
|
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 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2002-06-27 01:08:32 -04:00
|
|
|
{
|
|
|
|
int result;
|
2003-01-21 17:40:25 -05:00
|
|
|
int grab_status;
|
|
|
|
|
2002-07-02 01:03:28 -04:00
|
|
|
/* Grab the keyboard, so we get key releases and all key
|
2002-06-27 01:08:32 -04:00
|
|
|
* presses
|
|
|
|
*/
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_push_with_return (display);
|
2002-06-27 01:08:32 -04:00
|
|
|
|
2003-01-21 17:40:25 -05:00
|
|
|
grab_status = XGrabKeyboard (display->xdisplay,
|
|
|
|
xwindow, True,
|
|
|
|
GrabModeAsync, GrabModeAsync,
|
|
|
|
timestamp);
|
|
|
|
|
|
|
|
if (grab_status != GrabSuccess)
|
2002-06-27 01:08:32 -04:00
|
|
|
{
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop_with_return (display);
|
2002-06-27 01:08:32 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
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 12:32:33 -04:00
|
|
|
"XGrabKeyboard() returned failure status %s time %u\n",
|
2003-01-21 17:40:25 -05:00
|
|
|
grab_status_to_string (grab_status),
|
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 12:32:33 -04:00
|
|
|
timestamp);
|
2003-01-21 17:40:25 -05:00
|
|
|
return FALSE;
|
2002-10-21 17:44:35 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-25 14:44:30 -04:00
|
|
|
result = meta_error_trap_pop_with_return (display);
|
2002-10-21 17:44:35 -04:00
|
|
|
if (result != Success)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"XGrabKeyboard() resulted in an error\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-06-27 01:08:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS, "Grabbed all keys\n");
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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 12:32:33 -04:00
|
|
|
ungrab_keyboard (MetaDisplay *display, guint32 timestamp)
|
2002-06-27 01:08:32 -04:00
|
|
|
{
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
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 12:32:33 -04:00
|
|
|
"Ungrabbing keyboard with timestamp %u\n",
|
2002-06-27 01:08:32 -04:00
|
|
|
timestamp);
|
|
|
|
XUngrabKeyboard (display->xdisplay, timestamp);
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2002-06-27 01:08:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
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 12:32:33 -04:00
|
|
|
meta_screen_grab_all_keys (MetaScreen *screen, guint32 timestamp)
|
2002-06-27 01:08:32 -04:00
|
|
|
{
|
|
|
|
gboolean retval;
|
|
|
|
|
|
|
|
if (screen->all_keys_grabbed)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (screen->keys_grabbed)
|
|
|
|
meta_screen_ungrab_keys (screen);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Grabbing all keys on RootWindow\n");
|
2006-09-09 16:19:56 -04:00
|
|
|
retval = grab_keyboard (screen->display, screen->xroot, timestamp);
|
2002-06-27 01:08:32 -04:00
|
|
|
if (retval)
|
2009-05-05 04:39:29 -04:00
|
|
|
{
|
|
|
|
screen->all_keys_grabbed = TRUE;
|
|
|
|
g_object_notify (G_OBJECT (screen), "keyboard-grabbed");
|
|
|
|
}
|
2002-06-30 23:20:29 -04:00
|
|
|
else
|
|
|
|
meta_screen_grab_keys (screen);
|
2002-06-27 01:08:32 -04:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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 12:32:33 -04:00
|
|
|
meta_screen_ungrab_all_keys (MetaScreen *screen, guint32 timestamp)
|
2002-06-27 01:08:32 -04:00
|
|
|
{
|
|
|
|
if (screen->all_keys_grabbed)
|
|
|
|
{
|
2006-09-09 16:19:56 -04:00
|
|
|
ungrab_keyboard (screen->display, timestamp);
|
2002-06-27 01:08:32 -04:00
|
|
|
|
|
|
|
screen->all_keys_grabbed = FALSE;
|
|
|
|
screen->keys_grabbed = FALSE;
|
|
|
|
|
|
|
|
/* Re-establish our standard bindings */
|
|
|
|
meta_screen_grab_keys (screen);
|
2009-05-05 04:39:29 -04:00
|
|
|
g_object_notify (G_OBJECT (screen), "keyboard-grabbed");
|
2002-06-27 01:08:32 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
gboolean
|
2006-08-21 14:38:21 -04: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 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
|
|
|
Window grabwindow;
|
2002-06-27 01:08:32 -04:00
|
|
|
gboolean retval;
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
if (window->all_keys_grabbed)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
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 18:28:19 -05:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing %s because we're grabbing all its keys\n",
|
|
|
|
window->desc);
|
2006-08-21 14:38:21 -04:00
|
|
|
meta_window_focus (window, timestamp);
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
grabwindow = window->frame ? window->frame->xwindow : window->xwindow;
|
2002-06-27 01:08:32 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Grabbing all keys on window %s\n", window->desc);
|
2006-09-09 16:19:56 -04:00
|
|
|
retval = grab_keyboard (window->display, grabwindow, timestamp);
|
2002-06-27 01:08:32 -04:00
|
|
|
if (retval)
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
2002-06-27 01:08:32 -04:00
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
window->all_keys_grabbed = TRUE;
|
|
|
|
window->grab_on_frame = window->frame != NULL;
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
2002-01-03 18:28:19 -05:00
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
return retval;
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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 12:32:33 -04:00
|
|
|
meta_window_ungrab_all_keys (MetaWindow *window, guint32 timestamp)
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
|
|
|
if (window->all_keys_grabbed)
|
|
|
|
{
|
2006-09-09 16:19:56 -04:00
|
|
|
ungrab_keyboard (window->display, timestamp);
|
2002-01-03 18:28:19 -05:00
|
|
|
|
2001-07-11 02:22:00 -04: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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
is_modifier (MetaDisplay *display,
|
|
|
|
unsigned int keycode)
|
|
|
|
{
|
2001-08-19 14:09:10 -04:00
|
|
|
int i;
|
|
|
|
int map_size;
|
2002-04-28 00:52:26 -04:00
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_assert (display->modmap);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
map_size = 8 * display->modmap->max_keypermod;
|
2001-08-19 14:09:10 -04:00
|
|
|
i = 0;
|
|
|
|
while (i < map_size)
|
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
if (keycode == display->modmap->modifiermap[i])
|
2001-08-19 14:09:10 -04:00
|
|
|
{
|
|
|
|
retval = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
/* Indexes:
|
|
|
|
* shift = 0
|
|
|
|
* lock = 1
|
|
|
|
* control = 2
|
|
|
|
* mod1 = 3
|
|
|
|
* mod2 = 4
|
|
|
|
* mod3 = 5
|
|
|
|
* mod4 = 6
|
|
|
|
* mod5 = 7
|
|
|
|
*/
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
static gboolean
|
2002-04-28 00:52:26 -04:00
|
|
|
is_specific_modifier (MetaDisplay *display,
|
|
|
|
unsigned int keycode,
|
|
|
|
unsigned int mask)
|
2001-08-19 14:09:10 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int end;
|
|
|
|
gboolean retval = FALSE;
|
2002-04-28 00:52:26 -04:00
|
|
|
int mod_index;
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
g_assert (display->modmap);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Checking whether code 0x%x is bound to modifier 0x%x\n",
|
|
|
|
keycode, mask);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
mod_index = 0;
|
|
|
|
mask = mask >> 1;
|
|
|
|
while (mask != 0)
|
|
|
|
{
|
|
|
|
mod_index += 1;
|
|
|
|
mask = mask >> 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Modifier has index %d\n", mod_index);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
end = (mod_index + 1) * display->modmap->max_keypermod;
|
|
|
|
i = mod_index * display->modmap->max_keypermod;
|
2001-08-19 14:09:10 -04:00
|
|
|
while (i < end)
|
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
if (keycode == display->modmap->modifiermap[i])
|
2001-08-19 14:09:10 -04:00
|
|
|
{
|
|
|
|
retval = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
|
|
|
|
2003-01-21 17:40:25 -05:00
|
|
|
static unsigned int
|
|
|
|
get_primary_modifier (MetaDisplay *display,
|
|
|
|
unsigned int entire_binding_mask)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
|
|
|
/* The idea here is to see if the "main" modifier
|
|
|
|
* for Alt+Tab has been pressed/released. So if the binding
|
|
|
|
* is Alt+Shift+Tab then releasing Alt is the thing that
|
|
|
|
* ends the operation. It's pretty random how we order
|
|
|
|
* these.
|
|
|
|
*/
|
|
|
|
unsigned int masks[] = { Mod5Mask, Mod4Mask, Mod3Mask,
|
|
|
|
Mod2Mask, Mod1Mask, ControlMask,
|
|
|
|
ShiftMask, LockMask };
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < (int) G_N_ELEMENTS (masks))
|
|
|
|
{
|
|
|
|
if (entire_binding_mask & masks[i])
|
2003-01-21 17:40:25 -05:00
|
|
|
return masks[i];
|
2002-04-28 00:52:26 -04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2003-01-21 17:40:25 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
keycode_is_primary_modifier (MetaDisplay *display,
|
|
|
|
unsigned int keycode,
|
|
|
|
unsigned int entire_binding_mask)
|
|
|
|
{
|
|
|
|
unsigned int primary_modifier;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Checking whether code 0x%x is the primary modifier of mask 0x%x\n",
|
|
|
|
keycode, entire_binding_mask);
|
|
|
|
|
|
|
|
primary_modifier = get_primary_modifier (display, entire_binding_mask);
|
|
|
|
if (primary_modifier != 0)
|
|
|
|
return is_specific_modifier (display, keycode, primary_modifier);
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
primary_modifier_still_pressed (MetaDisplay *display,
|
|
|
|
unsigned int entire_binding_mask)
|
|
|
|
{
|
|
|
|
unsigned int primary_modifier;
|
|
|
|
int x, y, root_x, root_y;
|
|
|
|
Window root, child;
|
|
|
|
guint mask;
|
2005-12-28 01:24:30 -05:00
|
|
|
MetaScreen *random_screen;
|
|
|
|
Window random_xwindow;
|
2003-01-21 17:40:25 -05:00
|
|
|
|
|
|
|
primary_modifier = get_primary_modifier (display, entire_binding_mask);
|
|
|
|
|
2005-12-28 01:24:30 -05:00
|
|
|
random_screen = display->screens->data;
|
|
|
|
random_xwindow = random_screen->no_focus_window;
|
2003-01-21 17:40:25 -05:00
|
|
|
XQueryPointer (display->xdisplay,
|
2005-12-28 01:24:30 -05:00
|
|
|
random_xwindow, /* some random window */
|
2003-01-21 17:40:25 -05:00
|
|
|
&root, &child,
|
|
|
|
&root_x, &root_y,
|
|
|
|
&x, &y,
|
|
|
|
&mask);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Primary modifier 0x%x full grab mask 0x%x current state 0x%x\n",
|
|
|
|
primary_modifier, entire_binding_mask, mask);
|
|
|
|
|
|
|
|
if ((mask & primary_modifier) == 0)
|
|
|
|
return FALSE;
|
|
|
|
else
|
|
|
|
return TRUE;
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
static void
|
|
|
|
invoke_handler (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaKeyHandler *handler,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (handler->func)
|
|
|
|
(* handler->func) (display, screen,
|
2011-10-27 21:05:43 -04:00
|
|
|
handler->flags & META_KEY_BINDING_PER_WINDOW ?
|
2009-08-25 16:54:54 -04:00
|
|
|
window : NULL,
|
|
|
|
event,
|
|
|
|
binding,
|
|
|
|
handler->user_data);
|
|
|
|
else
|
|
|
|
(* handler->default_func) (display, screen,
|
2011-10-27 21:05:43 -04:00
|
|
|
handler->flags & META_KEY_BINDING_PER_WINDOW ?
|
2009-08-25 16:54:54 -04:00
|
|
|
window: NULL,
|
|
|
|
event,
|
|
|
|
binding,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
invoke_handler_by_name (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
const char *handler_name,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
MetaKeyHandler *handler;
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
handler = HANDLER (handler_name);
|
2009-08-25 16:54:54 -04:00
|
|
|
if (handler)
|
|
|
|
invoke_handler (display, screen, handler, window, event, NULL);
|
|
|
|
}
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
/* now called from only one place, may be worth merging */
|
2008-03-10 23:37:54 -04:00
|
|
|
static gboolean
|
2002-04-28 00:52:26 -04:00
|
|
|
process_event (MetaKeyBinding *bindings,
|
|
|
|
int n_bindings,
|
|
|
|
MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2008-11-22 14:02:54 -05:00
|
|
|
KeySym keysym,
|
|
|
|
gboolean on_window)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-06-15 23:03:08 -04:00
|
|
|
/* we used to have release-based bindings but no longer. */
|
|
|
|
if (event->type == KeyRelease)
|
2008-03-10 23:37:54 -04:00
|
|
|
return FALSE;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
/*
|
|
|
|
* TODO: This would be better done with a hash table;
|
|
|
|
* it doesn't suit to use O(n) for such a common operation.
|
|
|
|
*/
|
|
|
|
for (i=0; i<n_bindings; i++)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2009-01-29 10:29:43 -05:00
|
|
|
MetaKeyHandler *handler = bindings[i].handler;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
if ((!on_window && handler->flags & META_KEY_BINDING_PER_WINDOW) ||
|
2008-11-22 14:02:54 -05:00
|
|
|
event->type != KeyPress ||
|
|
|
|
bindings[i].keycode != event->xkey.keycode ||
|
|
|
|
((event->xkey.state & 0xff & ~(display->ignored_modifier_mask)) !=
|
|
|
|
bindings[i].mask))
|
|
|
|
continue;
|
2011-10-27 21:05:43 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
/*
|
|
|
|
* window must be non-NULL for on_window to be true,
|
|
|
|
* and so also window must be non-NULL if we get here and
|
2011-10-27 21:05:43 -04:00
|
|
|
* this is a META_KEY_BINDING_PER_WINDOW binding.
|
2008-11-22 14:02:54 -05:00
|
|
|
*/
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Binding keycode 0x%x mask 0x%x matches event 0x%x state 0x%x\n",
|
|
|
|
bindings[i].keycode, bindings[i].mask,
|
|
|
|
event->xkey.keycode, event->xkey.state);
|
|
|
|
|
|
|
|
if (handler == NULL)
|
|
|
|
meta_bug ("Binding %s has no handler\n", bindings[i].name);
|
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Running handler for %s\n",
|
|
|
|
bindings[i].name);
|
2011-10-27 21:05:43 -04:00
|
|
|
|
2008-11-22 14:02:54 -05: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 12:03:57 -05:00
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
invoke_handler (display, screen, handler, window, event, &bindings[i]);
|
2009-02-03 08:20:51 -05:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
return TRUE;
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
2002-06-15 23:03:08 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"No handler found for this event in this binding table\n");
|
2008-03-10 23:37:54 -04:00
|
|
|
return FALSE;
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
2002-06-27 01:08:32 -04:00
|
|
|
|
2011-07-08 20:48:01 -04:00
|
|
|
static gboolean
|
|
|
|
process_overlay_key (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
|
|
|
{
|
|
|
|
if (display->overlay_key_only_pressed)
|
|
|
|
{
|
|
|
|
if (event->xkey.keycode != display->overlay_key_combo.keycode)
|
|
|
|
{
|
|
|
|
display->overlay_key_only_pressed = FALSE;
|
|
|
|
|
|
|
|
/* OK, the user hit modifier+key rather than pressing and
|
|
|
|
* releasing the ovelay key. We want to handle the key
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
if (process_event (display->key_bindings,
|
|
|
|
display->n_key_bindings,
|
|
|
|
display, screen, NULL, event, keysym,
|
|
|
|
FALSE))
|
|
|
|
{
|
|
|
|
/* 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 */
|
|
|
|
XAllowEvents (display->xdisplay, AsyncKeyboard, event->xkey.time);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Replay the event so it gets delivered to our
|
|
|
|
* per-window key bindings or to the application */
|
|
|
|
XAllowEvents (display->xdisplay, ReplayKeyboard, event->xkey.time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (event->xkey.type == KeyRelease)
|
|
|
|
{
|
|
|
|
display->overlay_key_only_pressed = FALSE;
|
|
|
|
/* We want to unfreeze events, but keep the grab so that if the user
|
|
|
|
* starts typing into the overlay we get all the keys */
|
|
|
|
XAllowEvents (display->xdisplay, AsyncKeyboard, event->xkey.time);
|
|
|
|
meta_display_overlay_key_activate (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else if (event->xkey.type == KeyPress &&
|
|
|
|
event->xkey.keycode == display->overlay_key_combo.keycode)
|
|
|
|
{
|
|
|
|
display->overlay_key_only_pressed = TRUE;
|
|
|
|
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
|
|
|
|
* on the next event if it's not the release of the overlay key */
|
|
|
|
XAllowEvents (display->xdisplay, SyncKeyboard, event->xkey.time);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-12-09 17:56:12 -05: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.
|
2009-08-11 19:41:50 -04:00
|
|
|
*
|
|
|
|
* The return value is whether we handled the key event.
|
|
|
|
*
|
2007-12-09 17:56:12 -05:00
|
|
|
* 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).
|
|
|
|
*/
|
2009-08-11 19:41:50 -04:00
|
|
|
gboolean
|
2001-06-23 22:22:10 -04:00
|
|
|
meta_display_process_key_event (MetaDisplay *display,
|
2001-06-23 01:49:35 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
2001-07-11 02:22:00 -04:00
|
|
|
KeySym keysym;
|
2008-03-10 23:37:54 -04:00
|
|
|
gboolean keep_grab;
|
2002-06-27 01:08:32 -04:00
|
|
|
gboolean all_keys_grabbed;
|
2008-12-02 18:13:11 -05:00
|
|
|
gboolean handled;
|
2002-06-15 23:03:08 -04:00
|
|
|
const char *str;
|
2002-06-27 01:08:32 -04:00
|
|
|
MetaScreen *screen;
|
2008-11-22 14:02:54 -05:00
|
|
|
|
2002-02-08 01:01:58 -05:00
|
|
|
if (all_bindings_disabled)
|
2011-07-08 20:48:01 -04:00
|
|
|
{
|
|
|
|
/* In this mode, we try to pretend we don't have grabs, so we
|
|
|
|
* immediately replay events and drop the grab. (This still
|
|
|
|
* messes up global passive grabs from other clients.) The
|
|
|
|
* FALSE return here is a little suspect, but we don't really
|
|
|
|
* know if we'll see the event again or not, and it's pretty
|
|
|
|
* poorly defined how this mode is supposed to interact with
|
|
|
|
* plugins.
|
|
|
|
*/
|
|
|
|
XAllowEvents (display->xdisplay, ReplayKeyboard, event->xkey.time);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-02-03 08:23:08 -05:00
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
/* if key event was on root window, we have a shortcut */
|
|
|
|
screen = meta_display_screen_for_root (display, event->xkey.window);
|
|
|
|
|
|
|
|
/* else round-trip to server */
|
|
|
|
if (screen == NULL)
|
|
|
|
screen = meta_display_screen_for_xwindow (display,
|
|
|
|
event->xany.window);
|
2002-06-27 01:08:32 -04:00
|
|
|
|
2002-07-23 15:12:02 -04:00
|
|
|
if (screen == NULL)
|
2009-08-11 19:41:50 -04:00
|
|
|
return FALSE; /* event window is destroyed */
|
2002-10-16 16:12:24 -04:00
|
|
|
|
2002-08-10 11:55:18 -04:00
|
|
|
/* ignore key events on popup menus and such. */
|
2010-10-28 16:30:51 -04:00
|
|
|
if (meta_ui_window_is_widget (screen->ui, event->xany.window))
|
2009-08-11 19:41:50 -04:00
|
|
|
return FALSE;
|
2002-07-23 15:12:02 -04:00
|
|
|
|
2002-08-10 11:55:18 -04:00
|
|
|
/* window may be NULL */
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
keysym = XKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0);
|
2002-06-15 23:03:08 -04:00
|
|
|
|
|
|
|
str = XKeysymToString (keysym);
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
/* was topic */
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Processing key %s event, keysym: %s state: 0x%x window: %s\n",
|
|
|
|
event->type == KeyPress ? "press" : "release",
|
2002-12-19 15:18:54 -05:00
|
|
|
str ? str : "none", event->xkey.state,
|
2002-04-28 00:52:26 -04:00
|
|
|
window ? window->desc : "(no window)");
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed;
|
2011-07-08 20:48:01 -04:00
|
|
|
if (!all_keys_grabbed)
|
|
|
|
{
|
|
|
|
handled = process_overlay_key (display, screen, event, keysym);
|
|
|
|
if (handled)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
XAllowEvents (display->xdisplay, AsyncKeyboard, event->xkey.time);
|
|
|
|
|
|
|
|
keep_grab = TRUE;
|
2008-03-10 23:37:54 -04:00
|
|
|
if (all_keys_grabbed)
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
2008-03-10 23:37:54 -04:00
|
|
|
if (display->grab_op == META_GRAB_OP_NONE)
|
2009-08-11 19:41:50 -04:00
|
|
|
return TRUE;
|
2008-03-10 23:37:54 -04:00
|
|
|
/* If we get here we have a global grab, because
|
|
|
|
* we're in some special keyboard mode such as window move
|
|
|
|
* mode.
|
|
|
|
*/
|
|
|
|
if (window ? (window == display->grab_window) :
|
|
|
|
(screen == display->grab_screen))
|
|
|
|
{
|
|
|
|
switch (display->grab_op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_MOVING:
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Processing event for mouse-only move/resize\n");
|
|
|
|
g_assert (window != NULL);
|
|
|
|
keep_grab = process_mouse_move_resize_grab (display, screen,
|
|
|
|
window, event, keysym);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_MOVING:
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Processing event for keyboard move\n");
|
|
|
|
g_assert (window != NULL);
|
|
|
|
keep_grab = process_keyboard_move_grab (display, screen,
|
|
|
|
window, event, keysym);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
|
|
|
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:
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Processing event for keyboard resize\n");
|
|
|
|
g_assert (window != NULL);
|
|
|
|
keep_grab = process_keyboard_resize_grab (display, screen,
|
|
|
|
window, event, keysym);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Processing event for keyboard tabbing/cycling\n");
|
|
|
|
keep_grab = process_tab_grab (display, screen, event, keysym);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Processing event for keyboard workspace switching\n");
|
|
|
|
keep_grab = process_workspace_switch_grab (display, screen, event, keysym);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!keep_grab)
|
2001-08-19 14:09:10 -04:00
|
|
|
{
|
2002-06-08 23:44:16 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2008-03-10 23:37:54 -04:00
|
|
|
"Ending grab op %u on key event sym %s\n",
|
|
|
|
display->grab_op, XKeysymToString (keysym));
|
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
2001-08-19 14:09:10 -04:00
|
|
|
}
|
2009-08-11 19:41:50 -04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2008-12-02 18:13:11 -05:00
|
|
|
|
2008-03-10 23:37:54 -04:00
|
|
|
/* Do the normal keybindings */
|
2009-08-11 19:41:50 -04:00
|
|
|
return process_event (display->key_bindings,
|
|
|
|
display->n_key_bindings,
|
|
|
|
display, screen, window, event, keysym,
|
|
|
|
!all_keys_grabbed && window);
|
2001-08-19 14:09:10 -04:00
|
|
|
}
|
|
|
|
|
2006-08-21 14:38:21 -04:00
|
|
|
static gboolean
|
|
|
|
process_mouse_move_resize_grab (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
|
|
|
{
|
|
|
|
/* don't care about releases, but eat them, don't end grab */
|
|
|
|
if (event->type == KeyRelease)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (keysym == XK_Escape)
|
|
|
|
{
|
2011-01-13 11:58:11 -05:00
|
|
|
/* Hide the tiling preview if necessary */
|
|
|
|
if (window->tile_mode != META_TILE_NONE)
|
|
|
|
meta_screen_tile_preview_hide (screen);
|
|
|
|
|
2011-01-19 11:00:46 -05:00
|
|
|
/* Restore the original tile mode */
|
|
|
|
window->tile_mode = display->grab_tile_mode;
|
2011-10-08 11:00:16 -04:00
|
|
|
window->tile_monitor_number = display->grab_tile_monitor_number;
|
2011-01-19 11:00:46 -05:00
|
|
|
|
2006-08-21 14:38:21 -04: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 13:53:47 -04:00
|
|
|
* moveresize now to get the position back to the original.
|
2006-08-21 14:38:21 -04:00
|
|
|
*/
|
2011-01-19 11:00:46 -05:00
|
|
|
if (window->shaken_loose || window->tile_mode == META_TILE_MAXIMIZED)
|
2006-08-21 14:38:21 -04:00
|
|
|
meta_window_maximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2011-01-19 11:00:46 -05:00
|
|
|
else if (window->tile_mode != META_TILE_NONE)
|
|
|
|
meta_window_tile (window);
|
2009-05-07 13:53:47 -04:00
|
|
|
else
|
2006-08-21 14:38:21 -04:00
|
|
|
meta_window_move_resize (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);
|
|
|
|
|
2008-03-10 23:37:54 -04:00
|
|
|
/* End grab */
|
2006-08-21 14:38:21 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
static gboolean
|
|
|
|
process_keyboard_move_grab (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2001-08-19 14:09:10 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
|
|
|
{
|
|
|
|
gboolean handled;
|
|
|
|
int x, y;
|
|
|
|
int incr;
|
|
|
|
gboolean smart_snap;
|
|
|
|
|
|
|
|
handled = FALSE;
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
/* don't care about releases, but eat them, don't end grab */
|
|
|
|
if (event->type == KeyRelease)
|
|
|
|
return TRUE;
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
/* don't end grab on modifier key presses */
|
|
|
|
if (is_modifier (display, event->xkey.keycode))
|
|
|
|
return TRUE;
|
|
|
|
|
2009-05-07 13:53:47 -04:00
|
|
|
meta_window_get_position (window, &x, &y);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
|
|
|
smart_snap = (event->xkey.state & ShiftMask) != 0;
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
#define SMALL_INCREMENT 1
|
|
|
|
#define NORMAL_INCREMENT 10
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
if (smart_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 09:58:50 -05:00
|
|
|
incr = 1;
|
2001-08-19 14:09:10 -04:00
|
|
|
else if (event->xkey.state & ControlMask)
|
|
|
|
incr = SMALL_INCREMENT;
|
|
|
|
else
|
|
|
|
incr = NORMAL_INCREMENT;
|
2001-07-12 01:53:56 -04:00
|
|
|
|
2003-04-24 23:32:41 -04:00
|
|
|
if (keysym == XK_Escape)
|
|
|
|
{
|
2006-08-21 14:38:21 -04: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 13:53:47 -04:00
|
|
|
* now to get the position back to the original.
|
2003-10-12 02:25:38 -04:00
|
|
|
*/
|
2006-08-21 14:38:21 -04:00
|
|
|
if (window->shaken_loose)
|
|
|
|
meta_window_maximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2009-05-07 13:53:47 -04:00
|
|
|
else
|
2005-08-02 22:22:00 -04:00
|
|
|
meta_window_move_resize (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-24 23:32:41 -04:00
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04: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.
|
|
|
|
*/
|
2001-08-19 14:09:10 -04:00
|
|
|
switch (keysym)
|
|
|
|
{
|
2003-04-24 23:32:41 -04:00
|
|
|
case XK_KP_Home:
|
|
|
|
case XK_KP_Prior:
|
2001-08-19 14:09:10 -04:00
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
|
|
|
y -= incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2003-04-24 23:32:41 -04:00
|
|
|
case XK_KP_End:
|
|
|
|
case XK_KP_Next:
|
2001-08-19 14:09:10 -04:00
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
|
|
|
y += incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2003-04-24 23:32:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_KP_Home:
|
|
|
|
case XK_KP_End:
|
2001-08-19 14:09:10 -04:00
|
|
|
case XK_Left:
|
|
|
|
case XK_KP_Left:
|
|
|
|
x -= incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2003-04-24 23:32:41 -04:00
|
|
|
case XK_KP_Prior:
|
|
|
|
case XK_KP_Next:
|
2001-08-19 14:09:10 -04:00
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
|
|
|
x += incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2001-07-12 01:53:56 -04:00
|
|
|
|
2001-08-19 14:09:10 -04: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 00:27:23 -04: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 09:58:50 -05:00
|
|
|
MetaRectangle old_rect;
|
2003-10-12 02:25:38 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Computed new window location %d,%d due to keypress\n",
|
|
|
|
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 09:58:50 -05:00
|
|
|
|
2009-05-07 13:53:47 -04:00
|
|
|
meta_window_get_client_root_coords (window, &old_rect);
|
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 09:58:50 -05:00
|
|
|
|
|
|
|
meta_window_edge_resistance_for_move (window,
|
|
|
|
old_rect.x,
|
|
|
|
old_rect.y,
|
|
|
|
&x,
|
|
|
|
&y,
|
|
|
|
NULL,
|
|
|
|
smart_snap,
|
|
|
|
TRUE);
|
|
|
|
|
2009-05-07 13:53:47 -04:00
|
|
|
meta_window_move (window, TRUE, x, y);
|
2003-10-12 02:25:38 -04: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 00:27:23 -04:00
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2002-06-19 00:12:49 -04:00
|
|
|
static gboolean
|
2005-08-02 22:22:00 -04:00
|
|
|
process_keyboard_resize_grab_op_change (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
2002-06-19 00:12:49 -04:00
|
|
|
{
|
|
|
|
gboolean handled;
|
|
|
|
|
2005-08-02 22:22:00 -04:00
|
|
|
handled = FALSE;
|
2002-06-19 00:12:49 -04:00
|
|
|
switch (display->grab_op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Left:
|
|
|
|
case XK_KP_Left:
|
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Left:
|
|
|
|
case XK_KP_Left:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Left:
|
|
|
|
case XK_KP_Left:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
2005-08-02 22:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
2002-06-19 00:12:49 -04:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
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 00:27:23 -04:00
|
|
|
{
|
2003-10-12 02:25:38 -04:00
|
|
|
meta_window_update_keyboard_resize (window, TRUE);
|
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 00:27:23 -04:00
|
|
|
return TRUE;
|
2003-10-12 02:25:38 -04:00
|
|
|
}
|
2002-06-19 00:12:49 -04:00
|
|
|
|
2005-08-02 22:22:00 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
process_keyboard_resize_grab (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
|
|
|
{
|
|
|
|
gboolean handled;
|
|
|
|
int height_inc;
|
|
|
|
int width_inc;
|
|
|
|
int width, height;
|
|
|
|
gboolean smart_snap;
|
|
|
|
int gravity;
|
|
|
|
|
|
|
|
handled = FALSE;
|
|
|
|
|
|
|
|
/* don't care about releases, but eat them, don't end grab */
|
|
|
|
if (event->type == KeyRelease)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* don't end grab on modifier key presses */
|
|
|
|
if (is_modifier (display, event->xkey.keycode))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (keysym == XK_Escape)
|
|
|
|
{
|
2009-05-07 13:53:47 -04:00
|
|
|
/* End resize and restore to original state. */
|
|
|
|
meta_window_move_resize (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-02 22:22:00 -04:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process_keyboard_resize_grab_op_change (display, screen, window,
|
|
|
|
event, keysym))
|
|
|
|
return TRUE;
|
|
|
|
|
2009-05-07 13:53:47 -04:00
|
|
|
width = window->rect.width;
|
|
|
|
height = window->rect.height;
|
2002-06-19 00:12:49 -04:00
|
|
|
|
|
|
|
gravity = meta_resize_gravity_from_grab_op (display->grab_op);
|
|
|
|
|
2003-10-12 02:25:38 -04:00
|
|
|
smart_snap = (event->xkey.state & ShiftMask) != 0;
|
|
|
|
|
2002-06-19 00:12:49 -04:00
|
|
|
#define SMALL_INCREMENT 1
|
|
|
|
#define NORMAL_INCREMENT 10
|
|
|
|
|
|
|
|
if (smart_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 09:58:50 -05:00
|
|
|
height_inc = 1;
|
|
|
|
width_inc = 1;
|
2002-06-19 00:12:49 -04:00
|
|
|
}
|
|
|
|
else if (event->xkey.state & ControlMask)
|
|
|
|
{
|
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 09:58:50 -05:00
|
|
|
width_inc = SMALL_INCREMENT;
|
|
|
|
height_inc = SMALL_INCREMENT;
|
2002-06-19 00:12:49 -04: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 09:58:50 -05:00
|
|
|
width_inc = NORMAL_INCREMENT;
|
|
|
|
height_inc = NORMAL_INCREMENT;
|
2002-06-19 00:12:49 -04: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 09:58:50 -05: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 00:12:49 -04: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 09:58:50 -05: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;
|
|
|
|
|
2002-06-19 00:12:49 -04:00
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
|
|
|
switch (gravity)
|
|
|
|
{
|
|
|
|
case NorthGravity:
|
|
|
|
case NorthWestGravity:
|
|
|
|
case NorthEastGravity:
|
|
|
|
/* 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 09:58:50 -05:00
|
|
|
height -= height_inc;
|
2002-06-19 00:12:49 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SouthGravity:
|
|
|
|
case SouthWestGravity:
|
|
|
|
case SouthEastGravity:
|
|
|
|
/* 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 09:58:50 -05:00
|
|
|
height += height_inc;
|
2002-06-19 00:12:49 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EastGravity:
|
|
|
|
case WestGravity:
|
|
|
|
case CenterGravity:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
|
|
|
switch (gravity)
|
|
|
|
{
|
|
|
|
case NorthGravity:
|
|
|
|
case NorthWestGravity:
|
|
|
|
case NorthEastGravity:
|
|
|
|
/* Move bottom edge down */
|
|
|
|
height += height_inc;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SouthGravity:
|
|
|
|
case SouthWestGravity:
|
|
|
|
case SouthEastGravity:
|
|
|
|
/* 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 09:58:50 -05:00
|
|
|
height -= height_inc;
|
2002-06-19 00:12:49 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EastGravity:
|
|
|
|
case WestGravity:
|
|
|
|
case CenterGravity:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XK_Left:
|
|
|
|
case XK_KP_Left:
|
2002-07-02 22:32:40 -04:00
|
|
|
switch (gravity)
|
|
|
|
{
|
|
|
|
case EastGravity:
|
|
|
|
case SouthEastGravity:
|
|
|
|
case NorthEastGravity:
|
2005-08-02 22:22:00 -04: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 09:58:50 -05:00
|
|
|
width += width_inc;
|
2002-07-02 22:32:40 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WestGravity:
|
|
|
|
case SouthWestGravity:
|
|
|
|
case NorthWestGravity:
|
|
|
|
/* 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 09:58:50 -05:00
|
|
|
width -= width_inc;
|
2002-07-02 22:32:40 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NorthGravity:
|
|
|
|
case SouthGravity:
|
|
|
|
case CenterGravity:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
handled = TRUE;
|
2002-06-19 00:12:49 -04:00
|
|
|
break;
|
2002-07-02 22:32:40 -04:00
|
|
|
|
2002-06-19 00:12:49 -04:00
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
2002-07-02 22:32:40 -04:00
|
|
|
switch (gravity)
|
|
|
|
{
|
|
|
|
case EastGravity:
|
|
|
|
case SouthEastGravity:
|
|
|
|
case NorthEastGravity:
|
|
|
|
/* 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 09:58:50 -05:00
|
|
|
width -= width_inc;
|
2002-07-02 22:32:40 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WestGravity:
|
|
|
|
case SouthWestGravity:
|
|
|
|
case NorthWestGravity:
|
|
|
|
/* Move right edge right */
|
|
|
|
width += width_inc;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NorthGravity:
|
|
|
|
case SouthGravity:
|
|
|
|
case CenterGravity:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
handled = TRUE;
|
2002-06-19 00:12:49 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fixup hack (just paranoia, not sure it's required) */
|
|
|
|
if (height < 1)
|
|
|
|
height = 1;
|
|
|
|
if (width < 1)
|
|
|
|
width = 1;
|
|
|
|
|
|
|
|
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 00:27:23 -04: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 09:58:50 -05:00
|
|
|
MetaRectangle old_rect;
|
2003-10-12 02:25:38 -04: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 09:58:50 -05:00
|
|
|
"Computed new window size due to keypress: "
|
|
|
|
"%dx%d, gravity %s\n",
|
|
|
|
width, height, meta_gravity_to_string (gravity));
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2009-05-07 13:53:47 -04:00
|
|
|
old_rect = window->rect; /* Don't actually care about 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 09:58:50 -05:00
|
|
|
|
|
|
|
/* Do any edge resistance/snapping */
|
|
|
|
meta_window_edge_resistance_for_resize (window,
|
|
|
|
old_rect.width,
|
|
|
|
old_rect.height,
|
|
|
|
&width,
|
|
|
|
&height,
|
|
|
|
gravity,
|
|
|
|
NULL,
|
|
|
|
smart_snap,
|
|
|
|
TRUE);
|
|
|
|
|
2009-05-07 13:53:47 -04:00
|
|
|
/* We don't need to update unless the specified width and height
|
|
|
|
* are actually different from what we had before.
|
|
|
|
*/
|
|
|
|
if (window->rect.width != width || window->rect.height != height)
|
|
|
|
meta_window_resize_with_gravity (window,
|
|
|
|
TRUE,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
gravity);
|
|
|
|
|
2003-10-12 02:25:38 -04: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 00:27:23 -04:00
|
|
|
}
|
2002-06-19 00:12:49 -04:00
|
|
|
|
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2004-10-20 19:16:08 -04:00
|
|
|
static gboolean
|
|
|
|
end_keyboard_grab (MetaDisplay *display,
|
|
|
|
unsigned int keycode)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_XKB
|
|
|
|
if (display->xkb_base_event_type > 0)
|
|
|
|
{
|
|
|
|
unsigned int primary_modifier;
|
|
|
|
XkbStateRec state;
|
|
|
|
|
|
|
|
primary_modifier = get_primary_modifier (display, display->grab_mask);
|
|
|
|
|
|
|
|
XkbGetState (display->xdisplay, XkbUseCoreKbd, &state);
|
|
|
|
|
|
|
|
if (!(primary_modifier & state.mods))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
if (keycode_is_primary_modifier (display, keycode, display->grab_mask))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
static gboolean
|
|
|
|
process_tab_grab (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2001-08-19 14:09:10 -04:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
|
|
|
{
|
2009-08-25 16:54:54 -04:00
|
|
|
MetaKeyBinding *binding;
|
2002-06-08 23:44:16 -04:00
|
|
|
MetaKeyBindingAction action;
|
2002-07-06 12:50:48 -04:00
|
|
|
gboolean popup_not_showing;
|
2002-10-18 18:19:05 -04:00
|
|
|
gboolean backward;
|
|
|
|
gboolean key_used;
|
2006-02-13 14:26:40 -05:00
|
|
|
MetaWindow *prev_window;
|
2002-10-16 16:12:24 -04:00
|
|
|
|
2009-02-03 08:23:08 -05:00
|
|
|
if (screen != display->grab_screen)
|
2002-10-16 16:12:24 -04:00
|
|
|
return FALSE;
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
binding = display_get_keybinding (display,
|
|
|
|
keysym,
|
|
|
|
event->xkey.keycode,
|
|
|
|
display->grab_mask);
|
|
|
|
if (binding)
|
|
|
|
action = meta_prefs_get_keybinding_action (binding->name);
|
|
|
|
else
|
|
|
|
action = META_KEYBINDING_ACTION_NONE;
|
2009-02-03 08:23:08 -05:00
|
|
|
|
|
|
|
/*
|
2009-09-23 21:27:42 -04:00
|
|
|
* If there is no tab_pop up object, i.e., there is some custom handler
|
|
|
|
* implementing Alt+Tab & Co., we call this custom handler; we do not
|
|
|
|
* mess about with the grab, as that is up to the handler to deal with.
|
2009-02-03 08:23:08 -05:00
|
|
|
*/
|
2009-09-23 21:27:42 -04:00
|
|
|
if (!screen->tab_popup)
|
2009-02-03 08:23:08 -05:00
|
|
|
{
|
2009-08-25 16:54:54 -04:00
|
|
|
if (event->type == KeyRelease)
|
|
|
|
{
|
|
|
|
if (end_keyboard_grab (display, event->xkey.keycode))
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
invoke_handler_by_name (display, screen, "tab-popup-select", NULL, event);
|
2009-08-25 16:54:54 -04:00
|
|
|
|
|
|
|
/* We return FALSE to end the grab; if the handler ended the grab itself
|
|
|
|
* that will be a noop. If the handler didn't end the grab, then it's a
|
|
|
|
* safety measure to prevent a stuck grab.
|
|
|
|
*/
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2009-02-03 08:23:08 -05:00
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD:
|
2009-08-25 16:54:54 -04:00
|
|
|
/* These are the tab-popup bindings. If a custom Alt-Tab implementation
|
|
|
|
* is in effect, we expect it to want to handle all of these as a group
|
|
|
|
*
|
|
|
|
* If there are some of them that the custom implementation didn't
|
|
|
|
* handle, we treat them as "unbound" for the duration - running the
|
|
|
|
* normal handlers could get us into trouble.
|
|
|
|
*/
|
|
|
|
if (binding->handler &&
|
|
|
|
binding->handler->func &&
|
|
|
|
binding->handler->func != binding->handler->default_func)
|
|
|
|
{
|
|
|
|
invoke_handler (display, screen, binding->handler, NULL, event, binding);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2009-02-03 08:23:08 -05:00
|
|
|
break;
|
2010-02-04 02:53:01 -05:00
|
|
|
case META_KEYBINDING_ACTION_NONE:
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* If this is simply user pressing the Shift key, we do not want
|
|
|
|
* to cancel the grab.
|
|
|
|
*/
|
|
|
|
if (is_modifier (display, event->xkey.keycode))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-02-03 08:23:08 -05:00
|
|
|
default:
|
2009-08-25 16:54:54 -04:00
|
|
|
break;
|
2009-02-03 08:23:08 -05:00
|
|
|
}
|
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
/* Some unhandled key press */
|
2011-06-24 12:14:15 -04:00
|
|
|
invoke_handler_by_name (display, screen, "tab-popup-cancel", NULL, event);
|
2009-08-25 16:54:54 -04:00
|
|
|
return FALSE;
|
2009-02-03 08:23:08 -05:00
|
|
|
}
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
if (event->type == KeyRelease &&
|
2004-10-20 19:16:08 -04:00
|
|
|
end_keyboard_grab (display, event->xkey.keycode))
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
2001-08-19 14:09:10 -04:00
|
|
|
/* We're done, move to the new window. */
|
|
|
|
MetaWindow *target_window;
|
|
|
|
|
2009-04-27 11:19:08 -04:00
|
|
|
target_window = meta_screen_tab_popup_get_selected (screen);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ending tab operation, primary modifier released\n");
|
2001-08-19 14:09:10 -04:00
|
|
|
|
|
|
|
if (target_window)
|
|
|
|
{
|
2005-10-03 16:02:31 -04:00
|
|
|
target_window->tab_unminimized = FALSE;
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Activating target window\n");
|
2001-10-29 02:00:46 -05:00
|
|
|
|
2005-02-21 21:11:25 -05:00
|
|
|
meta_topic (META_DEBUG_FOCUS, "Activating %s due to tab popup "
|
|
|
|
"selection and turning mouse_mode off\n",
|
2002-01-03 18:28:19 -05:00
|
|
|
target_window->desc);
|
2005-02-21 21:11:25 -05:00
|
|
|
display->mouse_mode = FALSE;
|
2001-10-29 02:00:46 -05:00
|
|
|
meta_window_activate (target_window, event->xkey.time);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2003-07-01 10:59:09 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ending grab early so we can focus the target window\n");
|
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
return TRUE; /* we already ended the grab */
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE; /* end grab */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* don't care about other releases, but eat them, don't end grab */
|
|
|
|
if (event->type == KeyRelease)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* don't end grab on modifier key presses */
|
|
|
|
if (is_modifier (display, event->xkey.keycode))
|
|
|
|
return TRUE;
|
|
|
|
|
2009-04-27 11:19:08 -04:00
|
|
|
prev_window = meta_screen_tab_popup_get_selected (screen);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2006-02-13 14:16:32 -05:00
|
|
|
/* Cancel when alt-Escape is pressed during using alt-Tab, and vice
|
|
|
|
* versa.
|
2002-07-06 12:50:48 -04:00
|
|
|
*/
|
2006-02-13 14:16:32 -05:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD:
|
|
|
|
/* CYCLE_* are traditionally Escape-based actions,
|
|
|
|
* and should cancel traditionally Tab-based ones.
|
|
|
|
*/
|
2006-04-14 22:05:44 -04:00
|
|
|
switch (display->grab_op)
|
2006-02-13 14:16:32 -05:00
|
|
|
{
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
|
|
|
|
/* carry on */
|
|
|
|
break;
|
|
|
|
default:
|
2006-02-13 14:16:32 -05:00
|
|
|
return FALSE;
|
|
|
|
}
|
2006-04-14 22:05:44 -04:00
|
|
|
break;
|
2006-02-13 14:16:32 -05:00
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD:
|
|
|
|
/* SWITCH_* are traditionally Tab-based actions,
|
|
|
|
* and should cancel traditionally Escape-based ones.
|
|
|
|
*/
|
2006-04-14 22:05:44 -04:00
|
|
|
switch (display->grab_op)
|
2006-02-13 14:16:32 -05:00
|
|
|
{
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
|
|
|
/* carry on */
|
|
|
|
break;
|
|
|
|
default:
|
2006-02-13 14:16:32 -05:00
|
|
|
/* Also, we must re-lower and re-minimize whatever window
|
|
|
|
* we'd previously raised and unminimized.
|
|
|
|
*/
|
|
|
|
meta_stack_set_positions (screen->stack,
|
|
|
|
screen->display->grab_old_window_stacking);
|
|
|
|
if (prev_window && prev_window->tab_unminimized)
|
|
|
|
{
|
|
|
|
meta_window_minimize (prev_window);
|
|
|
|
prev_window->tab_unminimized = FALSE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD:
|
|
|
|
switch (display->grab_op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
|
|
|
|
/* carry on */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2006-02-13 14:16:32 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2008-06-10 09:46:41 -04:00
|
|
|
|
|
|
|
/* !! TO HERE !!
|
|
|
|
* alt-f6 during alt-{Tab,Escape} does not end the grab
|
|
|
|
* but does change the grab op (and redraws the window,
|
|
|
|
* of course).
|
|
|
|
* See _{SWITCH,CYCLE}_GROUP.@@@
|
|
|
|
*/
|
2006-02-13 14:16:32 -05:00
|
|
|
|
2002-07-06 12:50:48 -04:00
|
|
|
popup_not_showing = FALSE;
|
2002-10-18 18:19:05 -04:00
|
|
|
key_used = FALSE;
|
|
|
|
backward = FALSE;
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
switch (action)
|
2001-08-19 14:09:10 -04:00
|
|
|
{
|
2002-07-06 12:50:48 -04:00
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS:
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP:
|
2002-07-06 12:50:48 -04:00
|
|
|
popup_not_showing = TRUE;
|
2002-10-18 18:19:05 -04:00
|
|
|
key_used = TRUE;
|
|
|
|
break;
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD:
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD:
|
2002-10-18 18:19:05 -04:00
|
|
|
popup_not_showing = TRUE;
|
|
|
|
key_used = TRUE;
|
|
|
|
backward = TRUE;
|
|
|
|
break;
|
2002-06-08 23:44:16 -04:00
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS:
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP:
|
2002-10-18 18:19:05 -04:00
|
|
|
key_used = TRUE;
|
|
|
|
break;
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD:
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD:
|
2002-10-18 18:19:05 -04:00
|
|
|
key_used = TRUE;
|
|
|
|
backward = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key_used)
|
|
|
|
{
|
2002-07-06 12:50:48 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Key pressed, moving tab focus in popup\n");
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
if (event->xkey.state & ShiftMask)
|
2002-10-18 18:19:05 -04:00
|
|
|
backward = !backward;
|
|
|
|
|
|
|
|
if (backward)
|
2009-04-27 11:19:08 -04:00
|
|
|
meta_screen_tab_popup_backward (screen);
|
2001-08-19 14:09:10 -04:00
|
|
|
else
|
2009-04-27 11:19:08 -04:00
|
|
|
meta_screen_tab_popup_forward (screen);
|
2002-10-18 18:19:05 -04:00
|
|
|
|
2002-07-06 12:50:48 -04:00
|
|
|
if (popup_not_showing)
|
|
|
|
{
|
|
|
|
/* We can't actually change window focus, due to the grab.
|
|
|
|
* but raise the window.
|
|
|
|
*/
|
|
|
|
MetaWindow *target_window;
|
2005-10-03 16:05:44 -04:00
|
|
|
|
|
|
|
meta_stack_set_positions (screen->stack,
|
|
|
|
display->grab_old_window_stacking);
|
|
|
|
|
2009-04-27 11:19:08 -04:00
|
|
|
target_window = meta_screen_tab_popup_get_selected (screen);
|
2002-07-06 12:50:48 -04:00
|
|
|
|
2005-10-03 16:02:31 -04:00
|
|
|
if (prev_window && prev_window->tab_unminimized)
|
|
|
|
{
|
|
|
|
prev_window->tab_unminimized = FALSE;
|
|
|
|
meta_window_minimize (prev_window);
|
|
|
|
}
|
|
|
|
|
2002-07-06 12:50:48 -04:00
|
|
|
if (target_window)
|
|
|
|
{
|
|
|
|
meta_window_raise (target_window);
|
2005-10-03 16:02:31 -04:00
|
|
|
target_window->tab_unminimized = target_window->minimized;
|
|
|
|
meta_window_unminimize (target_window);
|
2002-07-06 12:50:48 -04:00
|
|
|
}
|
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
2002-10-18 18:19:05 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* end grab */
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ending tabbing/cycling, uninteresting key pressed\n");
|
2005-01-24 00:58:30 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Syncing to old stack positions.\n");
|
|
|
|
meta_stack_set_positions (screen->stack,
|
|
|
|
screen->display->grab_old_window_stacking);
|
2005-10-03 16:02:31 -04:00
|
|
|
|
|
|
|
if (prev_window && prev_window->tab_unminimized)
|
|
|
|
{
|
|
|
|
meta_window_minimize (prev_window);
|
|
|
|
prev_window->tab_unminimized = FALSE;
|
|
|
|
}
|
2002-10-18 18:19:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return key_used;
|
2001-06-23 01:49:35 -04:00
|
|
|
}
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
static void
|
2008-10-05 20:24:07 -04:00
|
|
|
handle_switch_to_workspace (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2008-10-05 20:24:07 -04:00
|
|
|
gint which = binding->handler->data;
|
2001-06-06 00:47:37 -04:00
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
if (which < 0)
|
2001-08-03 09:56:39 -04:00
|
|
|
{
|
2008-10-05 20:24:07 -04:00
|
|
|
/* Negative workspace numbers are directions with respect to the
|
|
|
|
* current workspace. While we could insta-switch here by setting
|
|
|
|
* workspace to the result of meta_workspace_get_neighbor(), when
|
|
|
|
* people request a workspace switch to the left or right via
|
|
|
|
* the keyboard, they actually want a tab popup. So we should
|
|
|
|
* go there instead.
|
|
|
|
*
|
|
|
|
* Note that we're the only caller of that function, so perhaps
|
|
|
|
* we should merge with it.
|
|
|
|
*/
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_workspace_switch (display, screen, event_window, event, binding,
|
|
|
|
dummy);
|
2008-10-05 20:24:07 -04:00
|
|
|
return;
|
2001-08-03 09:56:39 -04:00
|
|
|
}
|
2008-10-05 20:24:07 -04:00
|
|
|
|
|
|
|
workspace = meta_screen_get_workspace_by_index (screen, which);
|
2001-08-03 09:56:39 -04:00
|
|
|
|
|
|
|
if (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 16:32:59 -04:00
|
|
|
meta_workspace_activate (workspace, event->xkey.time);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We could offer to create it I suppose */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-08 16:09:05 -05:00
|
|
|
|
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_maximize_vertically (MetaDisplay *display,
|
2002-12-08 16:09:05 -05:00
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-12-08 16:09:05 -05:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->has_resize_func)
|
2002-12-08 16:09:05 -05: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 09:58:50 -05:00
|
|
|
if (window->maximized_vertically)
|
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
|
|
|
|
else
|
|
|
|
meta_window_maximize (window, META_MAXIMIZE_VERTICAL);
|
2002-12-08 16:09:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_maximize_horizontally (MetaDisplay *display,
|
2002-12-08 16:09:05 -05:00
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-12-08 16:09:05 -05:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->has_resize_func)
|
2002-12-08 16:09:05 -05: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 09:58:50 -05:00
|
|
|
if (window->maximized_horizontally)
|
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
|
|
|
|
else
|
|
|
|
meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL);
|
2002-12-08 16:09:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-05 17:23:44 -05:00
|
|
|
/* Move a window to a corner; to_bottom/to_right are FALSE for the
|
|
|
|
* top or left edge, or TRUE for the bottom/right edge. xchange/ychange
|
|
|
|
* are FALSE if that dimension is not to be changed, TRUE otherwise.
|
|
|
|
* Together they describe which of the four corners, or four sides,
|
|
|
|
* is desired.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
handle_move_to_corner_backend (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
gboolean xchange,
|
|
|
|
gboolean ychange,
|
|
|
|
gboolean to_right,
|
2009-01-29 09:53:03 -05:00
|
|
|
gboolean to_bottom,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
|
|
|
MetaRectangle work_area;
|
|
|
|
MetaRectangle outer;
|
|
|
|
int orig_x, orig_y;
|
|
|
|
int new_x, new_y;
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_window_get_work_area_all_monitors (window, &work_area);
|
2006-11-05 17:23:44 -05:00
|
|
|
meta_window_get_outer_rect (window, &outer);
|
|
|
|
meta_window_get_position (window, &orig_x, &orig_y);
|
|
|
|
|
|
|
|
if (xchange) {
|
|
|
|
new_x = work_area.x + (to_right ?
|
2012-03-12 15:40:12 -04:00
|
|
|
work_area.width - outer.width :
|
2006-11-05 17:23:44 -05:00
|
|
|
0);
|
|
|
|
} else {
|
|
|
|
new_x = orig_x;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ychange) {
|
|
|
|
new_y = work_area.y + (to_bottom ?
|
2012-03-12 15:40:12 -04:00
|
|
|
work_area.height - outer.height :
|
2006-11-05 17:23:44 -05:00
|
|
|
0);
|
|
|
|
} else {
|
|
|
|
new_y = orig_y;
|
|
|
|
}
|
|
|
|
|
2012-03-12 15:40:12 -04:00
|
|
|
meta_window_move_frame (window,
|
|
|
|
TRUE,
|
|
|
|
new_x,
|
|
|
|
new_y);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_corner_nw (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, FALSE, FALSE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_corner_ne (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, TRUE, FALSE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_corner_sw (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, FALSE, TRUE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_corner_se (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, TRUE, TRUE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_side_n (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, FALSE, TRUE, FALSE, FALSE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_side_s (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, FALSE, TRUE, FALSE, TRUE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_side_e (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, TRUE, FALSE, TRUE, FALSE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_move_to_side_w (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2006-11-05 17:23:44 -05:00
|
|
|
{
|
2009-01-29 09:53:03 -05:00
|
|
|
handle_move_to_corner_backend (display, screen, window, TRUE, FALSE, FALSE, FALSE, dummy);
|
2006-11-05 17:23:44 -05:00
|
|
|
}
|
|
|
|
|
2008-08-31 21:32:39 -04:00
|
|
|
static void
|
|
|
|
handle_move_to_center (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2008-08-31 21:32:39 -04:00
|
|
|
{
|
|
|
|
MetaRectangle work_area;
|
|
|
|
MetaRectangle outer;
|
|
|
|
int orig_x, orig_y;
|
|
|
|
int frame_width, frame_height;
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_window_get_work_area_all_monitors (window, &work_area);
|
2008-08-31 21:32:39 -04:00
|
|
|
meta_window_get_outer_rect (window, &outer);
|
|
|
|
meta_window_get_position (window, &orig_x, &orig_y);
|
|
|
|
|
|
|
|
frame_width = (window->frame ? window->frame->child_x : 0);
|
|
|
|
frame_height = (window->frame ? window->frame->child_y : 0);
|
|
|
|
|
|
|
|
meta_window_move_resize (window,
|
|
|
|
TRUE,
|
|
|
|
work_area.x + (work_area.width +frame_width -outer.width )/2,
|
|
|
|
work_area.y + (work_area.height+frame_height-outer.height)/2,
|
|
|
|
window->rect.width,
|
|
|
|
window->rect.height);
|
|
|
|
}
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
static gboolean
|
2002-06-09 00:04:19 -04:00
|
|
|
process_workspace_switch_grab (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-06-09 00:04:19 -04:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
2009-04-27 10:49:03 -04:00
|
|
|
if (screen != display->grab_screen || !screen->ws_popup)
|
2002-10-16 16:12:24 -04:00
|
|
|
return FALSE;
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
|
|
if (event->type == KeyRelease &&
|
2004-10-20 19:16:08 -04:00
|
|
|
end_keyboard_grab (display, event->xkey.keycode))
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
|
|
|
/* We're done, move to the new workspace. */
|
|
|
|
MetaWorkspace *target_workspace;
|
|
|
|
|
2009-04-27 11:19:08 -04:00
|
|
|
target_workspace = meta_screen_workspace_popup_get_selected (screen);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ending workspace tab operation, primary modifier released\n");
|
2004-09-22 15:15:26 -04:00
|
|
|
|
|
|
|
if (target_workspace == screen->active_workspace)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2004-09-22 15:15:26 -04:00
|
|
|
"Ending grab so we can focus on the target workspace\n");
|
2002-06-08 23:44:16 -04:00
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2004-09-22 15:15:26 -04:00
|
|
|
"Focusing default window on target workspace\n");
|
2002-06-08 23:44:16 -04:00
|
|
|
|
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 16:32:59 -04:00
|
|
|
meta_workspace_focus_default_window (target_workspace,
|
|
|
|
NULL,
|
|
|
|
event->xkey.time);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
|
|
return TRUE; /* we already ended the grab */
|
|
|
|
}
|
2004-09-22 15:15:26 -04:00
|
|
|
|
|
|
|
/* Workspace switching should have already occurred on KeyPress */
|
|
|
|
meta_warning ("target_workspace != active_workspace. Some other event must have occurred.\n");
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
|
|
return FALSE; /* end grab */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* don't care about other releases, but eat them, don't end grab */
|
|
|
|
if (event->type == KeyRelease)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* don't end grab on modifier key presses */
|
|
|
|
if (is_modifier (display, event->xkey.keycode))
|
|
|
|
return TRUE;
|
|
|
|
|
2009-04-27 11:19:08 -04:00
|
|
|
/* select the next workspace in the popup */
|
|
|
|
workspace = meta_screen_workspace_popup_get_selected (screen);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
|
|
if (workspace)
|
|
|
|
{
|
|
|
|
MetaWorkspace *target_workspace;
|
|
|
|
MetaKeyBindingAction action;
|
|
|
|
|
2010-03-16 18:05:13 -04:00
|
|
|
action = meta_display_get_keybinding_action (display,
|
|
|
|
event->xkey.keycode,
|
|
|
|
display->grab_mask);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case META_KEYBINDING_ACTION_WORKSPACE_UP:
|
|
|
|
target_workspace = meta_workspace_get_neighbor (workspace,
|
|
|
|
META_MOTION_UP);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_KEYBINDING_ACTION_WORKSPACE_DOWN:
|
|
|
|
target_workspace = meta_workspace_get_neighbor (workspace,
|
|
|
|
META_MOTION_DOWN);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_KEYBINDING_ACTION_WORKSPACE_LEFT:
|
|
|
|
target_workspace = meta_workspace_get_neighbor (workspace,
|
|
|
|
META_MOTION_LEFT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_KEYBINDING_ACTION_WORKSPACE_RIGHT:
|
|
|
|
target_workspace = meta_workspace_get_neighbor (workspace,
|
|
|
|
META_MOTION_RIGHT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
target_workspace = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (target_workspace)
|
|
|
|
{
|
2009-04-27 11:19:08 -04:00
|
|
|
meta_screen_workspace_popup_select (screen, target_workspace);
|
2002-06-08 23:44:16 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Tab key pressed, moving tab focus in popup\n");
|
2002-09-09 14:16:25 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Activating target workspace\n");
|
|
|
|
|
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 16:32:59 -04:00
|
|
|
meta_workspace_activate (target_workspace, event->xkey.time);
|
2002-09-09 14:16:25 -04:00
|
|
|
|
|
|
|
return TRUE; /* we already ended the grab */
|
2002-06-08 23:44:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end grab */
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2004-09-22 15:15:26 -04:00
|
|
|
"Ending workspace tabbing & focusing default window; uninteresting key pressed\n");
|
2009-04-27 11:19:08 -04:00
|
|
|
workspace = meta_screen_workspace_popup_get_selected (screen);
|
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 16:32:59 -04:00
|
|
|
meta_workspace_focus_default_window (workspace, NULL, event->xkey.time);
|
2002-06-08 23:44:16 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-10-14 23:39:41 -04:00
|
|
|
static void
|
2008-10-05 20:24:07 -04:00
|
|
|
handle_show_desktop (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-10-14 23:39:41 -04:00
|
|
|
{
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
if (screen->active_workspace->showing_desktop)
|
2003-05-16 17:59:08 -04:00
|
|
|
{
|
|
|
|
meta_screen_unshow_desktop (screen);
|
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 16:32:59 -04:00
|
|
|
meta_workspace_focus_default_window (screen->active_workspace,
|
|
|
|
NULL,
|
|
|
|
event->xkey.time);
|
2003-05-16 17:59:08 -04:00
|
|
|
}
|
2001-10-14 23:39:41 -04:00
|
|
|
else
|
2004-12-19 21:46:42 -05:00
|
|
|
meta_screen_show_desktop (screen, event->xkey.time);
|
2001-10-14 23:39:41 -04:00
|
|
|
}
|
|
|
|
|
2003-02-23 21:16:09 -05:00
|
|
|
static void
|
2008-10-05 20:24:07 -04:00
|
|
|
handle_panel (MetaDisplay *display,
|
2003-02-23 21:16:09 -05:00
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2003-02-23 21:16:09 -05:00
|
|
|
{
|
2008-10-05 20:24:07 -04:00
|
|
|
MetaKeyBindingAction action = binding->handler->data;
|
2003-02-23 21:16:09 -05:00
|
|
|
Atom action_atom;
|
|
|
|
XClientMessageEvent ev;
|
|
|
|
|
|
|
|
action_atom = None;
|
|
|
|
switch (action)
|
|
|
|
{
|
2008-10-05 20:24:07 -04:00
|
|
|
/* FIXME: The numbers are wrong */
|
2003-02-23 21:16:09 -05:00
|
|
|
case META_KEYBINDING_ACTION_PANEL_MAIN_MENU:
|
2008-05-02 14:49:01 -04:00
|
|
|
action_atom = display->atom__GNOME_PANEL_ACTION_MAIN_MENU;
|
2003-02-23 21:16:09 -05:00
|
|
|
break;
|
|
|
|
case META_KEYBINDING_ACTION_PANEL_RUN_DIALOG:
|
2008-05-02 14:49:01 -04:00
|
|
|
action_atom = display->atom__GNOME_PANEL_ACTION_RUN_DIALOG;
|
2003-02-23 21:16:09 -05:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ev.type = ClientMessage;
|
|
|
|
ev.window = screen->xroot;
|
2008-05-02 14:49:01 -04:00
|
|
|
ev.message_type = display->atom__GNOME_PANEL_ACTION;
|
2003-02-23 21:16:09 -05:00
|
|
|
ev.format = 32;
|
|
|
|
ev.data.l[0] = action_atom;
|
|
|
|
ev.data.l[1] = event->xkey.time;
|
|
|
|
|
2003-02-25 20:55:25 -05:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2007-04-03 16:19:12 -04:00
|
|
|
"Sending panel message with timestamp %lu, and turning mouse_mode "
|
|
|
|
"off due to keybinding press\n", event->xkey.time);
|
|
|
|
display->mouse_mode = FALSE;
|
2003-02-25 20:55:25 -05:00
|
|
|
|
2003-02-23 21:16:09 -05:00
|
|
|
meta_error_trap_push (display);
|
2003-02-25 20:55:25 -05:00
|
|
|
|
|
|
|
/* Release the grab for the panel before sending the event */
|
|
|
|
XUngrabKeyboard (display->xdisplay, event->xkey.time);
|
|
|
|
|
2003-02-23 21:16:09 -05:00
|
|
|
XSendEvent (display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
False,
|
|
|
|
StructureNotifyMask,
|
|
|
|
(XEvent*) &ev);
|
2003-02-25 20:55:25 -05:00
|
|
|
|
2010-10-25 14:44:30 -04:00
|
|
|
meta_error_trap_pop (display);
|
2003-02-23 21:16:09 -05:00
|
|
|
}
|
|
|
|
|
2001-06-23 01:49:35 -04:00
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_activate_window_menu (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-06-23 01:49:35 -04:00
|
|
|
{
|
|
|
|
if (display->focus_window)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
meta_window_get_position (display->focus_window,
|
|
|
|
&x, &y);
|
|
|
|
|
2007-05-25 10:36:12 -04:00
|
|
|
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
|
|
|
x += display->focus_window->rect.width;
|
|
|
|
|
2001-06-23 01:49:35 -04:00
|
|
|
meta_window_show_menu (display->focus_window,
|
|
|
|
x, y,
|
|
|
|
0,
|
|
|
|
event->xkey.time);
|
|
|
|
}
|
|
|
|
}
|
2001-06-23 22:22:10 -04:00
|
|
|
|
2002-04-05 10:52:49 -05:00
|
|
|
static MetaGrabOp
|
2002-07-06 12:50:48 -04:00
|
|
|
tab_op_from_tab_type (MetaTabList type)
|
2002-04-05 10:52:49 -05:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_TAB_LIST_NORMAL:
|
|
|
|
return META_GRAB_OP_KEYBOARD_TABBING_NORMAL;
|
|
|
|
case META_TAB_LIST_DOCKS:
|
|
|
|
return META_GRAB_OP_KEYBOARD_TABBING_DOCK;
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_TAB_LIST_GROUP:
|
|
|
|
return META_GRAB_OP_KEYBOARD_TABBING_GROUP;
|
2012-03-12 18:00:12 -04:00
|
|
|
case META_TAB_LIST_NORMAL_ALL:
|
|
|
|
break;
|
2002-04-05 10:52:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-06 12:50:48 -04:00
|
|
|
static MetaGrabOp
|
|
|
|
cycle_op_from_tab_type (MetaTabList type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_TAB_LIST_NORMAL:
|
|
|
|
return META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL;
|
|
|
|
case META_TAB_LIST_DOCKS:
|
|
|
|
return META_GRAB_OP_KEYBOARD_ESCAPING_DOCK;
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_TAB_LIST_GROUP:
|
|
|
|
return META_GRAB_OP_KEYBOARD_ESCAPING_GROUP;
|
2012-03-12 18:00:12 -04:00
|
|
|
case META_TAB_LIST_NORMAL_ALL:
|
|
|
|
break;
|
2002-07-06 12:50:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-06-23 22:22:10 -04:00
|
|
|
static void
|
2002-07-06 12:50:48 -04:00
|
|
|
do_choose_window (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-07-06 12:50:48 -04:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
2002-10-18 18:19:05 -04:00
|
|
|
gboolean backward,
|
2002-07-06 12:50:48 -04:00
|
|
|
gboolean show_popup)
|
2001-06-23 22:22:10 -04:00
|
|
|
{
|
2008-10-05 20:24:07 -04:00
|
|
|
MetaTabList type = binding->handler->data;
|
2002-09-04 00:15:46 -04:00
|
|
|
MetaWindow *initial_selection;
|
2008-10-05 20:24:07 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2006-01-20 17:03:56 -05:00
|
|
|
"Tab list = %u show_popup = %d\n", type, show_popup);
|
2002-10-16 16:12:24 -04:00
|
|
|
|
2002-10-18 18:19:05 -04:00
|
|
|
/* reverse direction if shift is down */
|
|
|
|
if (event->xkey.state & ShiftMask)
|
|
|
|
backward = !backward;
|
|
|
|
|
2002-09-04 00:15:46 -04:00
|
|
|
initial_selection = meta_display_get_tab_next (display,
|
|
|
|
type,
|
|
|
|
screen,
|
|
|
|
screen->active_workspace,
|
|
|
|
NULL,
|
|
|
|
backward);
|
2002-07-06 12:50:48 -04:00
|
|
|
|
2002-09-04 00:15:46 -04:00
|
|
|
/* Note that focus_window may not be in the tab chain, but it's OK */
|
|
|
|
if (initial_selection == NULL)
|
|
|
|
initial_selection = meta_display_get_tab_current (display,
|
|
|
|
type, screen,
|
|
|
|
screen->active_workspace);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Initially selecting window %s\n",
|
|
|
|
initial_selection ? initial_selection->desc : "(none)");
|
|
|
|
|
2009-04-27 09:27:31 -04:00
|
|
|
if (initial_selection == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (binding->mask == 0)
|
2002-10-18 18:19:05 -04:00
|
|
|
{
|
2009-04-27 09:27:31 -04:00
|
|
|
/* If no modifiers, we can't do the "hold down modifier to keep
|
|
|
|
* moving" thing, so we just instaswitch by one window.
|
|
|
|
*/
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Activating %s and turning off mouse_mode due to "
|
|
|
|
"switch/cycle windows with no modifiers\n",
|
|
|
|
initial_selection->desc);
|
|
|
|
display->mouse_mode = FALSE;
|
|
|
|
meta_window_activate (initial_selection, event->xkey.time);
|
|
|
|
return;
|
|
|
|
}
|
2009-02-02 09:09:04 -05:00
|
|
|
|
2009-04-27 09:27:31 -04:00
|
|
|
if (meta_prefs_get_no_tab_popup ())
|
|
|
|
{
|
|
|
|
/* FIXME? Shouldn't this be merged with the previous case? */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!meta_display_begin_grab_op (display,
|
|
|
|
screen,
|
|
|
|
NULL,
|
|
|
|
show_popup ?
|
|
|
|
tab_op_from_tab_type (type) :
|
|
|
|
cycle_op_from_tab_type (type),
|
|
|
|
FALSE,
|
|
|
|
FALSE,
|
|
|
|
0,
|
|
|
|
binding->mask,
|
|
|
|
event->xkey.time,
|
|
|
|
0, 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!primary_modifier_still_pressed (display, binding->mask))
|
|
|
|
{
|
|
|
|
/* This handles a race where modifier might be released before
|
|
|
|
* we establish the grab. must end grab prior to trying to focus
|
|
|
|
* a window.
|
|
|
|
*/
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Ending grab, activating %s, and turning off "
|
|
|
|
"mouse_mode due to switch/cycle windows where "
|
|
|
|
"modifier was released prior to grab\n",
|
|
|
|
initial_selection->desc);
|
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
|
|
|
display->mouse_mode = FALSE;
|
|
|
|
meta_window_activate (initial_selection, event->xkey.time);
|
|
|
|
return;
|
2001-06-23 23:41:44 -04:00
|
|
|
}
|
2009-04-27 09:27:31 -04:00
|
|
|
|
2009-04-28 09:32:18 -04:00
|
|
|
meta_screen_tab_popup_create (screen, type,
|
2009-04-27 10:01:30 -04:00
|
|
|
show_popup ? META_TAB_SHOW_ICON :
|
2009-04-27 11:19:08 -04:00
|
|
|
META_TAB_SHOW_INSTANTLY,
|
|
|
|
initial_selection);
|
2009-04-27 10:01:30 -04:00
|
|
|
|
2009-04-27 11:19:08 -04:00
|
|
|
if (!show_popup)
|
2009-04-27 09:27:31 -04:00
|
|
|
{
|
|
|
|
meta_window_raise (initial_selection);
|
|
|
|
initial_selection->tab_unminimized =
|
|
|
|
initial_selection->minimized;
|
|
|
|
meta_window_unminimize (initial_selection);
|
2009-02-02 10:28:26 -05:00
|
|
|
}
|
2001-06-23 22:22:10 -04:00
|
|
|
}
|
2001-06-23 23:18:10 -04:00
|
|
|
|
2002-07-06 12:50:48 -04:00
|
|
|
static void
|
2008-10-05 20:24:07 -04:00
|
|
|
handle_switch (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-07-06 12:50:48 -04:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2001-06-23 23:18:10 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
gint backwards = (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0;
|
2002-10-18 18:19:05 -04:00
|
|
|
|
2008-10-05 20:24:07 -04:00
|
|
|
do_choose_window (display, screen, event_window, event, binding,
|
|
|
|
backwards, TRUE);
|
2002-06-08 23:44:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-05 20:24:07 -04:00
|
|
|
handle_cycle (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
gint backwards = (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0;
|
2002-10-18 18:19:05 -04:00
|
|
|
|
2008-10-05 20:24:07 -04:00
|
|
|
do_choose_window (display, screen, event_window, event, binding,
|
|
|
|
backwards, FALSE);
|
2001-06-23 23:18:10 -04:00
|
|
|
}
|
2002-01-10 22:31:14 -05:00
|
|
|
|
2009-08-25 16:54:54 -04:00
|
|
|
static void
|
|
|
|
handle_tab_popup_select (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
|
|
|
/* Stub for custom handlers; no default implementation */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_tab_popup_cancel (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
|
|
|
/* Stub for custom handlers; no default implementation */
|
|
|
|
}
|
2008-10-05 20:24:07 -04:00
|
|
|
|
2002-04-05 10:52:49 -05:00
|
|
|
static void
|
2002-04-28 00:52:26 -04:00
|
|
|
handle_toggle_fullscreen (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-05 10:52:49 -05:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->fullscreen)
|
|
|
|
meta_window_unmake_fullscreen (window);
|
|
|
|
else if (window->has_fullscreen_func)
|
|
|
|
meta_window_make_fullscreen (window);
|
2002-04-05 10:52:49 -05:00
|
|
|
}
|
2002-01-10 22:31:14 -05:00
|
|
|
|
2003-06-27 10:49:56 -04:00
|
|
|
static void
|
|
|
|
handle_toggle_above (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2003-06-27 10:49:56 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->wm_state_above)
|
|
|
|
meta_window_unmake_above (window);
|
|
|
|
else
|
|
|
|
meta_window_make_above (window);
|
2003-06-27 10:49:56 -04:00
|
|
|
}
|
|
|
|
|
2011-11-15 11:29:56 -05:00
|
|
|
static void
|
|
|
|
handle_toggle_tiled (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
|
|
|
{
|
|
|
|
MetaTileMode mode = binding->handler->data;
|
|
|
|
|
|
|
|
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
|
|
|
|
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
|
|
|
|
{
|
|
|
|
window->tile_monitor_number = window->saved_maximize ? window->monitor->number
|
|
|
|
: -1;
|
|
|
|
window->tile_mode = window->saved_maximize ? META_TILE_MAXIMIZED
|
|
|
|
: META_TILE_NONE;
|
|
|
|
|
|
|
|
if (window->saved_maximize)
|
|
|
|
meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
|
|
|
|
META_MAXIMIZE_HORIZONTAL);
|
|
|
|
else
|
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
|
|
|
|
META_MAXIMIZE_HORIZONTAL);
|
|
|
|
}
|
|
|
|
else if (meta_window_can_tile_side_by_side (window))
|
|
|
|
{
|
|
|
|
window->tile_monitor_number = window->monitor->number;
|
|
|
|
window->tile_mode = mode;
|
|
|
|
/* 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.
|
2011-12-13 09:42:39 -05:00
|
|
|
*/
|
2011-11-15 11:29:56 -05:00
|
|
|
window->maximized_horizontally = FALSE;
|
|
|
|
meta_window_tile (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-10 22:31:14 -05:00
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_toggle_maximized (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (META_WINDOW_MAXIMIZED (window))
|
|
|
|
meta_window_unmaximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
|
|
|
else if (window->has_maximize_func)
|
|
|
|
meta_window_maximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2002-08-21 02:47:16 -04:00
|
|
|
static void
|
|
|
|
handle_maximize (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-08-21 02:47:16 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-21 02:47:16 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->has_maximize_func)
|
|
|
|
meta_window_maximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2002-08-21 02:47:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_unmaximize (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-08-21 02:47:16 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-21 02:47:16 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->maximized_vertically || window->maximized_horizontally)
|
|
|
|
meta_window_unmaximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2002-08-21 02:47:16 -04:00
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_toggle_shaded (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->shaded)
|
|
|
|
meta_window_unshade (window, event->xkey.time);
|
|
|
|
else if (window->has_shade_func)
|
|
|
|
meta_window_shade (window, event->xkey.time);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_close (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->has_close_func)
|
|
|
|
meta_window_delete (window, event->xkey.time);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2002-05-24 22:30:00 -04:00
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_minimize (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-05-24 22:30:00 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-05-24 22:30:00 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->has_minimize_func)
|
|
|
|
meta_window_minimize (window);
|
2002-05-24 22:30:00 -04:00
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static void
|
|
|
|
handle_begin_move (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->has_move_func)
|
2002-04-28 00:52:26 -04: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 00:27:23 -04:00
|
|
|
meta_window_begin_grab_op (window,
|
|
|
|
META_GRAB_OP_KEYBOARD_MOVING,
|
2006-10-12 20:28:34 -04:00
|
|
|
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 00:27:23 -04:00
|
|
|
event->xkey.time);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_begin_resize (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->has_resize_func)
|
2002-07-09 23:51:01 -04: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 00:27:23 -04:00
|
|
|
meta_window_begin_grab_op (window,
|
|
|
|
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
|
2006-10-12 20:28:34 -04:00
|
|
|
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 00:27:23 -04:00
|
|
|
event->xkey.time);
|
2002-07-09 23:51:01 -04:00
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_toggle_on_all_workspaces (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2011-02-28 05:41:23 -05:00
|
|
|
if (window->on_all_workspaces_requested)
|
2008-11-22 14:02:54 -05:00
|
|
|
meta_window_unstick (window);
|
|
|
|
else
|
|
|
|
meta_window_stick (window);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-09-06 18:01:56 -04:00
|
|
|
handle_move_to_workspace (MetaDisplay *display,
|
2009-01-29 10:07:57 -05:00
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2008-10-05 20:24:07 -04:00
|
|
|
gint which = binding->handler->data;
|
|
|
|
gboolean flip = (which < 0);
|
2002-04-28 00:52:26 -04:00
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
2008-09-06 18:01:56 -04: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 00:52:26 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
if (window->always_sticky)
|
2002-05-26 11:54:38 -04:00
|
|
|
return;
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
workspace = NULL;
|
2008-09-06 18:01:56 -04:00
|
|
|
if (flip)
|
2002-10-16 16:12:24 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
workspace = meta_workspace_get_neighbor (screen->active_workspace,
|
|
|
|
which);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-16 16:12:24 -04:00
|
|
|
workspace = meta_screen_get_workspace_by_index (screen, which);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (workspace)
|
|
|
|
{
|
2002-05-24 22:33:55 -04:00
|
|
|
/* Activate second, so the window is never unmapped */
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_window_change_workspace (window, workspace);
|
2003-05-16 20:00:55 -04:00
|
|
|
if (flip)
|
2005-02-21 21:11:25 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Resetting mouse_mode to FALSE due to "
|
2008-09-06 18:01:56 -04:00
|
|
|
"handle_move_to_workspace() call with flip set.\n");
|
2012-04-14 09:12:48 -04:00
|
|
|
meta_display_clear_mouse_mode (workspace->screen->display);
|
2005-02-21 21:11:25 -05:00
|
|
|
meta_workspace_activate_with_focus (workspace,
|
|
|
|
window,
|
|
|
|
event->xkey.time);
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We could offer to create it I suppose */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-28 23:11:24 -04:00
|
|
|
static void
|
|
|
|
handle_raise_or_lower (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-05-28 23:11:24 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-05-28 23:11:24 -04:00
|
|
|
{
|
|
|
|
/* Get window at pointer */
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
MetaWindow *above = NULL;
|
2002-05-28 23:11:24 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
/* Check if top */
|
|
|
|
if (meta_stack_get_top (window->screen->stack) == window)
|
|
|
|
{
|
|
|
|
meta_window_lower (window);
|
|
|
|
return;
|
|
|
|
}
|
2002-05-28 23:11:24 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
/* else check if windows in same layer are intersecting it */
|
|
|
|
|
|
|
|
above = meta_stack_get_above (window->screen->stack, window, TRUE);
|
2002-05-28 23:11:24 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
while (above)
|
|
|
|
{
|
|
|
|
MetaRectangle tmp, win_rect, above_rect;
|
|
|
|
|
|
|
|
if (above->mapped)
|
|
|
|
{
|
|
|
|
meta_window_get_outer_rect (window, &win_rect);
|
|
|
|
meta_window_get_outer_rect (above, &above_rect);
|
|
|
|
|
|
|
|
/* Check if obscured */
|
|
|
|
if (meta_rectangle_intersect (&win_rect, &above_rect, &tmp))
|
2002-10-20 11:22:40 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
meta_window_raise (window);
|
|
|
|
return;
|
2002-10-20 11:22:40 -04:00
|
|
|
}
|
2008-11-22 14:02:54 -05:00
|
|
|
}
|
2002-05-28 23:11:24 -04:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
above = meta_stack_get_above (window->screen->stack, above, TRUE);
|
2002-05-28 23:11:24 -04:00
|
|
|
}
|
2008-11-22 14:02:54 -05:00
|
|
|
|
|
|
|
/* window is not obscured */
|
|
|
|
meta_window_lower (window);
|
2002-05-28 23:11:24 -04:00
|
|
|
}
|
|
|
|
|
2002-08-15 01:14:49 -04:00
|
|
|
static void
|
|
|
|
handle_raise (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-08-15 01:14:49 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-15 01:14:49 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
meta_window_raise (window);
|
2002-08-15 01:14:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_lower (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-08-15 01:14:49 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-08-15 01:14:49 -04:00
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
meta_window_lower (window);
|
2002-08-15 01:14:49 -04:00
|
|
|
}
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
static void
|
2002-06-09 00:04:19 -04:00
|
|
|
handle_workspace_switch (MetaDisplay *display,
|
2002-10-16 16:12:24 -04:00
|
|
|
MetaScreen *screen,
|
2002-06-09 00:04:19 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
2008-10-05 20:24:07 -04:00
|
|
|
gint motion = binding->handler->data;
|
2003-01-21 17:40:25 -05:00
|
|
|
unsigned int grab_mask;
|
2009-04-27 09:27:31 -04:00
|
|
|
MetaWorkspace *next;
|
|
|
|
gboolean grabbed_before_release;
|
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
g_assert (motion < 0);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Starting tab between workspaces, showing popup\n");
|
|
|
|
|
2003-01-21 17:40:25 -05:00
|
|
|
/* FIXME should we use binding->mask ? */
|
|
|
|
grab_mask = event->xkey.state & ~(display->ignored_modifier_mask);
|
|
|
|
|
2009-04-27 09:27:31 -04:00
|
|
|
if (!meta_display_begin_grab_op (display,
|
|
|
|
screen,
|
|
|
|
NULL,
|
|
|
|
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
|
|
|
|
FALSE,
|
|
|
|
FALSE,
|
|
|
|
0,
|
|
|
|
grab_mask,
|
|
|
|
event->xkey.time,
|
|
|
|
0, 0))
|
|
|
|
return;
|
2002-09-09 14:16:25 -04:00
|
|
|
|
2009-04-27 09:27:31 -04:00
|
|
|
next = meta_workspace_get_neighbor (screen->active_workspace, motion);
|
|
|
|
g_assert (next);
|
2003-01-21 17:40:25 -05:00
|
|
|
|
2009-04-27 09:27:31 -04:00
|
|
|
grabbed_before_release = primary_modifier_still_pressed (display, grab_mask);
|
2003-01-21 17:40:25 -05:00
|
|
|
|
2009-04-27 09:27:31 -04:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS, "Activating target workspace\n");
|
|
|
|
|
|
|
|
if (!grabbed_before_release)
|
|
|
|
{
|
|
|
|
/* end the grab right away, modifier possibly released
|
|
|
|
* before we could establish the grab and receive the
|
|
|
|
* release event. Must end grab before we can switch
|
|
|
|
* spaces.
|
|
|
|
*/
|
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_workspace_activate (next, event->xkey.time);
|
|
|
|
|
|
|
|
if (grabbed_before_release && !meta_prefs_get_no_tab_popup ())
|
2009-04-28 09:32:18 -04:00
|
|
|
meta_screen_workspace_popup_create (screen, next);
|
2002-06-08 23:44:16 -04:00
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static void
|
2008-10-05 20:24:07 -04:00
|
|
|
handle_set_spew_mark (MetaDisplay *display,
|
2009-01-29 10:07:57 -05:00
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
2009-01-29 09:53:03 -05:00
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gpointer dummy)
|
2002-01-10 22:31:14 -05:00
|
|
|
{
|
|
|
|
meta_verbose ("-- MARK MARK MARK MARK --\n");
|
|
|
|
}
|
|
|
|
|
2002-02-08 01:01:58 -05:00
|
|
|
void
|
|
|
|
meta_set_keybindings_disabled (gboolean setting)
|
|
|
|
{
|
2002-06-15 23:03:08 -04:00
|
|
|
all_bindings_disabled = setting;
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Keybindings %s\n", all_bindings_disabled ? "disabled" : "enabled");
|
2002-02-08 01:01:58 -05:00
|
|
|
}
|
2004-10-13 04:32:10 -04:00
|
|
|
|
2009-01-29 10:07:57 -05:00
|
|
|
gboolean
|
|
|
|
meta_keybindings_set_custom_handler (const gchar *name,
|
|
|
|
MetaKeyHandlerFunc handler,
|
|
|
|
gpointer user_data,
|
2009-03-25 10:50:40 -04:00
|
|
|
GDestroyNotify free_data)
|
2009-01-29 10:07:57 -05:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyHandler *key_handler = HANDLER (name);
|
2009-01-29 10:07:57 -05:00
|
|
|
|
|
|
|
if (!key_handler)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (key_handler->user_data_free_func && key_handler->user_data)
|
2009-01-29 10:29:43 -05:00
|
|
|
key_handler->user_data_free_func (key_handler->user_data);
|
2009-01-29 10:07:57 -05:00
|
|
|
|
|
|
|
key_handler->func = handler;
|
|
|
|
key_handler->user_data = user_data;
|
|
|
|
key_handler->user_data_free_func = free_data;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
|
|
|
* meta_keybindings_switch_window: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2009-01-29 11:26:12 -05:00
|
|
|
void
|
|
|
|
meta_keybindings_switch_window (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
gint backwards = (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0;
|
2009-01-29 11:26:12 -05:00
|
|
|
|
|
|
|
do_choose_window (display, screen, event_window, event, binding,
|
|
|
|
backwards, FALSE);
|
|
|
|
}
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
static void
|
|
|
|
init_builtin_key_bindings (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
#define REVERSES_AND_REVERSED (META_KEY_BINDING_REVERSES | \
|
|
|
|
META_KEY_BINDING_IS_REVERSED)
|
2012-03-27 10:42:42 -04:00
|
|
|
GSettings *common_keybindings = g_settings_new (SCHEMA_COMMON_KEYBINDINGS);
|
|
|
|
GSettings *mutter_keybindings = g_settings_new (SCHEMA_MUTTER_KEYBINDINGS);
|
2011-10-27 21:05:43 -04:00
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-1",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_1,
|
|
|
|
handle_switch_to_workspace, 0);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-2",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_2,
|
|
|
|
handle_switch_to_workspace, 1);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-3",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_3,
|
|
|
|
handle_switch_to_workspace, 2);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-4",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_4,
|
|
|
|
handle_switch_to_workspace, 3);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-5",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_5,
|
|
|
|
handle_switch_to_workspace, 4);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-6",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_6,
|
|
|
|
handle_switch_to_workspace, 5);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-7",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_7,
|
|
|
|
handle_switch_to_workspace, 6);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-8",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_8,
|
|
|
|
handle_switch_to_workspace, 7);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-9",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_9,
|
|
|
|
handle_switch_to_workspace, 8);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-10",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_10,
|
|
|
|
handle_switch_to_workspace, 9);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-11",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_11,
|
|
|
|
handle_switch_to_workspace, 10);
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-12",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_12,
|
|
|
|
handle_switch_to_workspace, 11);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-left",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_LEFT,
|
|
|
|
handle_switch_to_workspace, META_MOTION_LEFT);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-right",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_RIGHT,
|
|
|
|
handle_switch_to_workspace, META_MOTION_RIGHT);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-up",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_UP,
|
|
|
|
handle_switch_to_workspace, META_MOTION_UP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-to-workspace-down",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
|
|
|
|
handle_switch_to_workspace, META_MOTION_DOWN);
|
|
|
|
|
|
|
|
|
|
|
|
/* 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 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_REVERSES,
|
|
|
|
META_KEYBINDING_ACTION_SWITCH_GROUP,
|
|
|
|
handle_switch, META_TAB_LIST_GROUP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-group-backward",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
REVERSES_AND_REVERSED,
|
|
|
|
META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD,
|
|
|
|
handle_switch, META_TAB_LIST_GROUP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-windows",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_REVERSES,
|
|
|
|
META_KEYBINDING_ACTION_SWITCH_WINDOWS,
|
|
|
|
handle_switch, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-windows-backward",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
REVERSES_AND_REVERSED,
|
|
|
|
META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD,
|
|
|
|
handle_switch, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-panels",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_REVERSES,
|
|
|
|
META_KEYBINDING_ACTION_SWITCH_PANELS,
|
|
|
|
handle_switch, META_TAB_LIST_DOCKS);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"switch-panels-backward",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
REVERSES_AND_REVERSED,
|
|
|
|
META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD,
|
|
|
|
handle_switch, META_TAB_LIST_DOCKS);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-group",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_REVERSES,
|
|
|
|
META_KEYBINDING_ACTION_CYCLE_GROUP,
|
|
|
|
handle_cycle, META_TAB_LIST_GROUP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-group-backward",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
REVERSES_AND_REVERSED,
|
|
|
|
META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD,
|
|
|
|
handle_cycle, META_TAB_LIST_GROUP);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-windows",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_REVERSES,
|
|
|
|
META_KEYBINDING_ACTION_CYCLE_WINDOWS,
|
|
|
|
handle_cycle, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-windows-backward",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
REVERSES_AND_REVERSED,
|
|
|
|
META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD,
|
|
|
|
handle_cycle, META_TAB_LIST_NORMAL);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-panels",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_REVERSES,
|
|
|
|
META_KEYBINDING_ACTION_CYCLE_PANELS,
|
|
|
|
handle_cycle, META_TAB_LIST_DOCKS);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"cycle-panels-backward",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
REVERSES_AND_REVERSED,
|
|
|
|
META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD,
|
|
|
|
handle_cycle, META_TAB_LIST_DOCKS);
|
|
|
|
|
|
|
|
|
|
|
|
/* These two are special pseudo-bindings that are provided for allowing
|
|
|
|
* custom handlers, but will never be bound to a key. While a tab
|
|
|
|
* grab is in effect, they are invoked for releasing the primary modifier
|
|
|
|
* or pressing some unbound key, respectively.
|
|
|
|
*/
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"tab-popup-select",
|
2012-03-27 10:42:42 -04:00
|
|
|
mutter_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_TAB_POPUP_SELECT,
|
|
|
|
handle_tab_popup_select, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"tab-popup-cancel",
|
2012-03-27 10:42:42 -04:00
|
|
|
mutter_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_TAB_POPUP_CANCEL,
|
|
|
|
handle_tab_popup_cancel, 0);
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"show-desktop",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_SHOW_DESKTOP,
|
|
|
|
handle_show_desktop, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"panel-main-menu",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_PANEL_MAIN_MENU,
|
|
|
|
handle_panel, META_KEYBINDING_ACTION_PANEL_MAIN_MENU);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"panel-run-dialog",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_PANEL_RUN_DIALOG,
|
|
|
|
handle_panel, META_KEYBINDING_ACTION_PANEL_RUN_DIALOG);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"set-spew-mark",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_NONE,
|
|
|
|
META_KEYBINDING_ACTION_SET_SPEW_MARK,
|
|
|
|
handle_set_spew_mark, 0);
|
|
|
|
|
|
|
|
#undef REVERSES_AND_REVERSED
|
|
|
|
|
|
|
|
/************************ PER WINDOW BINDINGS ************************/
|
|
|
|
|
|
|
|
/* These take a window as an extra parameter; they have no effect
|
|
|
|
* if no window is active.
|
|
|
|
*/
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"activate-window-menu",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_ACTIVATE_WINDOW_MENU,
|
|
|
|
handle_activate_window_menu, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-fullscreen",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_TOGGLE_FULLSCREEN,
|
|
|
|
handle_toggle_fullscreen, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-maximized",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
|
|
|
|
handle_toggle_maximized, 0);
|
|
|
|
|
2011-11-15 11:29:56 -05:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-tiled-left",
|
2012-03-27 10:42:42 -04:00
|
|
|
mutter_keybindings,
|
2011-11-15 11:29:56 -05:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
|
|
|
|
handle_toggle_tiled, META_TILE_LEFT);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-tiled-right",
|
2012-03-27 10:42:42 -04:00
|
|
|
mutter_keybindings,
|
2011-11-15 11:29:56 -05:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
|
|
|
|
handle_toggle_tiled, META_TILE_RIGHT);
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-above",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_TOGGLE_ABOVE,
|
|
|
|
handle_toggle_above, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"maximize",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MAXIMIZE,
|
|
|
|
handle_maximize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"unmaximize",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_UNMAXIMIZE,
|
|
|
|
handle_unmaximize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-shaded",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_TOGGLE_SHADED,
|
|
|
|
handle_toggle_shaded, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"minimize",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MINIMIZE,
|
|
|
|
handle_minimize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"close",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_CLOSE,
|
|
|
|
handle_close, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"begin-move",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_BEGIN_MOVE,
|
|
|
|
handle_begin_move, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"begin-resize",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_BEGIN_RESIZE,
|
|
|
|
handle_begin_resize, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"toggle-on-all-workspaces",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_TOGGLE_ON_ALL_WORKSPACES,
|
|
|
|
handle_toggle_on_all_workspaces, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-1",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_1,
|
|
|
|
handle_move_to_workspace, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-2",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_2,
|
|
|
|
handle_move_to_workspace, 1);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-3",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_3,
|
|
|
|
handle_move_to_workspace, 2);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-4",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_4,
|
|
|
|
handle_move_to_workspace, 3);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-5",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_5,
|
|
|
|
handle_move_to_workspace, 4);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-6",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_6,
|
|
|
|
handle_move_to_workspace, 5);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-7",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_7,
|
|
|
|
handle_move_to_workspace, 6);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-8",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_8,
|
|
|
|
handle_move_to_workspace, 7);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-9",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_9,
|
|
|
|
handle_move_to_workspace, 8);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-10",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_10,
|
|
|
|
handle_move_to_workspace, 9);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-11",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_11,
|
|
|
|
handle_move_to_workspace, 10);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-12",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_12,
|
|
|
|
handle_move_to_workspace, 11);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-workspace-left",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04: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 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04: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 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04: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 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
|
|
|
handle_move_to_workspace, META_MOTION_DOWN);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"raise-or-lower",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_RAISE_OR_LOWER,
|
|
|
|
handle_raise_or_lower, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"raise",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_RAISE,
|
|
|
|
handle_raise, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"lower",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_LOWER,
|
|
|
|
handle_lower, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"maximize-vertically",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MAXIMIZE_VERTICALLY,
|
|
|
|
handle_maximize_vertically, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"maximize-horizontally",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MAXIMIZE_HORIZONTALLY,
|
|
|
|
handle_maximize_horizontally, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-nw",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_NW,
|
|
|
|
handle_move_to_corner_nw, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-ne",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_NE,
|
|
|
|
handle_move_to_corner_ne, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-sw",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_SW,
|
|
|
|
handle_move_to_corner_sw, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-corner-se",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CORNER_SE,
|
|
|
|
handle_move_to_corner_se, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-n",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_N,
|
|
|
|
handle_move_to_side_n, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-s",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_S,
|
|
|
|
handle_move_to_side_s, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-e",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_E,
|
|
|
|
handle_move_to_side_e, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-side-w",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_SIDE_W,
|
|
|
|
handle_move_to_side_w, 0);
|
|
|
|
|
|
|
|
add_builtin_keybinding (display,
|
|
|
|
"move-to-center",
|
2012-03-27 10:42:42 -04:00
|
|
|
common_keybindings,
|
2011-10-27 21:05:43 -04:00
|
|
|
META_KEY_BINDING_PER_WINDOW,
|
|
|
|
META_KEYBINDING_ACTION_MOVE_TO_CENTER,
|
|
|
|
handle_move_to_center, 0);
|
2012-03-27 10:42:42 -04:00
|
|
|
|
|
|
|
g_object_unref (common_keybindings);
|
|
|
|
g_object_unref (mutter_keybindings);
|
2011-10-27 21:05:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_init_keys (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
/* Keybindings */
|
|
|
|
display->keymap = NULL;
|
|
|
|
display->keysyms_per_keycode = 0;
|
|
|
|
display->modmap = NULL;
|
|
|
|
display->min_keycode = 0;
|
|
|
|
display->max_keycode = 0;
|
|
|
|
display->ignored_modifier_mask = 0;
|
|
|
|
display->num_lock_mask = 0;
|
|
|
|
display->scroll_lock_mask = 0;
|
|
|
|
display->hyper_mask = 0;
|
|
|
|
display->super_mask = 0;
|
|
|
|
display->meta_mask = 0;
|
|
|
|
display->key_bindings = NULL;
|
|
|
|
display->n_key_bindings = 0;
|
|
|
|
|
|
|
|
XDisplayKeycodes (display->xdisplay,
|
|
|
|
&display->min_keycode,
|
|
|
|
&display->max_keycode);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Display has keycode range %d to %d\n",
|
|
|
|
display->min_keycode,
|
|
|
|
display->max_keycode);
|
|
|
|
|
|
|
|
reload_keymap (display);
|
|
|
|
reload_modmap (display);
|
|
|
|
|
|
|
|
key_handlers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
|
(GDestroyNotify) key_handler_free);
|
|
|
|
init_builtin_key_bindings (display);
|
|
|
|
|
|
|
|
rebuild_key_binding_table (display);
|
|
|
|
rebuild_special_bindings (display);
|
|
|
|
|
|
|
|
reload_keycodes (display);
|
|
|
|
reload_modifiers (display);
|
|
|
|
|
|
|
|
/* Keys are actually grabbed in meta_screen_grab_keys() */
|
|
|
|
|
|
|
|
meta_prefs_add_listener (bindings_changed_callback, display);
|
|
|
|
|
|
|
|
#ifdef HAVE_XKB
|
|
|
|
/* meta_display_init_keys() should have already called XkbQueryExtension() */
|
|
|
|
if (display->xkb_base_event_type != -1)
|
|
|
|
XkbSelectEvents (display->xdisplay, XkbUseCoreKbd,
|
|
|
|
XkbNewKeyboardNotifyMask | XkbMapNotifyMask,
|
|
|
|
XkbNewKeyboardNotifyMask | XkbMapNotifyMask);
|
|
|
|
#endif
|
|
|
|
}
|