Commit 086f3d80 authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Mark McLoughlin
Browse files

Fix broken workspace switching from my previous commit.

2002-07-01  Mark McLoughlin  <mark@skynet.ie>

        Fix broken workspace switching from my previous commit.

        * src/display.c: (meta_display_begin_grab_op): don't
        leak a pointer grab if we fail to grab the keyboard.

        * src/keybindings.c: (meta_screen_grab_keys): check
        screen->all_keys_grabbed.
        (meta_screen_grab_all_keys): regrab our standard
        bindings if we fail.
        (handle_workspace_switch): revert to our previous
        behaviour of using the last focused window to do
        the grab upon. Only use the RootWindow if there
        isn't anything else to use.

        * src/screen.c: (meta_screen_new): initialise
        all_keys_grabbed.
parent 6b72d622
2002-07-01 Mark McLoughlin <mark@skynet.ie>
Fix broken workspace switching from my previous commit.
* src/display.c: (meta_display_begin_grab_op): don't
leak a pointer grab if we fail to grab the keyboard.
* src/keybindings.c: (meta_screen_grab_keys): check
screen->all_keys_grabbed.
(meta_screen_grab_all_keys): regrab our standard
bindings if we fail.
(handle_workspace_switch): revert to our previous
behaviour of using the last focused window to do
the grab upon. Only use the RootWindow if there
isn't anything else to use.
* src/screen.c: (meta_screen_new): initialise
all_keys_grabbed.
2002-06-26 Mark McLoughlin <mark@skynet.ie>
Fixes not being able to tab out of a
......
......@@ -2199,6 +2199,12 @@ meta_display_begin_grab_op (MetaDisplay *display,
return FALSE;
}
/* FIXME:
* If we have no MetaWindow we do our best
* and try to do the grab on the RootWindow.
* This will fail if anyone else has any
* key grab on the RootWindow.
*/
if (window)
grab_xwindow = window->frame ? window->frame->xwindow : window->xwindow;
else
......@@ -2250,13 +2256,16 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_have_keyboard =
meta_window_grab_all_keys (window);
else if (meta_screen_grab_all_keys (screen))
display->grab_have_keyboard = TRUE;
else
display->grab_have_keyboard =
meta_screen_grab_all_keys (screen);
if (!display->grab_have_keyboard)
{
meta_topic (META_DEBUG_WINDOW_OPS,
"grabbing all keys failed\n");
"grabbing all keys failed, ungrabbing pointer\n");
XUngrabPointer (display->xdisplay, CurrentTime);
display->grab_have_pointer = FALSE;
return FALSE;
}
}
......
......@@ -718,6 +718,9 @@ ungrab_all_keys (MetaDisplay *display,
void
meta_screen_grab_keys (MetaScreen *screen)
{
if (screen->all_keys_grabbed)
return;
if (screen->keys_grabbed)
return;
......@@ -859,10 +862,9 @@ meta_screen_grab_all_keys (MetaScreen *screen)
retval = grab_all_keys_and_keyboard (screen->display,
screen->xroot);
if (retval)
{
screen->keys_grabbed = FALSE;
screen->all_keys_grabbed = TRUE;
}
screen->all_keys_grabbed = TRUE;
else
meta_screen_grab_keys (screen);
return retval;
}
......@@ -2334,12 +2336,26 @@ handle_workspace_switch (MetaDisplay *display,
if (screen == NULL)
return;
/* FIXME this is all broken, that you need a window to grab on.
* There's no reason we need a window here, in fact it's broken
* that you have to have one.
*/
if (display->focus_window != NULL)
{
window = display->focus_window;
}
else if (window == NULL)
{
window = get_previous_focus_window (display, screen);
}
meta_topic (META_DEBUG_KEYBINDINGS,
"Starting tab between workspaces, showing popup\n");
if (meta_display_begin_grab_op (display,
screen,
NULL,
window,
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
FALSE,
0,
......@@ -2348,16 +2364,17 @@ handle_workspace_switch (MetaDisplay *display,
0, 0))
{
MetaWorkspace *next;
next = meta_workspace_get_neighbor (screen->active_workspace,
next = meta_workspace_get_neighbor (window->screen->active_workspace,
motion);
g_assert (next);
meta_ui_tab_popup_select (screen->tab_popup,
meta_ui_tab_popup_select (window->screen->tab_popup,
(MetaTabEntryKey) next);
/* only after selecting proper window */
meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
meta_ui_tab_popup_set_showing (window->screen->tab_popup,
TRUE);
}
}
......
......@@ -470,6 +470,7 @@ meta_screen_new (MetaDisplay *display,
screen->active_workspace = meta_workspace_new (screen);
update_num_workspaces (screen);
screen->all_keys_grabbed = FALSE;
screen->keys_grabbed = FALSE;
meta_screen_grab_keys (screen);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment