2006-04-15 02:05:44 +00:00
|
|
|
/* Metacity Keybindings */
|
2001-06-06 04:47:37 +00:00
|
|
|
/*
|
2004-02-23 01:48:29 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
|
|
|
* Copyright (C) 2002 Red Hat Inc.
|
|
|
|
* Copyright (C) 2003 Rob Adams
|
2006-01-10 19:43:21 +00:00
|
|
|
* Copyright (C) 2004-2006 Elijah Newren
|
2001-06-06 04:47:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
#include <config.h>
|
2001-06-06 04:47:37 +00:00
|
|
|
#include "keybindings.h"
|
|
|
|
#include "workspace.h"
|
|
|
|
#include "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 14:58:50 +00:00
|
|
|
#include "edge-resistance.h"
|
2001-06-23 05:49:35 +00:00
|
|
|
#include "ui.h"
|
|
|
|
#include "frame.h"
|
2001-07-12 05:53:56 +00:00
|
|
|
#include "place.h"
|
2002-04-28 04:52:26 +00:00
|
|
|
#include "prefs.h"
|
2003-10-12 06:25:38 +00:00
|
|
|
#include "effects.h"
|
2001-06-06 04:47:37 +00:00
|
|
|
|
|
|
|
#include <X11/keysym.h>
|
2002-04-28 04:52:26 +00:00
|
|
|
#include <string.h>
|
2003-09-29 16:55:26 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2004-10-20 23:16:08 +00:00
|
|
|
#ifdef HAVE_XKB
|
|
|
|
#include <X11/XKBlib.h>
|
|
|
|
#endif
|
|
|
|
|
2002-02-08 06:01:58 +00:00
|
|
|
static gboolean all_bindings_disabled = FALSE;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
|
|
|
|
static void handle_activate_workspace (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_activate_menu (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_tab_forward (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-10-18 22:19:05 +00:00
|
|
|
static void handle_tab_backward (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-07-06 16:50:48 +00:00
|
|
|
static void handle_cycle_forward (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-10-18 22:19:05 +00:00
|
|
|
static void handle_cycle_backward (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-04-28 04:52:26 +00:00
|
|
|
static void handle_toggle_fullscreen (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_toggle_desktop (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2003-02-24 02:16:09 +00:00
|
|
|
static void handle_panel_keybinding (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2003-06-27 14:49:56 +00:00
|
|
|
static void handle_toggle_above (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-04-28 04:52:26 +00:00
|
|
|
static void handle_toggle_maximize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-08-21 06:47:16 +00:00
|
|
|
static void handle_maximize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-21 06:47:16 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_unmaximize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-21 06:47:16 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-04-28 04:52:26 +00:00
|
|
|
static void handle_toggle_shade (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_close_window (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-05-25 02:30:00 +00:00
|
|
|
static void handle_minimize_window (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-05-25 02:30:00 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-04-28 04:52:26 +00:00
|
|
|
static void handle_begin_move (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_begin_resize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_toggle_sticky (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_move_to_workspace (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2003-05-17 00:00:55 +00:00
|
|
|
static void handle_move_to_workspace_flip (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-06-09 04:04:19 +00:00
|
|
|
static void handle_workspace_switch (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-06-09 03:44:16 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-05-29 03:11:24 +00:00
|
|
|
static void handle_raise_or_lower (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-05-29 03:11:24 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-08-15 05:14:49 +00:00
|
|
|
static void handle_raise (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-15 05:14:49 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_lower (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-15 05:14:49 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-07-11 04:10:44 +00:00
|
|
|
static void handle_run_command (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-07-11 04:10:44 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-12-08 21:09:05 +00:00
|
|
|
static void handle_maximize_vert (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
|
|
|
static void handle_maximize_horiz (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2004-10-13 08:32:10 +00:00
|
|
|
static void handle_run_terminal (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding);
|
2002-01-11 03:31:14 +00:00
|
|
|
|
|
|
|
/* debug */
|
2001-08-19 18:09:10 +00:00
|
|
|
static gboolean process_keyboard_move_grab (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2001-08-19 18:09:10 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
static gboolean process_keyboard_resize_grab (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-06-19 04:12:49 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
static gboolean process_tab_grab (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2001-08-19 18:09:10 +00:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-06-09 04:04:19 +00:00
|
|
|
static gboolean process_workspace_switch_grab (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-06-09 04:04:19 +00:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym);
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void regrab_screen_bindings (MetaDisplay *display);
|
|
|
|
static void regrab_window_bindings (MetaDisplay *display);
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
MetaKeyHandlerFunc func;
|
|
|
|
void *data;
|
|
|
|
} MetaKeyHandler;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
|
|
|
struct _MetaKeyBinding
|
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
const char *name;
|
2001-06-06 04:47:37 +00:00
|
|
|
KeySym keysym;
|
2002-04-28 04:52:26 +00:00
|
|
|
unsigned int mask;
|
2003-02-22 20:31:51 +00:00
|
|
|
unsigned int keycode;
|
2002-07-14 03:16:41 +00:00
|
|
|
MetaVirtualModifier modifiers;
|
2002-04-28 04:52:26 +00:00
|
|
|
const MetaKeyHandler *handler;
|
2001-06-06 04:47:37 +00:00
|
|
|
};
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static const MetaKeyHandler screen_handlers[] = {
|
|
|
|
{ META_KEYBINDING_WORKSPACE_1, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (0) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_2, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (1) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_3, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (2) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_4, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (3) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_5, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (4) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_6, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (5) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_7, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (6) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_8, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (7) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_9, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (8) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_10, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (9) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_11, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (10) },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_12, handle_activate_workspace,
|
|
|
|
GINT_TO_POINTER (11) },
|
2002-06-09 04:04:19 +00:00
|
|
|
{ META_KEYBINDING_WORKSPACE_LEFT, handle_workspace_switch,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_LEFT) },
|
2002-06-09 04:04:19 +00:00
|
|
|
{ META_KEYBINDING_WORKSPACE_RIGHT, handle_workspace_switch,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_RIGHT) },
|
2002-06-09 04:04:19 +00:00
|
|
|
{ META_KEYBINDING_WORKSPACE_UP, handle_workspace_switch,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_UP) },
|
2002-06-09 04:04:19 +00:00
|
|
|
{ META_KEYBINDING_WORKSPACE_DOWN, handle_workspace_switch,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_DOWN) },
|
|
|
|
{ META_KEYBINDING_SWITCH_WINDOWS, handle_tab_forward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
|
2002-10-18 22:19:05 +00:00
|
|
|
{ META_KEYBINDING_SWITCH_WINDOWS_BACKWARD, handle_tab_backward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
|
2002-04-28 04:52:26 +00:00
|
|
|
{ META_KEYBINDING_SWITCH_PANELS, handle_tab_forward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
|
2002-10-18 22:19:05 +00:00
|
|
|
{ META_KEYBINDING_SWITCH_PANELS_BACKWARD, handle_tab_backward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
|
2006-04-15 02:05:44 +00:00
|
|
|
{ META_KEYBINDING_SWITCH_GROUP, handle_tab_forward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_GROUP) },
|
|
|
|
{ META_KEYBINDING_SWITCH_GROUP_BACKWARD, handle_tab_backward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_GROUP) },
|
|
|
|
{ META_KEYBINDING_CYCLE_GROUP, handle_cycle_forward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_GROUP) },
|
|
|
|
{ META_KEYBINDING_CYCLE_GROUP_BACKWARD, handle_cycle_backward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_GROUP) },
|
2002-07-06 16:50:48 +00:00
|
|
|
{ META_KEYBINDING_CYCLE_WINDOWS, handle_cycle_forward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
|
2002-10-18 22:19:05 +00:00
|
|
|
{ META_KEYBINDING_CYCLE_WINDOWS_BACKWARD, handle_cycle_backward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
|
2002-07-06 16:50:48 +00:00
|
|
|
{ META_KEYBINDING_CYCLE_PANELS, handle_cycle_forward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
|
2002-10-18 22:19:05 +00:00
|
|
|
{ META_KEYBINDING_CYCLE_PANELS_BACKWARD, handle_cycle_backward,
|
|
|
|
GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
|
2002-04-28 04:52:26 +00:00
|
|
|
{ META_KEYBINDING_SHOW_DESKTOP, handle_toggle_desktop,
|
|
|
|
NULL },
|
2003-02-24 02:16:09 +00:00
|
|
|
{ META_KEYBINDING_PANEL_MAIN_MENU, handle_panel_keybinding,
|
|
|
|
GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_MAIN_MENU) },
|
|
|
|
{ META_KEYBINDING_PANEL_RUN_DIALOG, handle_panel_keybinding,
|
|
|
|
GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_RUN_DIALOG) },
|
2002-07-11 04:10:44 +00:00
|
|
|
{ META_KEYBINDING_COMMAND_1, handle_run_command,
|
|
|
|
GINT_TO_POINTER (0) },
|
|
|
|
{ META_KEYBINDING_COMMAND_2, handle_run_command,
|
|
|
|
GINT_TO_POINTER (1) },
|
|
|
|
{ META_KEYBINDING_COMMAND_3, handle_run_command,
|
|
|
|
GINT_TO_POINTER (2) },
|
|
|
|
{ META_KEYBINDING_COMMAND_4, handle_run_command,
|
|
|
|
GINT_TO_POINTER (3) },
|
|
|
|
{ META_KEYBINDING_COMMAND_5, handle_run_command,
|
|
|
|
GINT_TO_POINTER (4) },
|
|
|
|
{ META_KEYBINDING_COMMAND_6, handle_run_command,
|
|
|
|
GINT_TO_POINTER (5) },
|
|
|
|
{ META_KEYBINDING_COMMAND_7, handle_run_command,
|
|
|
|
GINT_TO_POINTER (6) },
|
|
|
|
{ META_KEYBINDING_COMMAND_8, handle_run_command,
|
|
|
|
GINT_TO_POINTER (7) },
|
|
|
|
{ META_KEYBINDING_COMMAND_9, handle_run_command,
|
|
|
|
GINT_TO_POINTER (8) },
|
|
|
|
{ META_KEYBINDING_COMMAND_10, handle_run_command,
|
|
|
|
GINT_TO_POINTER (9) },
|
|
|
|
{ META_KEYBINDING_COMMAND_11, handle_run_command,
|
|
|
|
GINT_TO_POINTER (10) },
|
|
|
|
{ META_KEYBINDING_COMMAND_12, handle_run_command,
|
|
|
|
GINT_TO_POINTER (11) },
|
2003-01-15 02:39:07 +00:00
|
|
|
{ META_KEYBINDING_COMMAND_13, handle_run_command,
|
|
|
|
GINT_TO_POINTER (12) },
|
|
|
|
{ META_KEYBINDING_COMMAND_14, handle_run_command,
|
|
|
|
GINT_TO_POINTER (13) },
|
|
|
|
{ META_KEYBINDING_COMMAND_15, handle_run_command,
|
|
|
|
GINT_TO_POINTER (14) },
|
|
|
|
{ META_KEYBINDING_COMMAND_16, handle_run_command,
|
|
|
|
GINT_TO_POINTER (15) },
|
|
|
|
{ META_KEYBINDING_COMMAND_17, handle_run_command,
|
|
|
|
GINT_TO_POINTER (16) },
|
|
|
|
{ META_KEYBINDING_COMMAND_18, handle_run_command,
|
|
|
|
GINT_TO_POINTER (17) },
|
|
|
|
{ META_KEYBINDING_COMMAND_19, handle_run_command,
|
|
|
|
GINT_TO_POINTER (18) },
|
|
|
|
{ META_KEYBINDING_COMMAND_20, handle_run_command,
|
|
|
|
GINT_TO_POINTER (19) },
|
|
|
|
{ META_KEYBINDING_COMMAND_21, handle_run_command,
|
|
|
|
GINT_TO_POINTER (20) },
|
|
|
|
{ META_KEYBINDING_COMMAND_22, handle_run_command,
|
|
|
|
GINT_TO_POINTER (21) },
|
|
|
|
{ META_KEYBINDING_COMMAND_23, handle_run_command,
|
|
|
|
GINT_TO_POINTER (22) },
|
|
|
|
{ META_KEYBINDING_COMMAND_24, handle_run_command,
|
|
|
|
GINT_TO_POINTER (23) },
|
|
|
|
{ META_KEYBINDING_COMMAND_25, handle_run_command,
|
|
|
|
GINT_TO_POINTER (24) },
|
|
|
|
{ META_KEYBINDING_COMMAND_26, handle_run_command,
|
|
|
|
GINT_TO_POINTER (25) },
|
|
|
|
{ META_KEYBINDING_COMMAND_27, handle_run_command,
|
|
|
|
GINT_TO_POINTER (26) },
|
|
|
|
{ META_KEYBINDING_COMMAND_28, handle_run_command,
|
|
|
|
GINT_TO_POINTER (27) },
|
|
|
|
{ META_KEYBINDING_COMMAND_29, handle_run_command,
|
|
|
|
GINT_TO_POINTER (28) },
|
|
|
|
{ META_KEYBINDING_COMMAND_30, handle_run_command,
|
|
|
|
GINT_TO_POINTER (29) },
|
|
|
|
{ META_KEYBINDING_COMMAND_31, handle_run_command,
|
|
|
|
GINT_TO_POINTER (30) },
|
|
|
|
{ META_KEYBINDING_COMMAND_32, handle_run_command,
|
|
|
|
GINT_TO_POINTER (31) },
|
2003-02-24 02:16:09 +00:00
|
|
|
{ META_KEYBINDING_COMMAND_SCREENSHOT, handle_run_command,
|
|
|
|
GINT_TO_POINTER (32) },
|
|
|
|
{ META_KEYBINDING_COMMAND_WIN_SCREENSHOT, handle_run_command,
|
|
|
|
GINT_TO_POINTER (33) },
|
2004-10-13 08:32:10 +00:00
|
|
|
{ META_KEYBINDING_RUN_COMMAND_TERMINAL, handle_run_terminal,
|
|
|
|
NULL },
|
2002-04-28 04:52:26 +00:00
|
|
|
{ NULL, NULL, NULL }
|
2002-01-11 03:31:14 +00:00
|
|
|
};
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static const MetaKeyHandler window_handlers[] = {
|
|
|
|
{ META_KEYBINDING_WINDOW_MENU, handle_activate_menu, NULL },
|
|
|
|
{ META_KEYBINDING_TOGGLE_FULLSCREEN, handle_toggle_fullscreen, NULL },
|
2003-06-27 14:49:56 +00:00
|
|
|
{ META_KEYBINDING_TOGGLE_ABOVE, handle_toggle_above, NULL },
|
2002-04-28 04:52:26 +00:00
|
|
|
{ META_KEYBINDING_TOGGLE_MAXIMIZE, handle_toggle_maximize, NULL },
|
2002-08-21 06:47:16 +00:00
|
|
|
{ META_KEYBINDING_MAXIMIZE, handle_maximize, NULL },
|
|
|
|
{ META_KEYBINDING_UNMAXIMIZE, handle_unmaximize, NULL },
|
2002-04-28 04:52:26 +00:00
|
|
|
{ META_KEYBINDING_TOGGLE_SHADE, handle_toggle_shade, NULL },
|
|
|
|
{ META_KEYBINDING_CLOSE, handle_close_window, NULL },
|
2002-05-25 02:30:00 +00:00
|
|
|
{ META_KEYBINDING_MINIMIZE, handle_minimize_window, NULL },
|
2002-04-28 04:52:26 +00:00
|
|
|
{ META_KEYBINDING_BEGIN_MOVE, handle_begin_move, },
|
|
|
|
{ META_KEYBINDING_BEGIN_RESIZE, handle_begin_resize, },
|
|
|
|
{ META_KEYBINDING_TOGGLE_STICKY, handle_toggle_sticky, },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_1, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (0) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_2, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (1) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_3, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (2) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_4, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (3) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_5, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (4) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_6, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (5) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_7, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (6) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_8, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (7) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_9, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (8) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_10, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (9) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_11, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (10) },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_12, handle_move_to_workspace,
|
|
|
|
GINT_TO_POINTER (11) },
|
2003-05-17 00:00:55 +00:00
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_LEFT, handle_move_to_workspace_flip,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_LEFT) },
|
2003-05-17 00:00:55 +00:00
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_RIGHT, handle_move_to_workspace_flip,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_RIGHT) },
|
2003-05-17 00:00:55 +00:00
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_UP, handle_move_to_workspace_flip,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_UP) },
|
2003-05-17 00:00:55 +00:00
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_DOWN, handle_move_to_workspace_flip,
|
2002-04-28 04:52:26 +00:00
|
|
|
GINT_TO_POINTER (META_MOTION_DOWN) },
|
2002-05-29 03:11:24 +00:00
|
|
|
{ META_KEYBINDING_RAISE_OR_LOWER, handle_raise_or_lower, NULL},
|
2002-08-15 05:14:49 +00:00
|
|
|
{ META_KEYBINDING_RAISE, handle_raise, NULL},
|
|
|
|
{ META_KEYBINDING_LOWER, handle_lower, NULL},
|
2002-12-08 21:09:05 +00:00
|
|
|
{ META_KEYBINDING_MAXIMIZE_VERTICALLY, handle_maximize_vert, NULL },
|
|
|
|
{ META_KEYBINDING_MAXIMIZE_HORIZONTALLY, handle_maximize_horiz, NULL },
|
2002-04-28 04:52:26 +00:00
|
|
|
{ NULL, NULL, NULL }
|
2001-06-23 05:49:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
reload_keymap (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->keymap)
|
|
|
|
meta_XFree (display->keymap);
|
|
|
|
|
|
|
|
display->keymap = XGetKeyboardMapping (display->xdisplay,
|
|
|
|
display->min_keycode,
|
|
|
|
display->max_keycode -
|
2004-10-15 22:43:52 +00:00
|
|
|
display->min_keycode + 1,
|
2002-04-28 04:52:26 +00:00
|
|
|
&display->keysyms_per_keycode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_modmap (MetaDisplay *display)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
XModifierKeymap *modmap;
|
|
|
|
int map_size;
|
2001-06-06 04:47:37 +00:00
|
|
|
int i;
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
|
|
if (display->modmap)
|
|
|
|
XFreeModifiermap (display->modmap);
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-04-28 04:52:26 +00: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-14 03:16:41 +00:00
|
|
|
display->meta_mask = 0;
|
|
|
|
display->hyper_mask = 0;
|
|
|
|
display->super_mask = 0;
|
2002-04-28 04:52:26 +00: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 04:47:37 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
/* get the key code at this point in the map,
|
|
|
|
* see if its keysym is one we're interested in
|
|
|
|
*/
|
2006-04-13 13:16:42 +00:00
|
|
|
int keycode = modmap->modifiermap[i];
|
2002-04-28 04:52:26 +00: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-16 03:03:08 +00: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 20:18:54 +00:00
|
|
|
str ? str : "none",
|
2002-06-16 03:03:08 +00:00
|
|
|
(1 << ( i / modmap->max_keypermod)));
|
|
|
|
}
|
|
|
|
|
2002-05-01 03:23:46 +00:00
|
|
|
if (syms[j] == XK_Num_Lock)
|
2002-04-28 04:52:26 +00: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-14 03:16:41 +00: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 04:52:26 +00:00
|
|
|
|
|
|
|
++j;
|
|
|
|
}
|
|
|
|
}
|
2001-06-06 04:47:37 +00:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2002-05-01 03:33:06 +00:00
|
|
|
display->ignored_modifier_mask = (display->num_lock_mask |
|
2002-05-11 02:38:58 +00:00
|
|
|
display->scroll_lock_mask |
|
|
|
|
LockMask);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2002-07-14 03:16:41 +00: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 04:52:26 +00:00
|
|
|
display->ignored_modifier_mask,
|
|
|
|
display->num_lock_mask,
|
2002-07-14 03:16:41 +00:00
|
|
|
display->scroll_lock_mask,
|
|
|
|
display->hyper_mask,
|
|
|
|
display->super_mask,
|
|
|
|
display->meta_mask);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reload_keycodes (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Reloading keycodes for binding tables\n");
|
|
|
|
|
|
|
|
if (display->screen_bindings)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2003-02-22 20:31:51 +00:00
|
|
|
while (i < display->n_screen_bindings)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
|
|
|
display->screen_bindings[i].keycode = XKeysymToKeycode (display->xdisplay,
|
|
|
|
display->screen_bindings[i].keysym);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->window_bindings)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2003-02-22 20:31:51 +00:00
|
|
|
while (i < display->n_window_bindings)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
|
|
|
display->window_bindings[i].keycode = XKeysymToKeycode (display->xdisplay,
|
|
|
|
display->window_bindings[i].keysym);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-14 03:16:41 +00:00
|
|
|
static void
|
|
|
|
reload_modifiers (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Reloading keycodes for binding tables\n");
|
|
|
|
|
|
|
|
if (display->screen_bindings)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2003-02-22 20:31:51 +00:00
|
|
|
while (i < display->n_screen_bindings)
|
2002-07-14 03:16:41 +00:00
|
|
|
{
|
2002-10-07 23:14:40 +00:00
|
|
|
meta_display_devirtualize_modifiers (display,
|
|
|
|
display->screen_bindings[i].modifiers,
|
|
|
|
&display->screen_bindings[i].mask);
|
2003-02-22 20:31:51 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
" Devirtualized mods 0x%x -> 0x%x (%s)\n",
|
|
|
|
display->screen_bindings[i].modifiers,
|
|
|
|
display->screen_bindings[i].mask,
|
|
|
|
display->screen_bindings[i].name);
|
2002-07-14 03:16:41 +00:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->window_bindings)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2003-02-22 20:31:51 +00:00
|
|
|
while (i < display->n_window_bindings)
|
2002-07-14 03:16:41 +00:00
|
|
|
{
|
2002-10-07 23:14:40 +00:00
|
|
|
meta_display_devirtualize_modifiers (display,
|
|
|
|
display->window_bindings[i].modifiers,
|
|
|
|
&display->window_bindings[i].mask);
|
2003-02-22 20:31:51 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
" Devirtualized mods 0x%x -> 0x%x (%s)\n",
|
|
|
|
display->window_bindings[i].modifiers,
|
|
|
|
display->window_bindings[i].mask,
|
|
|
|
display->window_bindings[i].name);
|
2002-07-14 03:16:41 +00:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
static int
|
|
|
|
count_bindings (const MetaKeyPref *prefs,
|
|
|
|
int n_prefs)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2003-02-22 20:31:51 +00:00
|
|
|
int i;
|
|
|
|
int count;
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
count = 0;
|
|
|
|
i = 0;
|
|
|
|
while (i < n_prefs)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
GSList *tmp = prefs[i].bindings;
|
|
|
|
|
|
|
|
while (tmp)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
MetaKeyCombo *combo = tmp->data;
|
|
|
|
|
|
|
|
if (combo && combo->keysym != None)
|
|
|
|
{
|
|
|
|
count += 1;
|
|
|
|
|
|
|
|
if (prefs[i].add_shift &&
|
|
|
|
(combo->modifiers & META_VIRTUAL_SHIFT_MASK) == 0)
|
|
|
|
count += 1;
|
|
|
|
}
|
2003-02-22 20:31:51 +00:00
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
tmp = tmp->next;
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
++i;
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
return count;
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-22 20:31:51 +00:00
|
|
|
rebuild_binding_table (MetaDisplay *display,
|
|
|
|
MetaKeyBinding **bindings_p,
|
|
|
|
int *n_bindings_p,
|
|
|
|
const MetaKeyPref *prefs,
|
|
|
|
int n_prefs)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
|
|
|
int n_bindings;
|
|
|
|
int src, dest;
|
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
n_bindings = count_bindings (prefs, n_prefs);
|
|
|
|
g_free (*bindings_p);
|
|
|
|
*bindings_p = g_new0 (MetaKeyBinding, n_bindings);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
|
|
src = 0;
|
|
|
|
dest = 0;
|
2003-02-22 20:31:51 +00:00
|
|
|
while (src < n_prefs)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
GSList *tmp = prefs[src].bindings;
|
|
|
|
|
|
|
|
while (tmp)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
MetaKeyCombo *combo = tmp->data;
|
2003-02-22 20:31:51 +00:00
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
if (combo && combo->keysym != None)
|
2003-02-22 20:31:51 +00:00
|
|
|
{
|
|
|
|
(*bindings_p)[dest].name = prefs[src].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 17:23:09 +00:00
|
|
|
(*bindings_p)[dest].keysym = combo->keysym;
|
|
|
|
(*bindings_p)[dest].modifiers = combo->modifiers;
|
2003-02-22 20:31:51 +00:00
|
|
|
(*bindings_p)[dest].mask = 0;
|
|
|
|
(*bindings_p)[dest].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 17:23:09 +00:00
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
++dest;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
|
|
if (prefs[src].add_shift &&
|
|
|
|
(combo->modifiers & META_VIRTUAL_SHIFT_MASK) == 0)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Binding %s also needs Shift grabbed\n",
|
|
|
|
prefs[src].name);
|
|
|
|
|
|
|
|
(*bindings_p)[dest].name = prefs[src].name;
|
|
|
|
(*bindings_p)[dest].keysym = combo->keysym;
|
|
|
|
(*bindings_p)[dest].modifiers = combo->modifiers |
|
|
|
|
META_VIRTUAL_SHIFT_MASK;
|
|
|
|
(*bindings_p)[dest].mask = 0;
|
|
|
|
(*bindings_p)[dest].keycode = 0;
|
|
|
|
|
|
|
|
++dest;
|
|
|
|
}
|
2003-02-22 20:31:51 +00:00
|
|
|
}
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
++src;
|
|
|
|
}
|
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
g_assert (dest == n_bindings);
|
|
|
|
|
|
|
|
*n_bindings_p = dest;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
" %d bindings in table\n",
|
|
|
|
*n_bindings_p);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
rebuild_screen_binding_table (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
const MetaKeyPref *prefs;
|
|
|
|
int n_prefs;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Rebuilding screen binding table from preferences\n");
|
|
|
|
|
|
|
|
meta_prefs_get_screen_bindings (&prefs, &n_prefs);
|
|
|
|
rebuild_binding_table (display,
|
|
|
|
&display->screen_bindings,
|
|
|
|
&display->n_screen_bindings,
|
|
|
|
prefs, n_prefs);
|
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2003-02-22 20:31:51 +00:00
|
|
|
static void
|
|
|
|
rebuild_window_binding_table (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
const MetaKeyPref *prefs;
|
|
|
|
int n_prefs;
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2003-02-22 20:31:51 +00:00
|
|
|
"Rebuilding window binding table from preferences\n");
|
|
|
|
|
|
|
|
meta_prefs_get_window_bindings (&prefs, &n_prefs);
|
|
|
|
rebuild_binding_table (display,
|
|
|
|
&display->window_bindings,
|
|
|
|
&display->n_window_bindings,
|
|
|
|
prefs, n_prefs);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
regrab_screen_bindings (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
2002-11-06 16:00:56 +00:00
|
|
|
meta_error_trap_push (display); /* for efficiency push outer trap */
|
|
|
|
|
2002-04-28 04:52:26 +00: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 16:00:56 +00:00
|
|
|
|
|
|
|
meta_error_trap_pop (display, FALSE);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
regrab_window_bindings (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList *windows;
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
windows = meta_display_list_windows (display);
|
|
|
|
|
2002-11-06 16:00:56 +00:00
|
|
|
meta_error_trap_push (display); /* for efficiency push outer trap */
|
2002-04-28 04:52:26 +00:00
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
|
|
|
meta_window_ungrab_keys (w);
|
|
|
|
meta_window_grab_keys (w);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2002-11-06 16:00:56 +00:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
|
2002-07-14 03:16:41 +00:00
|
|
|
static MetaKeyBindingAction
|
|
|
|
display_get_keybinding_action (MetaDisplay *display,
|
|
|
|
unsigned int keysym,
|
|
|
|
unsigned long mask)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = display->n_screen_bindings - 1;
|
|
|
|
while (i >= 0)
|
|
|
|
{
|
|
|
|
if (display->screen_bindings[i].keysym == keysym &&
|
|
|
|
display->screen_bindings[i].mask == mask)
|
|
|
|
{
|
|
|
|
return meta_prefs_get_keybinding_action (display->screen_bindings[i].name);
|
|
|
|
}
|
|
|
|
|
|
|
|
--i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
void
|
|
|
|
meta_display_process_mapping_event (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
if (event->xmapping.request == MappingModifier)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Received MappingModifier event, will reload modmap and redo keybindings\n");
|
|
|
|
|
|
|
|
reload_modmap (display);
|
2002-07-14 03:16:41 +00:00
|
|
|
|
|
|
|
reload_modifiers (display);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
|
|
regrab_screen_bindings (display);
|
|
|
|
regrab_window_bindings (display);
|
|
|
|
}
|
|
|
|
else if (event->xmapping.request == MappingKeyboard)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Received MappingKeyboard event, will reload keycodes and redo keybindings\n");
|
|
|
|
|
|
|
|
reload_keymap (display);
|
|
|
|
reload_modmap (display);
|
|
|
|
|
|
|
|
reload_keycodes (display);
|
|
|
|
|
|
|
|
regrab_screen_bindings (display);
|
|
|
|
regrab_window_bindings (display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
bindings_changed_callback (MetaPreference pref,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
|
|
|
|
display = data;
|
|
|
|
|
|
|
|
switch (pref)
|
|
|
|
{
|
|
|
|
case META_PREF_SCREEN_KEYBINDINGS:
|
|
|
|
rebuild_screen_binding_table (display);
|
|
|
|
reload_keycodes (display);
|
2002-07-14 03:16:41 +00:00
|
|
|
reload_modifiers (display);
|
2002-04-28 04:52:26 +00:00
|
|
|
regrab_screen_bindings (display);
|
|
|
|
break;
|
|
|
|
case META_PREF_WINDOW_KEYBINDINGS:
|
|
|
|
rebuild_window_binding_table (display);
|
|
|
|
reload_keycodes (display);
|
2002-07-14 03:16:41 +00:00
|
|
|
reload_modifiers (display);
|
2002-04-28 04:52:26 +00:00
|
|
|
regrab_window_bindings (display);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
|
|
|
|
void
|
2001-06-23 05:49:35 +00:00
|
|
|
meta_display_init_keys (MetaDisplay *display)
|
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
/* 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;
|
2002-07-14 03:16:41 +00:00
|
|
|
display->hyper_mask = 0;
|
|
|
|
display->super_mask = 0;
|
|
|
|
display->meta_mask = 0;
|
2002-04-28 04:52:26 +00:00
|
|
|
display->screen_bindings = NULL;
|
|
|
|
display->n_screen_bindings = 0;
|
|
|
|
display->window_bindings = NULL;
|
|
|
|
display->n_window_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);
|
|
|
|
|
|
|
|
rebuild_window_binding_table (display);
|
|
|
|
rebuild_screen_binding_table (display);
|
|
|
|
|
|
|
|
reload_keycodes (display);
|
2002-07-14 03:16:41 +00:00
|
|
|
reload_modifiers (display);
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
/* Keys are actually grabbed in meta_screen_grab_keys() */
|
|
|
|
|
|
|
|
meta_prefs_add_listener (bindings_changed_callback, display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_shutdown_keys (MetaDisplay *display)
|
|
|
|
{
|
2002-08-06 04:11:23 +00:00
|
|
|
/* Note that display->xdisplay is invalid in this function */
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_prefs_remove_listener (bindings_changed_callback, display);
|
|
|
|
|
|
|
|
if (display->keymap)
|
|
|
|
meta_XFree (display->keymap);
|
|
|
|
|
|
|
|
if (display->modmap)
|
|
|
|
XFreeModifiermap (display->modmap);
|
|
|
|
g_free (display->screen_bindings);
|
|
|
|
g_free (display->window_bindings);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char*
|
|
|
|
keysym_name (int keysym)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
name = XKeysymToString (keysym);
|
|
|
|
if (name == NULL)
|
|
|
|
name = "(unknown)";
|
|
|
|
|
|
|
|
return name;
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
|
|
|
|
2001-10-05 02:58:48 +00: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 20:31:51 +00:00
|
|
|
unsigned int keycode,
|
2001-10-05 02:58:48 +00:00
|
|
|
int modmask)
|
|
|
|
{
|
2003-05-21 03:45:58 +00:00
|
|
|
unsigned int ignored_mask;
|
2001-10-05 02:58:48 +00:00
|
|
|
|
|
|
|
/* Grab keycode/modmask, together with
|
2002-04-28 04:52:26 +00:00
|
|
|
* all combinations of ignored modifiers.
|
2001-10-05 02:58:48 +00:00
|
|
|
* X provides no better way to do this.
|
|
|
|
*/
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2002-06-09 03:44:16 +00:00
|
|
|
"%s keybinding %s mask 0x%x on 0x%lx\n",
|
2002-04-28 04:52:26 +00:00
|
|
|
grab ? "Grabbing" : "Ungrabbing",
|
|
|
|
keysym_name (keysym),
|
2002-06-09 03:44:16 +00:00
|
|
|
modmask, xwindow);
|
2002-10-21 21:44:35 +00:00
|
|
|
|
|
|
|
/* efficiency, avoid so many XSync() */
|
|
|
|
meta_error_trap_push (display);
|
2001-10-05 02:58:48 +00:00
|
|
|
|
|
|
|
ignored_mask = 0;
|
2003-05-21 03:45:58 +00:00
|
|
|
while (ignored_mask <= display->ignored_modifier_mask)
|
2001-10-05 02:58:48 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
if (ignored_mask & ~(display->ignored_modifier_mask))
|
2001-10-05 02:58:48 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
/* Not a combination of ignored modifiers
|
2001-10-05 02:58:48 +00:00
|
|
|
* (it contains some non-ignored modifiers)
|
|
|
|
*/
|
|
|
|
++ignored_mask;
|
|
|
|
continue;
|
|
|
|
}
|
2002-10-21 21:44:35 +00:00
|
|
|
|
|
|
|
if (meta_is_debugging ())
|
|
|
|
meta_error_trap_push_with_return (display);
|
2001-10-05 02:58:48 +00:00
|
|
|
if (grab)
|
|
|
|
XGrabKey (display->xdisplay, keycode,
|
|
|
|
modmask | ignored_mask,
|
|
|
|
xwindow,
|
|
|
|
True,
|
2002-02-08 06:01:58 +00:00
|
|
|
GrabModeAsync, GrabModeSync);
|
2001-10-05 02:58:48 +00:00
|
|
|
else
|
|
|
|
XUngrabKey (display->xdisplay, keycode,
|
|
|
|
modmask | ignored_mask,
|
|
|
|
xwindow);
|
2002-10-21 21:44:35 +00:00
|
|
|
|
|
|
|
if (meta_is_debugging ())
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
|
|
|
result = meta_error_trap_pop_with_return (display, FALSE);
|
|
|
|
|
|
|
|
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-05 02:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
++ignored_mask;
|
|
|
|
}
|
2002-10-21 21:44:35 +00:00
|
|
|
|
|
|
|
meta_error_trap_pop (display, FALSE);
|
2001-10-05 02:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_grab_key (MetaDisplay *display,
|
|
|
|
Window xwindow,
|
|
|
|
int keysym,
|
2003-02-22 20:31:51 +00:00
|
|
|
unsigned int keycode,
|
2001-10-05 02:58:48 +00:00
|
|
|
int modmask)
|
|
|
|
{
|
|
|
|
meta_change_keygrab (display, xwindow, TRUE, keysym, keycode, modmask);
|
|
|
|
}
|
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
static void
|
|
|
|
grab_keys (MetaKeyBinding *bindings,
|
2002-04-28 04:52:26 +00:00
|
|
|
int n_bindings,
|
2001-06-23 05:49:35 +00:00
|
|
|
MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
g_assert (n_bindings == 0 || bindings != NULL);
|
2002-11-06 16:00:56 +00:00
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
i = 0;
|
2002-04-28 04:52:26 +00:00
|
|
|
while (i < n_bindings)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
|
|
|
if (bindings[i].keycode != 0)
|
|
|
|
{
|
2001-10-05 02:58:48 +00:00
|
|
|
meta_grab_key (display, xwindow,
|
|
|
|
bindings[i].keysym,
|
|
|
|
bindings[i].keycode,
|
|
|
|
bindings[i].mask);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-11-06 16:00:56 +00:00
|
|
|
|
|
|
|
meta_error_trap_pop (display, FALSE);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
ungrab_all_keys (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2002-11-06 16:00:56 +00:00
|
|
|
if (meta_is_debugging ())
|
|
|
|
meta_error_trap_push_with_return (display);
|
|
|
|
else
|
|
|
|
meta_error_trap_push (display);
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
XUngrabKey (display->xdisplay, AnyKey, AnyModifier,
|
|
|
|
xwindow);
|
2002-11-06 16:00:56 +00:00
|
|
|
|
|
|
|
if (meta_is_debugging ())
|
|
|
|
{
|
|
|
|
int result;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-11-06 16:00:56 +00:00
|
|
|
result = meta_error_trap_pop_with_return (display, FALSE);
|
|
|
|
|
|
|
|
if (result != Success)
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ungrabbing all keys on 0x%lx failed\n", xwindow);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
meta_error_trap_pop (display, FALSE);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_screen_grab_keys (MetaScreen *screen)
|
2001-06-23 05:49:35 +00:00
|
|
|
{
|
2002-07-01 03:20:29 +00:00
|
|
|
if (screen->all_keys_grabbed)
|
|
|
|
return;
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
if (screen->keys_grabbed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
grab_keys (screen->display->screen_bindings,
|
|
|
|
screen->display->n_screen_bindings,
|
|
|
|
screen->display, screen->xroot);
|
|
|
|
|
|
|
|
screen->keys_grabbed = TRUE;
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_ungrab_keys (MetaScreen *screen)
|
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
if (screen->keys_grabbed)
|
|
|
|
{
|
|
|
|
ungrab_all_keys (screen->display, screen->xroot);
|
|
|
|
screen->keys_grabbed = FALSE;
|
|
|
|
}
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_grab_keys (MetaWindow *window)
|
|
|
|
{
|
2001-07-11 06:22:00 +00:00
|
|
|
if (window->all_keys_grabbed)
|
|
|
|
return;
|
2003-02-27 22:44:36 +00:00
|
|
|
|
|
|
|
if (window->type == META_WINDOW_DOCK)
|
|
|
|
{
|
|
|
|
if (window->keys_grabbed)
|
|
|
|
ungrab_all_keys (window->display, window->xwindow);
|
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
return;
|
|
|
|
}
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
if (window->keys_grabbed)
|
|
|
|
{
|
|
|
|
if (window->frame && !window->grab_on_frame)
|
2002-04-28 04:52:26 +00:00
|
|
|
ungrab_all_keys (window->display, window->xwindow);
|
2001-06-23 05:49:35 +00:00
|
|
|
else if (window->frame == NULL &&
|
|
|
|
window->grab_on_frame)
|
|
|
|
; /* continue to regrab on client window */
|
|
|
|
else
|
|
|
|
return; /* already all good */
|
|
|
|
}
|
2001-06-23 06:54:28 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
grab_keys (window->display->window_bindings,
|
|
|
|
window->display->n_window_bindings,
|
|
|
|
window->display,
|
2001-06-23 05:49:35 +00:00
|
|
|
window->frame ? window->frame->xwindow : window->xwindow);
|
|
|
|
|
|
|
|
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 04:52:26 +00:00
|
|
|
ungrab_all_keys (window->display,
|
|
|
|
window->frame->xwindow);
|
2001-06-23 05:49:35 +00:00
|
|
|
else if (!window->grab_on_frame)
|
2002-04-28 04:52:26 +00:00
|
|
|
ungrab_all_keys (window->display,
|
|
|
|
window->xwindow);
|
2002-06-09 00:09:01 +00:00
|
|
|
|
|
|
|
window->keys_grabbed = FALSE;
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-21 22:40:25 +00: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 05:08:32 +00:00
|
|
|
static gboolean
|
2002-07-02 05:03:28 +00:00
|
|
|
grab_keyboard (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2002-06-27 05:08:32 +00:00
|
|
|
{
|
|
|
|
int result;
|
2003-01-21 22:40:25 +00:00
|
|
|
int grab_status;
|
|
|
|
Time timestamp;
|
|
|
|
|
2002-07-02 05:03:28 +00:00
|
|
|
/* Grab the keyboard, so we get key releases and all key
|
2002-06-27 05:08:32 +00:00
|
|
|
* presses
|
|
|
|
*/
|
2002-10-21 21:44:35 +00:00
|
|
|
meta_error_trap_push_with_return (display);
|
2002-06-27 05:08:32 +00:00
|
|
|
|
2003-01-21 22:40:25 +00:00
|
|
|
timestamp = meta_display_get_current_time (display);
|
|
|
|
grab_status = XGrabKeyboard (display->xdisplay,
|
|
|
|
xwindow, True,
|
|
|
|
GrabModeAsync, GrabModeAsync,
|
|
|
|
timestamp);
|
|
|
|
|
|
|
|
if (grab_status != GrabSuccess)
|
2002-06-27 05:08:32 +00:00
|
|
|
{
|
2002-10-21 21:44:35 +00:00
|
|
|
meta_error_trap_pop_with_return (display, TRUE);
|
2002-06-27 05:08:32 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2003-01-21 22:40:25 +00:00
|
|
|
"XGrabKeyboard() returned failure status %s time %lu\n",
|
|
|
|
grab_status_to_string (grab_status),
|
|
|
|
(unsigned long) timestamp);
|
|
|
|
return FALSE;
|
2002-10-21 21:44:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result = meta_error_trap_pop_with_return (display, TRUE);
|
|
|
|
if (result != Success)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"XGrabKeyboard() resulted in an error\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-06-27 05:08:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS, "Grabbed all keys\n");
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-07-02 05:03:28 +00:00
|
|
|
ungrab_keyboard (MetaDisplay *display)
|
2002-06-27 05:08:32 +00:00
|
|
|
{
|
|
|
|
Time timestamp;
|
|
|
|
|
|
|
|
timestamp = meta_display_get_current_time (display);
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ungrabbing keyboard with timestamp %lu\n",
|
|
|
|
timestamp);
|
|
|
|
XUngrabKeyboard (display->xdisplay, timestamp);
|
2002-10-21 21:44:35 +00:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
2002-06-27 05:08:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_screen_grab_all_keys (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
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");
|
2002-07-02 05:03:28 +00:00
|
|
|
retval = grab_keyboard (screen->display, screen->xroot);
|
2002-06-27 05:08:32 +00:00
|
|
|
if (retval)
|
2002-07-01 03:20:29 +00:00
|
|
|
screen->all_keys_grabbed = TRUE;
|
|
|
|
else
|
|
|
|
meta_screen_grab_keys (screen);
|
2002-06-27 05:08:32 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_screen_ungrab_all_keys (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
if (screen->all_keys_grabbed)
|
|
|
|
{
|
2002-07-02 05:03:28 +00:00
|
|
|
ungrab_keyboard (screen->display);
|
2002-06-27 05:08:32 +00:00
|
|
|
|
|
|
|
screen->all_keys_grabbed = FALSE;
|
|
|
|
screen->keys_grabbed = FALSE;
|
|
|
|
|
|
|
|
/* Re-establish our standard bindings */
|
|
|
|
meta_screen_grab_keys (screen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
gboolean
|
|
|
|
meta_window_grab_all_keys (MetaWindow *window)
|
|
|
|
{
|
|
|
|
Window grabwindow;
|
2002-06-27 05:08:32 +00:00
|
|
|
gboolean retval;
|
2001-07-11 06:22:00 +00: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 23:28:19 +00:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing %s because we're grabbing all its keys\n",
|
|
|
|
window->desc);
|
|
|
|
meta_window_focus (window,
|
|
|
|
meta_display_get_current_time (window->display));
|
2001-07-11 06:22:00 +00:00
|
|
|
|
|
|
|
grabwindow = window->frame ? window->frame->xwindow : window->xwindow;
|
2002-06-27 05:08:32 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Grabbing all keys on window %s\n", window->desc);
|
2002-07-02 05:03:28 +00:00
|
|
|
retval = grab_keyboard (window->display, grabwindow);
|
2002-06-27 05:08:32 +00:00
|
|
|
if (retval)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2002-06-27 05:08:32 +00:00
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
window->all_keys_grabbed = TRUE;
|
|
|
|
window->grab_on_frame = window->frame != NULL;
|
2001-07-11 06:22:00 +00:00
|
|
|
}
|
2002-01-03 23:28:19 +00:00
|
|
|
|
2002-06-27 05:08:32 +00:00
|
|
|
return retval;
|
2001-07-11 06:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-07-02 05:03:28 +00:00
|
|
|
meta_window_ungrab_all_keys (MetaWindow *window)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
|
|
|
if (window->all_keys_grabbed)
|
|
|
|
{
|
2002-07-02 05:03:28 +00:00
|
|
|
ungrab_keyboard (window->display);
|
2002-01-03 23:28:19 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
window->grab_on_frame = FALSE;
|
|
|
|
window->all_keys_grabbed = FALSE;
|
|
|
|
window->keys_grabbed = FALSE;
|
|
|
|
|
|
|
|
/* Re-establish our standard bindings */
|
|
|
|
meta_window_grab_keys (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
is_modifier (MetaDisplay *display,
|
|
|
|
unsigned int keycode)
|
|
|
|
{
|
2001-08-19 18:09:10 +00:00
|
|
|
int i;
|
|
|
|
int map_size;
|
2002-04-28 04:52:26 +00:00
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_assert (display->modmap);
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
map_size = 8 * display->modmap->max_keypermod;
|
2001-08-19 18:09:10 +00:00
|
|
|
i = 0;
|
|
|
|
while (i < map_size)
|
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
if (keycode == display->modmap->modifiermap[i])
|
2001-08-19 18:09:10 +00:00
|
|
|
{
|
|
|
|
retval = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
/* Indexes:
|
|
|
|
* shift = 0
|
|
|
|
* lock = 1
|
|
|
|
* control = 2
|
|
|
|
* mod1 = 3
|
|
|
|
* mod2 = 4
|
|
|
|
* mod3 = 5
|
|
|
|
* mod4 = 6
|
|
|
|
* mod5 = 7
|
|
|
|
*/
|
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
static gboolean
|
2002-04-28 04:52:26 +00:00
|
|
|
is_specific_modifier (MetaDisplay *display,
|
|
|
|
unsigned int keycode,
|
|
|
|
unsigned int mask)
|
2001-08-19 18:09:10 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int end;
|
|
|
|
gboolean retval = FALSE;
|
2002-04-28 04:52:26 +00:00
|
|
|
int mod_index;
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2002-04-28 04:52:26 +00: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 18:09:10 +00:00
|
|
|
|
2002-04-28 04:52:26 +00: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 18:09:10 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
end = (mod_index + 1) * display->modmap->max_keypermod;
|
|
|
|
i = mod_index * display->modmap->max_keypermod;
|
2001-08-19 18:09:10 +00:00
|
|
|
while (i < end)
|
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
if (keycode == display->modmap->modifiermap[i])
|
2001-08-19 18:09:10 +00:00
|
|
|
{
|
|
|
|
retval = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
2001-07-11 06:22:00 +00:00
|
|
|
}
|
|
|
|
|
2003-01-21 22:40:25 +00:00
|
|
|
static unsigned int
|
|
|
|
get_primary_modifier (MetaDisplay *display,
|
|
|
|
unsigned int entire_binding_mask)
|
2002-04-28 04:52:26 +00: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 22:40:25 +00:00
|
|
|
return masks[i];
|
2002-04-28 04:52:26 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2003-01-21 22:40:25 +00: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 06:24:30 +00:00
|
|
|
MetaScreen *random_screen;
|
|
|
|
Window random_xwindow;
|
2003-01-21 22:40:25 +00:00
|
|
|
|
|
|
|
primary_modifier = get_primary_modifier (display, entire_binding_mask);
|
|
|
|
|
2005-12-28 06:24:30 +00:00
|
|
|
random_screen = display->screens->data;
|
|
|
|
random_xwindow = random_screen->no_focus_window;
|
2003-01-21 22:40:25 +00:00
|
|
|
XQueryPointer (display->xdisplay,
|
2005-12-28 06:24:30 +00:00
|
|
|
random_xwindow, /* some random window */
|
2003-01-21 22:40:25 +00: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 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const MetaKeyHandler*
|
|
|
|
find_handler (const MetaKeyHandler *handlers,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
const MetaKeyHandler *iter;
|
|
|
|
|
|
|
|
iter = handlers;
|
|
|
|
while (iter->name)
|
|
|
|
{
|
|
|
|
if (strcmp (iter->name,
|
|
|
|
name) == 0)
|
|
|
|
return iter;
|
|
|
|
|
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
process_event (MetaKeyBinding *bindings,
|
|
|
|
int n_bindings,
|
|
|
|
const MetaKeyHandler *handlers,
|
|
|
|
MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-06-16 03:03:08 +00:00
|
|
|
/* we used to have release-based bindings but no longer. */
|
|
|
|
if (event->type == KeyRelease)
|
|
|
|
return;
|
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
i = 0;
|
2002-04-28 04:52:26 +00:00
|
|
|
while (i < n_bindings)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2003-02-05 03:58:17 +00:00
|
|
|
if (bindings[i].keycode == event->xkey.keycode &&
|
2002-04-28 04:52:26 +00:00
|
|
|
((event->xkey.state & ~(display->ignored_modifier_mask)) ==
|
2001-06-24 02:22:10 +00:00
|
|
|
bindings[i].mask) &&
|
2002-04-28 04:52:26 +00:00
|
|
|
event->type == KeyPress)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
const MetaKeyHandler *handler;
|
|
|
|
|
2003-02-22 20:31:51 +00: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);
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
if (bindings[i].handler)
|
|
|
|
handler = bindings[i].handler;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
handler = find_handler (handlers, bindings[i].name);
|
|
|
|
bindings[i].handler = handler; /* cache */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handler == NULL)
|
|
|
|
meta_bug ("Binding %s has no handler\n", bindings[i].name);
|
2002-06-16 03:03:08 +00:00
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Running handler for %s\n",
|
|
|
|
bindings[i].name);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2006-01-15 17:03:57 +00:00
|
|
|
/* Global keybindings count as a let-the-terminal-lose-focus
|
|
|
|
* due to new window mapping until the user starts
|
|
|
|
* interacting with the terminal again.
|
|
|
|
*/
|
|
|
|
display->allow_terminal_deactivation = TRUE;
|
|
|
|
|
2002-10-16 20:12:24 +00:00
|
|
|
(* handler->func) (display, screen, window, event,
|
2002-04-28 04:52:26 +00:00
|
|
|
&bindings[i]);
|
2002-06-16 03:03:08 +00:00
|
|
|
return;
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-06-16 03:03:08 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"No handler found for this event in this binding table\n");
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
2002-06-27 05:08:32 +00:00
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
void
|
2001-06-24 02:22:10 +00:00
|
|
|
meta_display_process_key_event (MetaDisplay *display,
|
2001-06-23 05:49:35 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
2001-07-11 06:22:00 +00:00
|
|
|
KeySym keysym;
|
|
|
|
gboolean handled;
|
2002-06-27 05:08:32 +00:00
|
|
|
gboolean all_keys_grabbed;
|
2002-06-16 03:03:08 +00:00
|
|
|
const char *str;
|
2002-06-27 05:08:32 +00:00
|
|
|
MetaScreen *screen;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2002-02-08 06:01:58 +00:00
|
|
|
XAllowEvents (display->xdisplay,
|
|
|
|
all_bindings_disabled ? ReplayKeyboard : AsyncKeyboard,
|
|
|
|
event->xkey.time);
|
|
|
|
if (all_bindings_disabled)
|
|
|
|
return;
|
2002-06-27 05:08:32 +00:00
|
|
|
|
2002-10-16 20:12:24 +00: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 05:08:32 +00:00
|
|
|
|
2002-07-23 19:12:02 +00:00
|
|
|
if (screen == NULL)
|
|
|
|
return; /* event window is destroyed */
|
2002-10-16 20:12:24 +00:00
|
|
|
|
2002-08-10 15:55:18 +00:00
|
|
|
/* ignore key events on popup menus and such. */
|
|
|
|
if (window == NULL &&
|
|
|
|
meta_ui_window_is_widget (screen->ui, event->xany.window))
|
|
|
|
return;
|
2002-07-23 19:12:02 +00:00
|
|
|
|
2002-08-10 15:55:18 +00:00
|
|
|
/* window may be NULL */
|
2001-07-11 06:22:00 +00:00
|
|
|
|
|
|
|
keysym = XKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0);
|
2002-06-16 03:03:08 +00:00
|
|
|
|
|
|
|
str = XKeysymToString (keysym);
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2002-04-28 04:52:26 +00: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 20:18:54 +00:00
|
|
|
str ? str : "none", event->xkey.state,
|
2002-04-28 04:52:26 +00:00
|
|
|
window ? window->desc : "(no window)");
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2002-06-27 05:08:32 +00:00
|
|
|
all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed;
|
|
|
|
if (!all_keys_grabbed)
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
|
|
|
/* Do the normal keybindings */
|
2002-04-28 04:52:26 +00:00
|
|
|
process_event (display->screen_bindings,
|
|
|
|
display->n_screen_bindings,
|
|
|
|
screen_handlers,
|
2002-10-16 20:12:24 +00:00
|
|
|
display, screen, NULL, event, keysym);
|
2001-07-26 03:58:24 +00:00
|
|
|
|
|
|
|
if (window)
|
2002-04-28 04:52:26 +00:00
|
|
|
process_event (display->window_bindings,
|
|
|
|
display->n_window_bindings,
|
|
|
|
window_handlers,
|
2002-10-16 20:12:24 +00:00
|
|
|
display, screen, window, event, keysym);
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
if (display->grab_op == META_GRAB_OP_NONE)
|
|
|
|
return;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
|
|
|
/* If we get here we have a global grab, because
|
|
|
|
* we're in some special keyboard mode such as window move
|
|
|
|
* mode.
|
|
|
|
*/
|
|
|
|
|
|
|
|
handled = FALSE;
|
2001-07-26 03:14:45 +00:00
|
|
|
|
2002-06-27 05:08:32 +00:00
|
|
|
if (window ? (window == display->grab_window) :
|
|
|
|
(screen == display->grab_screen))
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2001-08-19 18:09:10 +00:00
|
|
|
switch (display->grab_op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_KEYBOARD_MOVING:
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Processing event for keyboard move\n");
|
2002-06-27 05:08:32 +00:00
|
|
|
g_assert (window != NULL);
|
2002-10-16 20:12:24 +00:00
|
|
|
handled = process_keyboard_move_grab (display, screen,
|
|
|
|
window, event, keysym);
|
2001-08-19 18:09:10 +00:00
|
|
|
break;
|
2002-06-19 04:12:49 +00:00
|
|
|
|
|
|
|
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");
|
2002-06-27 05:08:32 +00:00
|
|
|
g_assert (window != NULL);
|
2002-10-16 20:12:24 +00:00
|
|
|
handled = process_keyboard_resize_grab (display, screen,
|
|
|
|
window, event, keysym);
|
2002-06-19 04:12:49 +00:00
|
|
|
break;
|
|
|
|
|
2002-04-05 15:52:49 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
|
2002-07-06 16:50:48 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2002-07-06 16:50:48 +00:00
|
|
|
"Processing event for keyboard tabbing/cycling\n");
|
2002-10-16 20:12:24 +00:00
|
|
|
handled = process_tab_grab (display, screen, event, keysym);
|
2001-08-19 18:09:10 +00:00
|
|
|
break;
|
2002-07-06 16:50:48 +00:00
|
|
|
|
2002-06-09 04:04:19 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
2002-06-09 03:44:16 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2002-06-09 04:04:19 +00:00
|
|
|
"Processing event for keyboard workspace switching\n");
|
2002-10-16 20:12:24 +00:00
|
|
|
handled = process_workspace_switch_grab (display, screen, event, keysym);
|
2002-06-09 03:44:16 +00:00
|
|
|
break;
|
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end grab if a key that isn't used gets pressed */
|
|
|
|
if (!handled)
|
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2006-01-20 22:03:56 +00:00
|
|
|
"Ending grab op %u on key event sym %s\n",
|
2002-04-28 04:52:26 +00:00
|
|
|
display->grab_op, XKeysymToString (keysym));
|
2001-08-19 18:09:10 +00:00
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
process_keyboard_move_grab (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2001-08-19 18:09:10 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
|
|
|
{
|
|
|
|
gboolean handled;
|
|
|
|
int x, y;
|
|
|
|
int incr;
|
|
|
|
gboolean smart_snap;
|
|
|
|
|
|
|
|
handled = FALSE;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
/* don't care about releases, but eat them, don't end grab */
|
|
|
|
if (event->type == KeyRelease)
|
|
|
|
return TRUE;
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
/* don't end grab on modifier key presses */
|
|
|
|
if (is_modifier (display, event->xkey.keycode))
|
|
|
|
return TRUE;
|
|
|
|
|
2003-10-12 06:25:38 +00:00
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
{
|
|
|
|
x = display->grab_wireframe_rect.x;
|
|
|
|
y = display->grab_wireframe_rect.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_window_get_position (window, &x, &y);
|
|
|
|
}
|
2001-08-19 18:09:10 +00:00
|
|
|
|
|
|
|
smart_snap = (event->xkey.state & ShiftMask) != 0;
|
2003-10-12 06:25:38 +00:00
|
|
|
|
2001-07-11 06:22:00 +00:00
|
|
|
#define SMALL_INCREMENT 1
|
|
|
|
#define NORMAL_INCREMENT 10
|
|
|
|
|
2001-08-19 18:09:10 +00: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 14:58:50 +00:00
|
|
|
incr = 1;
|
2001-08-19 18:09:10 +00:00
|
|
|
else if (event->xkey.state & ControlMask)
|
|
|
|
incr = SMALL_INCREMENT;
|
|
|
|
else
|
|
|
|
incr = NORMAL_INCREMENT;
|
2001-07-12 05:53:56 +00:00
|
|
|
|
2003-04-25 03:32:41 +00:00
|
|
|
if (keysym == XK_Escape)
|
|
|
|
{
|
2003-10-12 06:25:38 +00:00
|
|
|
/* End resize and restore to original state.
|
|
|
|
* The move_resize is only needed when !wireframe
|
|
|
|
* since in wireframe we always moveresize at the end
|
|
|
|
* of the grab only.
|
|
|
|
*/
|
2006-08-07 19:24:41 +00:00
|
|
|
if (!display->grab_wireframe_active && !window->shaken_loose)
|
2005-08-03 02:22:00 +00: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);
|
2006-08-07 19:24:41 +00:00
|
|
|
if(window->shaken_loose)
|
|
|
|
meta_window_maximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2003-10-12 06:25:38 +00:00
|
|
|
display->grab_was_cancelled = TRUE;
|
2003-04-25 03:32:41 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
/* When moving by increments, we still snap to edges if the move
|
|
|
|
* to the edge is smaller than the increment. This is because
|
|
|
|
* Shift + arrow to snap is sort of a hidden feature. This way
|
|
|
|
* people using just arrows shouldn't get too frustrated.
|
|
|
|
*/
|
2001-08-19 18:09:10 +00:00
|
|
|
switch (keysym)
|
|
|
|
{
|
2003-04-25 03:32:41 +00:00
|
|
|
case XK_KP_Home:
|
|
|
|
case XK_KP_Prior:
|
2001-08-19 18:09:10 +00:00
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
|
|
|
y -= incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2003-04-25 03:32:41 +00:00
|
|
|
case XK_KP_End:
|
|
|
|
case XK_KP_Next:
|
2001-08-19 18:09:10 +00:00
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
|
|
|
y += incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2003-04-25 03:32:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_KP_Home:
|
|
|
|
case XK_KP_End:
|
2001-08-19 18:09:10 +00:00
|
|
|
case XK_Left:
|
|
|
|
case XK_KP_Left:
|
|
|
|
x -= incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
2003-04-25 03:32:41 +00:00
|
|
|
case XK_KP_Prior:
|
|
|
|
case XK_KP_Next:
|
2001-08-19 18:09:10 +00:00
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
|
|
|
x += incr;
|
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2001-07-12 05:53:56 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
if (handled)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
MetaRectangle old_rect;
|
2003-10-12 06:25:38 +00: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 14:58:50 +00:00
|
|
|
|
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
old_rect = display->grab_wireframe_rect;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
old_rect = window->rect;
|
|
|
|
meta_window_get_position (window, &old_rect.x, &old_rect.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_window_edge_resistance_for_move (window,
|
|
|
|
old_rect.x,
|
|
|
|
old_rect.y,
|
|
|
|
&x,
|
|
|
|
&y,
|
|
|
|
NULL,
|
|
|
|
smart_snap,
|
|
|
|
TRUE);
|
|
|
|
|
2003-10-12 06:25:38 +00:00
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
{
|
2005-05-26 19:58:17 +00:00
|
|
|
meta_window_update_wireframe (window, x, y,
|
|
|
|
display->grab_wireframe_rect.width,
|
|
|
|
display->grab_wireframe_rect.height);
|
2003-10-12 06:25:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_window_move (window, TRUE, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_window_update_keyboard_move (window);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
}
|
2001-07-11 06:22:00 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
static gboolean
|
2005-08-03 02:22:00 +00:00
|
|
|
process_keyboard_resize_grab_op_change (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
2002-06-19 04:12:49 +00:00
|
|
|
{
|
|
|
|
gboolean handled;
|
|
|
|
|
2005-08-03 02:22:00 +00:00
|
|
|
handled = FALSE;
|
2002-06-19 04:12:49 +00:00
|
|
|
switch (display->grab_op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
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-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Left:
|
|
|
|
case XK_KP_Left:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
|
|
|
switch (keysym)
|
|
|
|
{
|
|
|
|
case XK_Up:
|
|
|
|
case XK_KP_Up:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
case XK_Down:
|
|
|
|
case XK_KP_Down:
|
2005-08-03 02:22:00 +00:00
|
|
|
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
2002-06-19 04:12:49 +00:00
|
|
|
handled = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handled)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
{
|
2003-10-12 06:25:38 +00:00
|
|
|
meta_window_update_keyboard_resize (window, TRUE);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
return TRUE;
|
2003-10-12 06:25:38 +00:00
|
|
|
}
|
2002-06-19 04:12:49 +00:00
|
|
|
|
2005-08-03 02:22:00 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
/* End resize and restore to original state.
|
|
|
|
* The move_resize is only needed when !wireframe
|
|
|
|
* since in wireframe we always moveresize at the end
|
|
|
|
* of the grab only.
|
|
|
|
*/
|
|
|
|
if (!display->grab_wireframe_active)
|
|
|
|
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);
|
|
|
|
display->grab_was_cancelled = TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process_keyboard_resize_grab_op_change (display, screen, window,
|
|
|
|
event, keysym))
|
|
|
|
return TRUE;
|
|
|
|
|
2003-10-12 06:25:38 +00:00
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
{
|
|
|
|
width = display->grab_wireframe_rect.width;
|
|
|
|
height = display->grab_wireframe_rect.height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
width = window->rect.width;
|
|
|
|
height = window->rect.height;
|
|
|
|
}
|
2002-06-19 04:12:49 +00:00
|
|
|
|
|
|
|
gravity = meta_resize_gravity_from_grab_op (display->grab_op);
|
|
|
|
|
2003-10-12 06:25:38 +00:00
|
|
|
smart_snap = (event->xkey.state & ShiftMask) != 0;
|
|
|
|
|
2002-06-19 04:12:49 +00: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 14:58:50 +00:00
|
|
|
height_inc = 1;
|
|
|
|
width_inc = 1;
|
2002-06-19 04:12:49 +00: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 14:58:50 +00:00
|
|
|
width_inc = SMALL_INCREMENT;
|
|
|
|
height_inc = SMALL_INCREMENT;
|
2002-06-19 04:12:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width_inc = NORMAL_INCREMENT;
|
|
|
|
height_inc = NORMAL_INCREMENT;
|
2002-06-19 04:12:49 +00:00
|
|
|
}
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
|
|
|
|
/* If this is a resize increment window, make the amount we resize
|
|
|
|
* the window by match that amount (well, unless snap resizing...)
|
2002-06-19 04:12:49 +00:00
|
|
|
*/
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window->size_hints.width_inc > 1)
|
|
|
|
width_inc = window->size_hints.width_inc;
|
|
|
|
if (window->size_hints.height_inc > 1)
|
|
|
|
height_inc = window->size_hints.height_inc;
|
|
|
|
|
2002-06-19 04:12:49 +00: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 14:58:50 +00:00
|
|
|
height -= height_inc;
|
2002-06-19 04:12:49 +00: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 14:58:50 +00:00
|
|
|
height += height_inc;
|
2002-06-19 04:12:49 +00: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 14:58:50 +00:00
|
|
|
height -= height_inc;
|
2002-06-19 04:12:49 +00: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-03 02:32:40 +00:00
|
|
|
switch (gravity)
|
|
|
|
{
|
|
|
|
case EastGravity:
|
|
|
|
case SouthEastGravity:
|
|
|
|
case NorthEastGravity:
|
2005-08-03 02:22:00 +00:00
|
|
|
/* Move left edge left */
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
width += width_inc;
|
2002-07-03 02:32:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
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 14:58:50 +00:00
|
|
|
width -= width_inc;
|
2002-07-03 02:32:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NorthGravity:
|
|
|
|
case SouthGravity:
|
|
|
|
case CenterGravity:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
handled = TRUE;
|
2002-06-19 04:12:49 +00:00
|
|
|
break;
|
2002-07-03 02:32:40 +00:00
|
|
|
|
2002-06-19 04:12:49 +00:00
|
|
|
case XK_Right:
|
|
|
|
case XK_KP_Right:
|
2002-07-03 02:32:40 +00: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 14:58:50 +00:00
|
|
|
width -= width_inc;
|
2002-07-03 02:32:40 +00: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 04:12:49 +00: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 04:27:23 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
MetaRectangle old_rect;
|
2003-10-12 06:25:38 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
"Computed new window size due to keypress: "
|
|
|
|
"%dx%d, gravity %s\n",
|
|
|
|
width, height, meta_gravity_to_string (gravity));
|
2003-10-12 06:25:38 +00:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
old_rect = display->grab_wireframe_rect;
|
|
|
|
else
|
|
|
|
old_rect = window->rect; /* Don't actually care about x,y */
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2003-10-12 06:25:38 +00:00
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
MetaRectangle new_position;
|
|
|
|
meta_rectangle_resize_with_gravity (&display->grab_wireframe_rect,
|
|
|
|
&new_position,
|
|
|
|
gravity,
|
|
|
|
width,
|
|
|
|
height);
|
|
|
|
meta_window_update_wireframe (window,
|
|
|
|
new_position.x,
|
|
|
|
new_position.y,
|
|
|
|
new_position.width,
|
|
|
|
new_position.height);
|
2003-10-12 06:25:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
/* 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 06:25:38 +00:00
|
|
|
}
|
|
|
|
meta_window_update_keyboard_resize (window, FALSE);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
}
|
2002-06-19 04:12:49 +00:00
|
|
|
|
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
|
2004-10-20 23:16:08 +00: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 18:09:10 +00:00
|
|
|
static gboolean
|
|
|
|
process_tab_grab (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2001-08-19 18:09:10 +00:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
|
|
|
{
|
2002-06-09 03:44:16 +00:00
|
|
|
MetaKeyBindingAction action;
|
2002-07-06 16:50:48 +00:00
|
|
|
gboolean popup_not_showing;
|
2002-10-18 22:19:05 +00:00
|
|
|
gboolean backward;
|
|
|
|
gboolean key_used;
|
2006-02-13 19:26:40 +00:00
|
|
|
Window prev_xwindow;
|
|
|
|
MetaWindow *prev_window;
|
2002-10-16 20:12:24 +00:00
|
|
|
|
|
|
|
if (screen != display->grab_screen)
|
|
|
|
return FALSE;
|
2001-08-19 18:09:10 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
|
2004-10-20 23:16:08 +00:00
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
if (event->type == KeyRelease &&
|
2004-10-20 23:16:08 +00:00
|
|
|
end_keyboard_grab (display, event->xkey.keycode))
|
2001-07-11 06:22:00 +00:00
|
|
|
{
|
2001-08-19 18:09:10 +00:00
|
|
|
/* We're done, move to the new window. */
|
|
|
|
Window target_xwindow;
|
|
|
|
MetaWindow *target_window;
|
|
|
|
|
|
|
|
target_xwindow =
|
2002-06-09 03:44:16 +00:00
|
|
|
(Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
2001-08-19 18:09:10 +00:00
|
|
|
target_window =
|
|
|
|
meta_display_lookup_x_window (display, target_xwindow);
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ending tab operation, primary modifier released\n");
|
2001-08-19 18:09:10 +00:00
|
|
|
|
|
|
|
if (target_window)
|
|
|
|
{
|
2005-10-03 20:02:31 +00:00
|
|
|
target_window->tab_unminimized = FALSE;
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Activating target window\n");
|
2001-10-29 07:00:46 +00:00
|
|
|
|
2005-02-22 02:11:25 +00:00
|
|
|
meta_topic (META_DEBUG_FOCUS, "Activating %s due to tab popup "
|
|
|
|
"selection and turning mouse_mode off\n",
|
2002-01-03 23:28:19 +00:00
|
|
|
target_window->desc);
|
2005-02-22 02:11:25 +00:00
|
|
|
display->mouse_mode = FALSE;
|
2001-10-29 07:00:46 +00:00
|
|
|
meta_window_activate (target_window, event->xkey.time);
|
2001-08-19 18:09:10 +00:00
|
|
|
|
2003-07-01 14:59:09 +00: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 18:09:10 +00: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;
|
|
|
|
|
2006-02-13 19:26:40 +00:00
|
|
|
prev_xwindow = (Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
|
|
|
prev_window = meta_display_lookup_x_window (display, prev_xwindow);
|
2002-07-14 03:16:41 +00:00
|
|
|
action = display_get_keybinding_action (display,
|
|
|
|
keysym,
|
|
|
|
display->grab_mask);
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2006-02-13 19:16:32 +00:00
|
|
|
/* Cancel when alt-Escape is pressed during using alt-Tab, and vice
|
|
|
|
* versa.
|
2002-07-06 16:50:48 +00:00
|
|
|
*/
|
2006-02-13 19:16:32 +00: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-15 02:05:44 +00:00
|
|
|
switch (display->grab_op)
|
2006-02-13 19:16:32 +00:00
|
|
|
{
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
|
|
|
|
/* carry on */
|
|
|
|
break;
|
|
|
|
default:
|
2006-02-13 19:16:32 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2006-04-15 02:05:44 +00:00
|
|
|
break;
|
2006-02-13 19:16:32 +00: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-15 02:05:44 +00:00
|
|
|
switch (display->grab_op)
|
2006-02-13 19:16:32 +00:00
|
|
|
{
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
|
|
|
/* carry on */
|
|
|
|
break;
|
|
|
|
default:
|
2006-02-13 19:16:32 +00: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-15 02:05:44 +00: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 19:16:32 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-07-06 16:50:48 +00:00
|
|
|
popup_not_showing = FALSE;
|
2002-10-18 22:19:05 +00:00
|
|
|
key_used = FALSE;
|
|
|
|
backward = FALSE;
|
|
|
|
|
2002-06-09 03:44:16 +00:00
|
|
|
switch (action)
|
2001-08-19 18:09:10 +00:00
|
|
|
{
|
2002-07-06 16:50:48 +00:00
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS:
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP:
|
2002-07-06 16:50:48 +00:00
|
|
|
popup_not_showing = TRUE;
|
2002-10-18 22:19:05 +00:00
|
|
|
key_used = TRUE;
|
|
|
|
break;
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD:
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD:
|
2002-10-18 22:19:05 +00:00
|
|
|
popup_not_showing = TRUE;
|
|
|
|
key_used = TRUE;
|
|
|
|
backward = TRUE;
|
|
|
|
break;
|
2002-06-09 03:44:16 +00:00
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS:
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP:
|
2002-10-18 22:19:05 +00:00
|
|
|
key_used = TRUE;
|
|
|
|
break;
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD:
|
|
|
|
case META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD:
|
2006-04-15 02:05:44 +00:00
|
|
|
case META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD:
|
2002-10-18 22:19:05 +00:00
|
|
|
key_used = TRUE;
|
|
|
|
backward = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key_used)
|
|
|
|
{
|
2002-07-06 16:50:48 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Key pressed, moving tab focus in popup\n");
|
|
|
|
|
2001-08-19 18:09:10 +00:00
|
|
|
if (event->xkey.state & ShiftMask)
|
2002-10-18 22:19:05 +00:00
|
|
|
backward = !backward;
|
|
|
|
|
|
|
|
if (backward)
|
2001-08-19 18:09:10 +00:00
|
|
|
meta_ui_tab_popup_backward (screen->tab_popup);
|
|
|
|
else
|
|
|
|
meta_ui_tab_popup_forward (screen->tab_popup);
|
2002-10-18 22:19:05 +00:00
|
|
|
|
2002-07-06 16:50:48 +00:00
|
|
|
if (popup_not_showing)
|
|
|
|
{
|
|
|
|
/* We can't actually change window focus, due to the grab.
|
|
|
|
* but raise the window.
|
|
|
|
*/
|
|
|
|
Window target_xwindow;
|
|
|
|
MetaWindow *target_window;
|
2005-10-03 20:05:44 +00:00
|
|
|
|
|
|
|
meta_stack_set_positions (screen->stack,
|
|
|
|
display->grab_old_window_stacking);
|
|
|
|
|
2002-07-06 16:50:48 +00:00
|
|
|
target_xwindow =
|
|
|
|
(Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
|
|
|
target_window =
|
|
|
|
meta_display_lookup_x_window (display, target_xwindow);
|
|
|
|
|
2005-10-03 20:02:31 +00:00
|
|
|
if (prev_window && prev_window->tab_unminimized)
|
|
|
|
{
|
|
|
|
prev_window->tab_unminimized = FALSE;
|
|
|
|
meta_window_minimize (prev_window);
|
|
|
|
}
|
|
|
|
|
2002-07-06 16:50:48 +00:00
|
|
|
if (target_window)
|
|
|
|
{
|
|
|
|
meta_window_raise (target_window);
|
2005-10-03 20:02:31 +00:00
|
|
|
target_window->tab_unminimized = target_window->minimized;
|
|
|
|
meta_window_unminimize (target_window);
|
2002-07-06 16:50:48 +00:00
|
|
|
}
|
|
|
|
}
|
2001-07-11 06:22:00 +00:00
|
|
|
}
|
2002-10-18 22:19:05 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* end grab */
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ending tabbing/cycling, uninteresting key pressed\n");
|
2005-01-24 05:58:30 +00: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 20:02:31 +00:00
|
|
|
|
|
|
|
if (prev_window && prev_window->tab_unminimized)
|
|
|
|
{
|
|
|
|
meta_window_minimize (prev_window);
|
|
|
|
prev_window->tab_unminimized = FALSE;
|
|
|
|
}
|
2002-10-18 22:19:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return key_used;
|
2001-06-23 05:49:35 +00:00
|
|
|
}
|
2001-06-06 04:47:37 +00:00
|
|
|
|
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
handle_activate_workspace (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
|
|
|
int which;
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
which = GPOINTER_TO_INT (binding->handler->data);
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
workspace = NULL;
|
|
|
|
if (which < 0)
|
2002-10-16 20:12:24 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
workspace = meta_workspace_get_neighbor (screen->active_workspace,
|
|
|
|
which);
|
2001-08-03 13:56:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-16 20:12:24 +00:00
|
|
|
workspace = meta_screen_get_workspace_by_index (screen, which);
|
2001-08-03 13:56:39 +00: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 20:32:59 +00:00
|
|
|
meta_workspace_activate (workspace, event->xkey.time);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We could offer to create it I suppose */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-11 04:10:44 +00:00
|
|
|
static void
|
2004-10-13 08:32:10 +00:00
|
|
|
error_on_generic_command (const char *key,
|
|
|
|
const char *command,
|
|
|
|
const char *message,
|
|
|
|
int screen_number,
|
|
|
|
Time timestamp)
|
2002-07-11 04:10:44 +00:00
|
|
|
{
|
|
|
|
GError *err;
|
2004-08-26 00:59:12 +00:00
|
|
|
char *argv[10];
|
2003-09-29 16:55:26 +00:00
|
|
|
char numbuf[32];
|
2004-08-26 00:59:12 +00:00
|
|
|
char timestampbuf[32];
|
2002-07-11 04:10:44 +00:00
|
|
|
|
2003-09-29 16:55:26 +00:00
|
|
|
sprintf (numbuf, "%d", screen_number);
|
2004-08-26 00:59:12 +00:00
|
|
|
sprintf (timestampbuf, "%lu", timestamp);
|
2002-07-11 04:10:44 +00:00
|
|
|
|
|
|
|
argv[0] = METACITY_LIBEXECDIR"/metacity-dialog";
|
2003-09-29 16:55:26 +00:00
|
|
|
argv[1] = "--screen";
|
|
|
|
argv[2] = numbuf;
|
2004-08-26 00:59:12 +00:00
|
|
|
argv[3] = "--timestamp";
|
|
|
|
argv[4] = timestampbuf;
|
|
|
|
argv[5] = "--command-failed-error";
|
2004-10-20 23:16:08 +00:00
|
|
|
argv[6] = (char *)key;
|
2004-08-26 00:59:12 +00:00
|
|
|
argv[7] = (char*) (command ? command : "");
|
|
|
|
argv[8] = (char*) message;
|
|
|
|
argv[9] = NULL;
|
2002-07-11 04:10:44 +00:00
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
if (!g_spawn_async_with_pipes ("/",
|
|
|
|
argv,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&err))
|
|
|
|
{
|
|
|
|
meta_warning (_("Error launching metacity-dialog to print an error about a command: %s\n"),
|
|
|
|
err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
2004-10-13 08:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
error_on_command (int command_index,
|
|
|
|
const char *command,
|
|
|
|
const char *message,
|
|
|
|
int screen_number,
|
|
|
|
Time timestamp)
|
|
|
|
{
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
meta_warning ("Error on command %d \"%s\": %s\n",
|
|
|
|
command_index, command, message);
|
|
|
|
|
|
|
|
key = meta_prefs_get_gconf_key_for_command (command_index);
|
|
|
|
|
|
|
|
error_on_generic_command (key, command, message, screen_number, timestamp);
|
2002-07-11 04:10:44 +00:00
|
|
|
|
|
|
|
g_free (key);
|
|
|
|
}
|
|
|
|
|
2004-10-20 23:16:08 +00:00
|
|
|
static void
|
2004-10-13 08:32:10 +00:00
|
|
|
error_on_terminal_command (const char *command,
|
|
|
|
const char *message,
|
|
|
|
int screen_number,
|
|
|
|
Time timestamp)
|
|
|
|
{
|
2004-10-20 23:16:08 +00:00
|
|
|
const char *key;
|
2004-10-13 08:32:10 +00:00
|
|
|
|
|
|
|
meta_warning ("Error on terminal command \"%s\": %s\n", command, message);
|
|
|
|
|
|
|
|
key = meta_prefs_get_gconf_key_for_terminal_command ();
|
|
|
|
|
|
|
|
error_on_generic_command (key, command, message, screen_number, timestamp);
|
|
|
|
}
|
|
|
|
|
2003-09-29 16:55:26 +00:00
|
|
|
static void
|
|
|
|
set_display_setup_func (void *data)
|
|
|
|
{
|
|
|
|
const char *screen_name = data;
|
|
|
|
char *full;
|
|
|
|
|
|
|
|
full = g_strdup_printf ("DISPLAY=%s", screen_name);
|
|
|
|
|
|
|
|
putenv (full);
|
|
|
|
|
|
|
|
/* do not free full, because putenv is lame */
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_spawn_command_line_async_on_screen (const gchar *command_line,
|
|
|
|
MetaScreen *screen,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
gboolean retval;
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
gchar **argv = NULL;
|
2003-09-29 16:55:26 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (command_line != NULL, FALSE);
|
|
|
|
|
|
|
|
if (!g_shell_parse_argv (command_line,
|
|
|
|
NULL, &argv,
|
|
|
|
error))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
retval = g_spawn_async (NULL,
|
|
|
|
argv,
|
|
|
|
NULL,
|
|
|
|
G_SPAWN_SEARCH_PATH,
|
|
|
|
set_display_setup_func,
|
|
|
|
screen->screen_name,
|
|
|
|
NULL,
|
|
|
|
error);
|
|
|
|
g_strfreev (argv);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-11 04:10:44 +00:00
|
|
|
static void
|
|
|
|
handle_run_command (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-07-11 04:10:44 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
int which;
|
|
|
|
const char *command;
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
which = GPOINTER_TO_INT (binding->handler->data);
|
|
|
|
|
|
|
|
command = meta_prefs_get_command (which);
|
|
|
|
|
|
|
|
if (command == NULL)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"No command %d to run in response to keybinding press\n",
|
|
|
|
which);
|
|
|
|
|
|
|
|
s = g_strdup_printf (_("No command %d has been defined.\n"),
|
|
|
|
which + 1);
|
2004-08-26 00:59:12 +00:00
|
|
|
error_on_command (which, NULL, s, screen->number, event->xkey.time);
|
2002-07-11 04:10:44 +00:00
|
|
|
g_free (s);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = NULL;
|
2003-09-29 16:55:26 +00:00
|
|
|
if (!meta_spawn_command_line_async_on_screen (command, screen, &err))
|
2002-07-11 04:10:44 +00:00
|
|
|
{
|
2004-08-26 00:59:12 +00:00
|
|
|
error_on_command (which, command, err->message, screen->number, event->xkey.time);
|
2002-07-11 04:10:44 +00:00
|
|
|
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-08 21:09:05 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
handle_maximize_vert (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window && window->has_resize_func)
|
2002-12-08 21:09:05 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window->maximized_vertically)
|
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
|
|
|
|
else
|
|
|
|
meta_window_maximize (window, META_MAXIMIZE_VERTICAL);
|
2002-12-08 21:09:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_maximize_horiz (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window && window->has_resize_func)
|
2002-12-08 21:09:05 +00:00
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window->maximized_horizontally)
|
|
|
|
meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
|
|
|
|
else
|
|
|
|
meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL);
|
2002-12-08 21:09:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-09 03:44:16 +00:00
|
|
|
static gboolean
|
2002-06-09 04:04:19 +00:00
|
|
|
process_workspace_switch_grab (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-06-09 04:04:19 +00:00
|
|
|
XEvent *event,
|
|
|
|
KeySym keysym)
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
2002-10-16 20:12:24 +00:00
|
|
|
if (screen != display->grab_screen)
|
|
|
|
return FALSE;
|
2002-06-09 03:44:16 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
|
2004-10-20 23:16:08 +00:00
|
|
|
|
2002-06-09 03:44:16 +00:00
|
|
|
if (event->type == KeyRelease &&
|
2004-10-20 23:16:08 +00:00
|
|
|
end_keyboard_grab (display, event->xkey.keycode))
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
|
|
|
/* We're done, move to the new workspace. */
|
|
|
|
MetaWorkspace *target_workspace;
|
|
|
|
|
|
|
|
target_workspace =
|
|
|
|
(MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Ending workspace tab operation, primary modifier released\n");
|
2004-09-22 19:15:26 +00:00
|
|
|
|
|
|
|
if (target_workspace == screen->active_workspace)
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2004-09-22 19:15:26 +00:00
|
|
|
"Ending grab so we can focus on the target workspace\n");
|
2002-06-09 03:44:16 +00:00
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2004-09-22 19:15:26 +00:00
|
|
|
"Focusing default window on target workspace\n");
|
2002-06-09 03:44:16 +00: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 20:32:59 +00:00
|
|
|
meta_workspace_focus_default_window (target_workspace,
|
|
|
|
NULL,
|
|
|
|
event->xkey.time);
|
2002-06-09 03:44:16 +00:00
|
|
|
|
|
|
|
return TRUE; /* we already ended the grab */
|
|
|
|
}
|
2004-09-22 19:15:26 +00:00
|
|
|
|
|
|
|
/* Workspace switching should have already occurred on KeyPress */
|
|
|
|
meta_warning ("target_workspace != active_workspace. Some other event must have occurred.\n");
|
2002-06-09 03:44:16 +00: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;
|
|
|
|
|
|
|
|
/* select the next workspace in the tabpopup */
|
|
|
|
workspace =
|
|
|
|
(MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
|
|
|
|
|
|
|
if (workspace)
|
|
|
|
{
|
|
|
|
MetaWorkspace *target_workspace;
|
|
|
|
MetaKeyBindingAction action;
|
|
|
|
|
2002-07-14 03:16:41 +00:00
|
|
|
action = display_get_keybinding_action (display,
|
|
|
|
keysym,
|
|
|
|
display->grab_mask);
|
2002-06-09 03:44:16 +00: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)
|
|
|
|
{
|
|
|
|
meta_ui_tab_popup_select (screen->tab_popup,
|
|
|
|
(MetaTabEntryKey) target_workspace);
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Tab key pressed, moving tab focus in popup\n");
|
2002-09-09 18:16:25 +00: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 20:32:59 +00:00
|
|
|
meta_workspace_activate (target_workspace, event->xkey.time);
|
2002-09-09 18:16:25 +00:00
|
|
|
|
|
|
|
return TRUE; /* we already ended the grab */
|
2002-06-09 03:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end grab */
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2004-09-22 19:15:26 +00:00
|
|
|
"Ending workspace tabbing & focusing default window; uninteresting key pressed\n");
|
|
|
|
workspace =
|
|
|
|
(MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
|
|
|
meta_workspace_focus_default_window (workspace, NULL, event->xkey.time);
|
2002-06-09 03:44:16 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-10-15 03:39:41 +00:00
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
handle_toggle_desktop (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2001-10-15 03:39:41 +00: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 04:28:29 +00:00
|
|
|
if (screen->active_workspace->showing_desktop)
|
2003-05-16 21:59:08 +00: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 20:32:59 +00:00
|
|
|
meta_workspace_focus_default_window (screen->active_workspace,
|
|
|
|
NULL,
|
|
|
|
event->xkey.time);
|
2003-05-16 21:59:08 +00:00
|
|
|
}
|
2001-10-15 03:39:41 +00:00
|
|
|
else
|
2004-12-20 02:46:42 +00:00
|
|
|
meta_screen_show_desktop (screen, event->xkey.time);
|
2001-10-15 03:39:41 +00:00
|
|
|
}
|
|
|
|
|
2003-02-24 02:16:09 +00:00
|
|
|
static void
|
|
|
|
handle_panel_keybinding (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
MetaKeyBindingAction action;
|
|
|
|
Atom action_atom;
|
|
|
|
XClientMessageEvent ev;
|
|
|
|
|
|
|
|
action = GPOINTER_TO_INT (binding->handler->data);
|
|
|
|
|
|
|
|
action_atom = None;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case META_KEYBINDING_ACTION_PANEL_MAIN_MENU:
|
|
|
|
action_atom = display->atom_gnome_panel_action_main_menu;
|
|
|
|
break;
|
|
|
|
case META_KEYBINDING_ACTION_PANEL_RUN_DIALOG:
|
|
|
|
action_atom = display->atom_gnome_panel_action_run_dialog;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ev.type = ClientMessage;
|
|
|
|
ev.window = screen->xroot;
|
|
|
|
ev.message_type = display->atom_gnome_panel_action;
|
|
|
|
ev.format = 32;
|
|
|
|
ev.data.l[0] = action_atom;
|
|
|
|
ev.data.l[1] = event->xkey.time;
|
|
|
|
|
2003-02-26 01:55:25 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Sending panel message with timestamp %lu\n", event->xkey.time);
|
|
|
|
|
2003-02-24 02:16:09 +00:00
|
|
|
meta_error_trap_push (display);
|
2003-02-26 01:55:25 +00:00
|
|
|
|
|
|
|
/* Release the grab for the panel before sending the event */
|
|
|
|
XUngrabKeyboard (display->xdisplay, event->xkey.time);
|
|
|
|
|
2003-02-24 02:16:09 +00:00
|
|
|
XSendEvent (display->xdisplay,
|
|
|
|
screen->xroot,
|
|
|
|
False,
|
|
|
|
StructureNotifyMask,
|
|
|
|
(XEvent*) &ev);
|
2003-02-26 01:55:25 +00:00
|
|
|
|
2003-02-24 02:16:09 +00:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
|
|
|
}
|
|
|
|
|
2001-06-23 05:49:35 +00:00
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
handle_activate_menu (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2001-06-23 05:49:35 +00:00
|
|
|
{
|
|
|
|
if (display->focus_window)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
meta_window_get_position (display->focus_window,
|
|
|
|
&x, &y);
|
|
|
|
|
|
|
|
meta_window_show_menu (display->focus_window,
|
|
|
|
x, y,
|
|
|
|
0,
|
|
|
|
event->xkey.time);
|
|
|
|
}
|
|
|
|
}
|
2001-06-24 02:22:10 +00:00
|
|
|
|
2002-04-05 15:52:49 +00:00
|
|
|
static MetaGrabOp
|
2002-07-06 16:50:48 +00:00
|
|
|
tab_op_from_tab_type (MetaTabList type)
|
2002-04-05 15:52:49 +00: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-15 02:05:44 +00:00
|
|
|
case META_TAB_LIST_GROUP:
|
|
|
|
return META_GRAB_OP_KEYBOARD_TABBING_GROUP;
|
2002-04-05 15:52:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-06 16:50:48 +00: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-15 02:05:44 +00:00
|
|
|
case META_TAB_LIST_GROUP:
|
|
|
|
return META_GRAB_OP_KEYBOARD_ESCAPING_GROUP;
|
2002-07-06 16:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-06-24 02:22:10 +00:00
|
|
|
static void
|
2002-07-06 16:50:48 +00:00
|
|
|
do_choose_window (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-07-06 16:50:48 +00:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
2002-10-18 22:19:05 +00:00
|
|
|
gboolean backward,
|
2002-07-06 16:50:48 +00:00
|
|
|
gboolean show_popup)
|
2001-06-24 02:22:10 +00:00
|
|
|
{
|
2002-04-05 15:52:49 +00:00
|
|
|
MetaTabList type;
|
2002-09-04 04:15:46 +00:00
|
|
|
MetaWindow *initial_selection;
|
2003-11-24 23:05:04 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
type = GPOINTER_TO_INT (binding->handler->data);
|
2001-06-24 02:22:10 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2006-01-20 22:03:56 +00:00
|
|
|
"Tab list = %u show_popup = %d\n", type, show_popup);
|
2002-10-16 20:12:24 +00:00
|
|
|
|
2002-10-18 22:19:05 +00:00
|
|
|
/* reverse direction if shift is down */
|
|
|
|
if (event->xkey.state & ShiftMask)
|
|
|
|
backward = !backward;
|
|
|
|
|
2002-09-04 04:15:46 +00:00
|
|
|
initial_selection = meta_display_get_tab_next (display,
|
|
|
|
type,
|
|
|
|
screen,
|
|
|
|
screen->active_workspace,
|
|
|
|
NULL,
|
|
|
|
backward);
|
2002-07-06 16:50:48 +00:00
|
|
|
|
2002-09-04 04:15:46 +00: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)");
|
|
|
|
|
2002-10-18 22:19:05 +00:00
|
|
|
if (initial_selection != NULL)
|
|
|
|
{
|
|
|
|
if (binding->mask == 0)
|
|
|
|
{
|
|
|
|
/* If no modifiers, we can't do the "hold down modifier to keep
|
|
|
|
* moving" thing, so we just instaswitch by one window.
|
|
|
|
*/
|
2005-02-22 02:11:25 +00:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Activating %s and turning off mouse_mode due to "
|
|
|
|
"switch/cycle windows with no modifiers\n",
|
2002-10-18 22:19:05 +00:00
|
|
|
initial_selection->desc);
|
2005-02-22 02:11:25 +00:00
|
|
|
display->mouse_mode = FALSE;
|
2002-10-18 22:19:05 +00:00
|
|
|
meta_window_activate (initial_selection, event->xkey.time);
|
|
|
|
}
|
|
|
|
else if (meta_display_begin_grab_op (display,
|
|
|
|
screen,
|
|
|
|
NULL,
|
|
|
|
show_popup ?
|
|
|
|
tab_op_from_tab_type (type) :
|
|
|
|
cycle_op_from_tab_type (type),
|
|
|
|
FALSE,
|
2003-11-24 18:09:47 +00:00
|
|
|
event->xkey.serial,
|
2002-10-18 22:19:05 +00:00
|
|
|
0,
|
|
|
|
binding->mask,
|
|
|
|
event->xkey.time,
|
|
|
|
0, 0))
|
2003-01-21 22:40:25 +00:00
|
|
|
{
|
|
|
|
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.
|
|
|
|
*/
|
2005-02-22 02:11:25 +00:00
|
|
|
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",
|
2003-01-21 22:40:25 +00:00
|
|
|
initial_selection->desc);
|
|
|
|
meta_display_end_grab_op (display, event->xkey.time);
|
2005-02-22 02:11:25 +00:00
|
|
|
display->mouse_mode = FALSE;
|
2003-01-21 22:40:25 +00:00
|
|
|
meta_window_activate (initial_selection, event->xkey.time);
|
|
|
|
}
|
2002-10-18 22:19:05 +00:00
|
|
|
else
|
2003-01-21 22:40:25 +00:00
|
|
|
{
|
|
|
|
meta_ui_tab_popup_select (screen->tab_popup,
|
|
|
|
(MetaTabEntryKey) initial_selection->xwindow);
|
|
|
|
|
|
|
|
if (show_popup)
|
|
|
|
meta_ui_tab_popup_set_showing (screen->tab_popup,
|
|
|
|
TRUE);
|
|
|
|
else
|
2005-10-03 20:02:31 +00:00
|
|
|
{
|
|
|
|
meta_window_raise (initial_selection);
|
|
|
|
initial_selection->tab_unminimized =
|
|
|
|
initial_selection->minimized;
|
|
|
|
meta_window_unminimize (initial_selection);
|
|
|
|
}
|
2003-01-21 22:40:25 +00:00
|
|
|
}
|
2002-10-18 22:19:05 +00:00
|
|
|
}
|
2001-06-24 03:41:44 +00:00
|
|
|
}
|
2001-06-24 02:22:10 +00:00
|
|
|
}
|
2001-06-24 03:18:10 +00:00
|
|
|
|
2002-07-06 16:50:48 +00:00
|
|
|
static void
|
|
|
|
handle_tab_forward (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-07-06 16:50:48 +00:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2001-06-24 03:18:10 +00:00
|
|
|
{
|
2002-10-16 20:12:24 +00:00
|
|
|
do_choose_window (display, screen,
|
2002-10-18 22:19:05 +00:00
|
|
|
event_window, event, binding, FALSE, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_tab_backward (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
do_choose_window (display, screen,
|
|
|
|
event_window, event, binding, TRUE, TRUE);
|
2002-06-09 03:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-07-06 16:50:48 +00:00
|
|
|
handle_cycle_forward (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-07-06 16:50:48 +00:00
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
2002-10-16 20:12:24 +00:00
|
|
|
do_choose_window (display, screen,
|
2002-10-18 22:19:05 +00:00
|
|
|
event_window, event, binding, FALSE, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_cycle_backward (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *event_window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
do_choose_window (display, screen,
|
|
|
|
event_window, event, binding, TRUE, FALSE);
|
2001-06-24 03:18:10 +00:00
|
|
|
}
|
2002-01-11 03:31:14 +00:00
|
|
|
|
2002-04-05 15:52:49 +00:00
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
handle_toggle_fullscreen (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2002-04-05 15:52:49 +00:00
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
if (window->fullscreen)
|
|
|
|
meta_window_unmake_fullscreen (window);
|
2002-08-15 05:14:49 +00:00
|
|
|
else if (window->has_fullscreen_func)
|
2002-04-05 15:52:49 +00:00
|
|
|
meta_window_make_fullscreen (window);
|
|
|
|
}
|
|
|
|
}
|
2002-01-11 03:31:14 +00:00
|
|
|
|
2003-06-27 14:49:56 +00:00
|
|
|
static void
|
|
|
|
handle_toggle_above (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
if (window->wm_state_above)
|
|
|
|
meta_window_unmake_above (window);
|
|
|
|
else
|
|
|
|
meta_window_make_above (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-11 03:31:14 +00:00
|
|
|
static void
|
2002-04-28 04:52:26 +00:00
|
|
|
handle_toggle_maximize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (META_WINDOW_MAXIMIZED (window))
|
|
|
|
meta_window_unmaximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2002-08-09 14:22:00 +00:00
|
|
|
else if (window->has_maximize_func)
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
meta_window_maximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-21 06:47:16 +00:00
|
|
|
static void
|
|
|
|
handle_maximize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-21 06:47:16 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
if (window->has_maximize_func)
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
meta_window_maximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2002-08-21 06:47:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_unmaximize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-21 06:47:16 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 14:58:50 +00:00
|
|
|
if (window->maximized_vertically || window->maximized_horizontally)
|
|
|
|
meta_window_unmaximize (window,
|
|
|
|
META_MAXIMIZE_HORIZONTAL |
|
|
|
|
META_MAXIMIZE_VERTICAL);
|
2002-08-21 06:47:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
|
|
|
handle_toggle_shade (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
if (window->shaded)
|
|
|
|
meta_window_unshade (window);
|
2002-08-09 14:22:00 +00:00
|
|
|
else if (window->has_shade_func)
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_window_shade (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_close_window (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
2002-06-10 10:17:54 +00:00
|
|
|
if (window->has_close_func)
|
|
|
|
meta_window_delete (window, event->xkey.time);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
2002-05-25 02:30:00 +00:00
|
|
|
static void
|
|
|
|
handle_minimize_window (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-05-25 02:30:00 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
2002-06-10 10:17:54 +00:00
|
|
|
if (window->has_minimize_func)
|
|
|
|
meta_window_minimize (window);
|
2002-05-25 02:30:00 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
|
|
|
handle_begin_move (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
2006-02-12 03:17:10 +00:00
|
|
|
if (window && window->has_move_func)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
meta_window_begin_grab_op (window,
|
|
|
|
META_GRAB_OP_KEYBOARD_MOVING,
|
|
|
|
event->xkey.time);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_begin_resize (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
2006-02-12 03:17:10 +00:00
|
|
|
if (window && window->has_resize_func)
|
2002-07-10 03:51:01 +00:00
|
|
|
{
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 04:27:23 +00:00
|
|
|
meta_window_begin_grab_op (window,
|
|
|
|
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
|
|
|
|
event->xkey.time);
|
2002-07-10 03:51:01 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_toggle_sticky (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
if (window->on_all_workspaces)
|
|
|
|
meta_window_unstick (window);
|
|
|
|
else
|
|
|
|
meta_window_stick (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-05-17 00:00:55 +00:00
|
|
|
do_handle_move_to_workspace (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding,
|
|
|
|
gboolean flip)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
|
|
|
int which;
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
|
|
|
which = GPOINTER_TO_INT (binding->handler->data);
|
|
|
|
|
2002-05-26 15:54:38 +00:00
|
|
|
if (window == NULL || window->always_sticky)
|
|
|
|
return;
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
workspace = NULL;
|
|
|
|
if (which < 0)
|
2002-10-16 20:12:24 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
workspace = meta_workspace_get_neighbor (screen->active_workspace,
|
|
|
|
which);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-16 20:12:24 +00:00
|
|
|
workspace = meta_screen_get_workspace_by_index (screen, which);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (workspace)
|
|
|
|
{
|
2002-05-25 02:33:55 +00:00
|
|
|
/* Activate second, so the window is never unmapped */
|
2002-04-28 04:52:26 +00:00
|
|
|
meta_window_change_workspace (window, workspace);
|
2003-05-17 00:00:55 +00:00
|
|
|
if (flip)
|
2005-02-22 02:11:25 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Resetting mouse_mode to FALSE due to "
|
|
|
|
"do_handle_move_to_workspace() call with flip set.\n");
|
|
|
|
workspace->screen->display->mouse_mode = FALSE;
|
|
|
|
meta_workspace_activate_with_focus (workspace,
|
|
|
|
window,
|
|
|
|
event->xkey.time);
|
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We could offer to create it I suppose */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-17 00:00:55 +00:00
|
|
|
static void
|
|
|
|
handle_move_to_workspace (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
do_handle_move_to_workspace (display,
|
|
|
|
screen,
|
|
|
|
window,
|
|
|
|
event,
|
|
|
|
binding,
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
handle_move_to_workspace_flip (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
do_handle_move_to_workspace (display,
|
|
|
|
screen,
|
|
|
|
window,
|
|
|
|
event,
|
|
|
|
binding,
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
|
2002-05-29 03:11:24 +00:00
|
|
|
static void
|
|
|
|
handle_raise_or_lower (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-05-29 03:11:24 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
/* Get window at pointer */
|
|
|
|
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
MetaWindow *above = NULL;
|
|
|
|
|
|
|
|
/* Check if top */
|
|
|
|
if (meta_stack_get_top (window->screen->stack) == window)
|
|
|
|
{
|
|
|
|
meta_window_lower (window);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* else check if windows in same layer are intersecting it */
|
|
|
|
|
|
|
|
above = meta_stack_get_above (window->screen->stack, window, TRUE);
|
|
|
|
|
|
|
|
while (above)
|
|
|
|
{
|
|
|
|
MetaRectangle tmp, win_rect, above_rect;
|
|
|
|
|
2002-10-20 15:22:40 +00:00
|
|
|
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))
|
|
|
|
{
|
|
|
|
meta_window_raise (window);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2002-05-29 03:11:24 +00:00
|
|
|
|
|
|
|
above = meta_stack_get_above (window->screen->stack, above, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* window is not obscured */
|
|
|
|
meta_window_lower (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-15 05:14:49 +00:00
|
|
|
static void
|
|
|
|
handle_raise (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-15 05:14:49 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
meta_window_raise (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_lower (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-08-15 05:14:49 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
meta_window_lower (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-09 03:44:16 +00:00
|
|
|
static void
|
2002-06-09 04:04:19 +00:00
|
|
|
handle_workspace_switch (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-06-09 04:04:19 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
|
|
|
int motion;
|
2003-01-21 22:40:25 +00:00
|
|
|
unsigned int grab_mask;
|
2002-09-09 18:16:25 +00:00
|
|
|
|
2002-06-09 03:44:16 +00:00
|
|
|
motion = GPOINTER_TO_INT (binding->handler->data);
|
|
|
|
|
2002-10-16 20:12:24 +00:00
|
|
|
g_assert (motion < 0);
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2002-06-27 05:08:32 +00:00
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Starting tab between workspaces, showing popup\n");
|
|
|
|
|
2003-01-21 22:40:25 +00:00
|
|
|
/* FIXME should we use binding->mask ? */
|
|
|
|
grab_mask = event->xkey.state & ~(display->ignored_modifier_mask);
|
|
|
|
|
2002-06-27 05:08:32 +00:00
|
|
|
if (meta_display_begin_grab_op (display,
|
|
|
|
screen,
|
2002-07-02 05:03:28 +00:00
|
|
|
NULL,
|
2002-06-27 05:08:32 +00:00
|
|
|
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
|
|
|
|
FALSE,
|
2003-11-24 18:09:47 +00:00
|
|
|
event->xkey.serial,
|
2002-06-27 05:08:32 +00:00
|
|
|
0,
|
2003-01-21 22:40:25 +00:00
|
|
|
grab_mask,
|
2002-06-27 05:08:32 +00:00
|
|
|
event->xkey.time,
|
|
|
|
0, 0))
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
2002-06-27 05:08:32 +00:00
|
|
|
MetaWorkspace *next;
|
2003-01-21 22:40:25 +00:00
|
|
|
gboolean grabbed_before_release;
|
|
|
|
|
2002-07-02 05:03:28 +00:00
|
|
|
next = meta_workspace_get_neighbor (screen->active_workspace, motion);
|
2002-06-27 05:08:32 +00:00
|
|
|
g_assert (next);
|
2002-09-09 18:16:25 +00:00
|
|
|
|
2003-01-21 22:40:25 +00:00
|
|
|
grabbed_before_release = primary_modifier_still_pressed (display, grab_mask);
|
2002-09-09 18:16:25 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Activating target workspace\n");
|
2003-01-21 22:40:25 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2002-09-09 18:16:25 +00: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 20:32:59 +00:00
|
|
|
meta_workspace_activate (next, event->xkey.time);
|
2003-01-21 22:40:25 +00:00
|
|
|
|
|
|
|
if (grabbed_before_release)
|
|
|
|
{
|
|
|
|
meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) next);
|
|
|
|
|
|
|
|
/* only after selecting proper space */
|
|
|
|
meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
|
|
|
|
}
|
2002-06-09 03:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
#if 0
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
|
|
|
handle_spew_mark (MetaDisplay *display,
|
2002-10-16 20:12:24 +00:00
|
|
|
MetaScreen *screen,
|
2002-04-28 04:52:26 +00:00
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
2002-01-11 03:31:14 +00:00
|
|
|
{
|
|
|
|
meta_verbose ("-- MARK MARK MARK MARK --\n");
|
|
|
|
}
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
#endif
|
2002-01-11 03:31:14 +00:00
|
|
|
|
2002-02-08 06:01:58 +00:00
|
|
|
void
|
|
|
|
meta_set_keybindings_disabled (gboolean setting)
|
|
|
|
{
|
2002-06-16 03:03:08 +00:00
|
|
|
all_bindings_disabled = setting;
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Keybindings %s\n", all_bindings_disabled ? "disabled" : "enabled");
|
2002-02-08 06:01:58 +00:00
|
|
|
}
|
2004-10-13 08:32:10 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
handle_run_terminal (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWindow *window,
|
|
|
|
XEvent *event,
|
|
|
|
MetaKeyBinding *binding)
|
|
|
|
{
|
|
|
|
const char *command;
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
command = meta_prefs_get_terminal_command ();
|
|
|
|
|
|
|
|
if (command == NULL)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"No terminal command to run in response to "
|
|
|
|
"keybinding press\n");
|
|
|
|
|
|
|
|
s = g_strdup_printf (_("No terminal command has been defined.\n"));
|
|
|
|
error_on_terminal_command (NULL, s, screen->number, event->xkey.time);
|
|
|
|
g_free (s);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
if (!meta_spawn_command_line_async_on_screen (command, screen, &err))
|
|
|
|
{
|
|
|
|
error_on_terminal_command (command, err->message, screen->number,
|
|
|
|
event->xkey.time);
|
|
|
|
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
|
|
|
}
|