allow moving workspace while moving window with modifier remove the

2008-03-11  Matthew Wilson  <msw@gimp.org>

        * src/core/keybindings.c (meta_display_process_key_event, process_event,
        find_handler, process_mouse_move_resize_grab): allow moving workspace
	while moving window with modifier
        * src/core/workspace.c (meta_workspace_activate_with_focus): remove the
	correct window on jumping workspace while moving


svn path=/trunk/; revision=3649
This commit is contained in:
Matthew Wilson 2008-03-11 03:37:54 +00:00 committed by Thomas James Alexander Thurman
parent 87cceaf992
commit 9836007f5e
3 changed files with 112 additions and 116 deletions

View File

@ -1,3 +1,11 @@
2008-03-11 Matthew Wilson <msw@gimp.org>
* src/core/keybindings.c (meta_display_process_key_event, process_event,
find_handler, process_mouse_move_resize_grab): allow moving workspace
while moving window with modifier
* src/core/workspace.c (meta_workspace_activate_with_focus): remove the
correct window on jumping workspace while moving
2008-03-10 Josh Lee <jleedev@gmail.com> 2008-03-10 Josh Lee <jleedev@gmail.com>
* src/core/compositor.c (window_has_shadow): Don't shadow * src/core/compositor.c (window_has_shadow): Don't shadow

View File

@ -1583,7 +1583,7 @@ find_handler (const MetaKeyHandler *handlers,
return NULL; return NULL;
} }
static void static gboolean
process_event (MetaKeyBinding *bindings, process_event (MetaKeyBinding *bindings,
int n_bindings, int n_bindings,
const MetaKeyHandler *handlers, const MetaKeyHandler *handlers,
@ -1597,13 +1597,13 @@ process_event (MetaKeyBinding *bindings,
/* we used to have release-based bindings but no longer. */ /* we used to have release-based bindings but no longer. */
if (event->type == KeyRelease) if (event->type == KeyRelease)
return; return FALSE;
i = 0; i = 0;
while (i < n_bindings) while (i < n_bindings)
{ {
if (bindings[i].keycode == event->xkey.keycode && if (bindings[i].keycode == event->xkey.keycode &&
((event->xkey.state & ~(display->ignored_modifier_mask)) == ((event->xkey.state & 0xff & ~(display->ignored_modifier_mask)) ==
bindings[i].mask) && bindings[i].mask) &&
event->type == KeyPress) event->type == KeyPress)
{ {
@ -1637,7 +1637,7 @@ process_event (MetaKeyBinding *bindings,
(* handler->func) (display, screen, window, event, (* handler->func) (display, screen, window, event,
&bindings[i]); &bindings[i]);
return; return TRUE;
} }
++i; ++i;
@ -1645,6 +1645,7 @@ process_event (MetaKeyBinding *bindings,
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"No handler found for this event in this binding table\n"); "No handler found for this event in this binding table\n");
return FALSE;
} }
/* Handle a key event. May be called recursively: some key events cause /* Handle a key event. May be called recursively: some key events cause
@ -1665,6 +1666,7 @@ meta_display_process_key_event (MetaDisplay *display,
{ {
KeySym keysym; KeySym keysym;
gboolean handled; gboolean handled;
gboolean keep_grab;
gboolean all_keys_grabbed; gboolean all_keys_grabbed;
const char *str; const char *str;
MetaScreen *screen; MetaScreen *screen;
@ -1703,115 +1705,102 @@ meta_display_process_key_event (MetaDisplay *display,
str ? str : "none", event->xkey.state, str ? str : "none", event->xkey.state,
window ? window->desc : "(no window)"); window ? window->desc : "(no window)");
keep_grab = TRUE;
all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed; all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed;
if (!all_keys_grabbed) if (all_keys_grabbed)
{ {
/* Do the normal keybindings */ if (display->grab_op == META_GRAB_OP_NONE)
process_event (display->screen_bindings, return;
display->n_screen_bindings, /* If we get here we have a global grab, because
screen_handlers, * we're in some special keyboard mode such as window move
display, screen, NULL, event, keysym); * mode.
*/
if (window) if (window ? (window == display->grab_window) :
process_event (display->window_bindings, (screen == display->grab_screen))
display->n_window_bindings,
window_handlers,
display, screen, window, event, keysym);
return;
}
if (display->grab_op == META_GRAB_OP_NONE)
return;
/* If we get here we have a global grab, because
* we're in some special keyboard mode such as window move
* mode.
*/
handled = FALSE;
if (window ? (window == display->grab_window) :
(screen == display->grab_screen))
{
switch (display->grab_op)
{ {
case META_GRAB_OP_MOVING: switch (display->grab_op)
case META_GRAB_OP_RESIZING_SE: {
case META_GRAB_OP_RESIZING_S: case META_GRAB_OP_MOVING:
case META_GRAB_OP_RESIZING_SW: case META_GRAB_OP_RESIZING_SE:
case META_GRAB_OP_RESIZING_N: case META_GRAB_OP_RESIZING_S:
case META_GRAB_OP_RESIZING_NE: case META_GRAB_OP_RESIZING_SW:
case META_GRAB_OP_RESIZING_NW: case META_GRAB_OP_RESIZING_N:
case META_GRAB_OP_RESIZING_W: case META_GRAB_OP_RESIZING_NE:
case META_GRAB_OP_RESIZING_E: case META_GRAB_OP_RESIZING_NW:
meta_topic (META_DEBUG_KEYBINDINGS, case META_GRAB_OP_RESIZING_W:
"Processing event for mouse-only move/resize\n"); case META_GRAB_OP_RESIZING_E:
g_assert (window != NULL); meta_topic (META_DEBUG_KEYBINDINGS,
handled = process_mouse_move_resize_grab (display, screen, "Processing event for mouse-only move/resize\n");
window, event, keysym); g_assert (window != NULL);
break; keep_grab = process_mouse_move_resize_grab (display, screen,
window, event, keysym);
break;
case META_GRAB_OP_KEYBOARD_MOVING: case META_GRAB_OP_KEYBOARD_MOVING:
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard move\n"); "Processing event for keyboard move\n");
g_assert (window != NULL); g_assert (window != NULL);
handled = process_keyboard_move_grab (display, screen, keep_grab = process_keyboard_move_grab (display, screen,
window, event, keysym); window, event, keysym);
break; break;
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN: case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
case META_GRAB_OP_KEYBOARD_RESIZING_S: case META_GRAB_OP_KEYBOARD_RESIZING_S:
case META_GRAB_OP_KEYBOARD_RESIZING_N: case META_GRAB_OP_KEYBOARD_RESIZING_N:
case META_GRAB_OP_KEYBOARD_RESIZING_W: case META_GRAB_OP_KEYBOARD_RESIZING_W:
case META_GRAB_OP_KEYBOARD_RESIZING_E: case META_GRAB_OP_KEYBOARD_RESIZING_E:
case META_GRAB_OP_KEYBOARD_RESIZING_SE: case META_GRAB_OP_KEYBOARD_RESIZING_SE:
case META_GRAB_OP_KEYBOARD_RESIZING_NE: case META_GRAB_OP_KEYBOARD_RESIZING_NE:
case META_GRAB_OP_KEYBOARD_RESIZING_SW: case META_GRAB_OP_KEYBOARD_RESIZING_SW:
case META_GRAB_OP_KEYBOARD_RESIZING_NW: case META_GRAB_OP_KEYBOARD_RESIZING_NW:
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard resize\n"); "Processing event for keyboard resize\n");
g_assert (window != NULL); g_assert (window != NULL);
handled = process_keyboard_resize_grab (display, screen, keep_grab = process_keyboard_resize_grab (display, screen,
window, event, keysym); window, event, keysym);
break; break;
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
case META_GRAB_OP_KEYBOARD_TABBING_DOCK: case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
case META_GRAB_OP_KEYBOARD_TABBING_GROUP: case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP: case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard tabbing/cycling\n"); "Processing event for keyboard tabbing/cycling\n");
handled = process_tab_grab (display, screen, event, keysym); keep_grab = process_tab_grab (display, screen, event, keysym);
break; break;
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard workspace switching\n"); "Processing event for keyboard workspace switching\n");
handled = process_workspace_switch_grab (display, screen, event, keysym); keep_grab = process_workspace_switch_grab (display, screen, event, keysym);
break; break;
default: default:
break; break;
}
} }
} if (!keep_grab)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Ending grab op %u on key event sym %s\n",
display->grab_op, XKeysymToString (keysym));
meta_display_end_grab_op (display, event->xkey.time);
return;
}
}
/* Do the normal keybindings */
handled = process_event (display->screen_bindings,
display->n_screen_bindings,
screen_handlers,
display, screen, NULL, event, keysym);
/* end grab if a key that isn't used gets pressed */ if (!all_keys_grabbed && !handled && window)
if (!handled) handled = process_event (display->window_bindings,
{ display->n_window_bindings,
meta_topic (META_DEBUG_KEYBINDINGS, window_handlers,
"Ending grab op %u on key event sym %s\n", display, screen, window, event, keysym);
display->grab_op, XKeysymToString (keysym));
meta_display_end_grab_op (display, event->xkey.time);
g_assert (display->grab_op == META_GRAB_OP_NONE);
/* and go round again: #112560 */
meta_display_process_key_event (display, window, event);
}
} }
static gboolean static gboolean
@ -1848,13 +1837,10 @@ process_mouse_move_resize_grab (MetaDisplay *display,
else else
display->grab_was_cancelled = TRUE; display->grab_was_cancelled = TRUE;
/* End grab, since this was an "unhandled" keypress */ /* End grab */
return FALSE; return FALSE;
} }
/* The keypress really isn't handled but we just want to ignore it, so
* treat it as handled.
*/
return TRUE; return TRUE;
} }

View File

@ -315,10 +315,12 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
* then remove from old workspace, so the window * then remove from old workspace, so the window
* never gets unmapped and we maintain the button grab * never gets unmapped and we maintain the button grab
* on it. * on it.
*
* \bug This comment appears to be the reverse of what happens
*/ */
if (move_window && (move_window->workspace != workspace)) if (move_window && (move_window->workspace != workspace))
{ {
meta_workspace_remove_window (workspace, move_window); meta_workspace_remove_window (old, move_window);
meta_workspace_add_window (workspace, move_window); meta_workspace_add_window (workspace, move_window);
} }
} }