From 7e821f37fd740f68e4d71823a60c5294c5713773 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Thu, 22 Dec 2005 06:18:38 +0000 Subject: [PATCH] Add xinerama and multi-head tracker bugs --- rationales.txt | 2 ++ src/display.c | 36 +++++++++++++++++++++++++++++++----- src/display.h | 9 ++++----- src/keybindings.c | 6 +++++- src/screen.c | 16 +++++++--------- src/screen.h | 5 +++++ src/window.c | 4 ++-- src/workspace.c | 2 ++ 8 files changed, 58 insertions(+), 22 deletions(-) diff --git a/rationales.txt b/rationales.txt index 7163ebf15..7d1220c3d 100644 --- a/rationales.txt +++ b/rationales.txt @@ -60,3 +60,5 @@ moving/resizing (constraints): http://bugzilla.gnome.org/show_bug.cgi?id=155458 window placement: http://bugzilla.gnome.org/show_bug.cgi?id=155460 logout/system-monitor keys: http://bugzilla.gnome.org/show_bug.cgi?id=155462 modal dialogs: http://bugzilla.gnome.org/show_bug.cgi?id=164841 + multi-head sans xinerama: http://bugzilla.gnome.org/show_bug.cgi?id=324772 + xinerama: http://bugzilla.gnome.org/show_bug.cgi?id=324773 diff --git a/src/display.c b/src/display.c index da82c761e..1bcd98f09 100644 --- a/src/display.c +++ b/src/display.c @@ -461,7 +461,6 @@ meta_display_open (const char *name) * created in screen_new */ display->leader_window = None; - display->no_focus_window = None; display->xinerama_cache_invalidated = TRUE; @@ -712,7 +711,10 @@ meta_display_open (const char *name) * as it is the most recent timestamp. */ if (focus == None || focus == PointerRoot) - meta_display_focus_the_no_focus_window (display, timestamp); + /* Just focus the no_focus_window on the first screen */ + meta_display_focus_the_no_focus_window (display, + display->screens->data, + timestamp); else { MetaWindow * window; @@ -720,7 +722,10 @@ meta_display_open (const char *name) if (window) meta_display_set_input_focus_window (display, window, FALSE, timestamp); else - meta_display_focus_the_no_focus_window (display, timestamp); + /* Just focus the no_focus_window on the first screen */ + meta_display_focus_the_no_focus_window (display, + display->screens->data, + timestamp); } meta_error_trap_pop (display, FALSE); @@ -1870,6 +1875,7 @@ event_callback (XEvent *event, "Unsetting focus from %s due to LeaveNotify\n", window->desc); meta_display_focus_the_no_focus_window (display, + window->screen, event->xcrossing.time); } if (window->type != META_WINDOW_DOCK && @@ -1901,7 +1907,8 @@ event_callback (XEvent *event, { meta_window_notify_focus (window, event); } - else if (event->xany.window == display->no_focus_window) + else if (meta_display_xwindow_is_a_no_focus_window (display, + event->xany.window)) { meta_topic (META_DEBUG_FOCUS, "Focus %s event received on no_focus_window 0x%lx " @@ -2991,6 +2998,24 @@ meta_display_unregister_x_window (MetaDisplay *display, remove_pending_pings_for_window (display, xwindow); } +gboolean +meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display, + Window xwindow) +{ + gboolean is_a_no_focus_window = FALSE; + GSList *temp = display->screens; + while (temp != NULL) { + MetaScreen *screen = temp->data; + if (screen->no_focus_window == xwindow) { + is_a_no_focus_window = TRUE; + break; + } + temp = temp->next; + } + + return is_a_no_focus_window; +} + Cursor meta_display_create_x_cursor (MetaDisplay *display, MetaCursor cursor) @@ -4821,13 +4846,14 @@ meta_display_set_input_focus_window (MetaDisplay *display, void meta_display_focus_the_no_focus_window (MetaDisplay *display, + MetaScreen *screen, Time timestamp) { if (timestamp_too_old (display, NULL, ×tamp)) return; XSetInputFocus (display->xdisplay, - display->no_focus_window, + screen->no_focus_window, RevertToPointerRoot, timestamp); display->expected_focus_window = NULL; diff --git a/src/display.h b/src/display.h index c651c5e97..1e6b02820 100644 --- a/src/display.h +++ b/src/display.h @@ -216,11 +216,6 @@ struct _MetaDisplay XErrorEvent *error); int server_grab_count; - /* This window holds the focus when we don't want to focus - * any actual clients - */ - Window no_focus_window; - /* for double click */ Time last_button_time; Window last_button_xwindow; @@ -413,6 +408,9 @@ void meta_display_register_x_window (MetaDisplay *display, MetaWindow *window); void meta_display_unregister_x_window (MetaDisplay *display, Window xwindow); +/* Return whether the xwindow is a no focus window for any of the screens */ +gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display, + Window xwindow); GSList* meta_display_list_windows (MetaDisplay *display); @@ -539,6 +537,7 @@ void meta_display_set_input_focus_window (MetaDisplay *display, * same as meta_display_set_input_focus_window */ void meta_display_focus_the_no_focus_window (MetaDisplay *display, + MetaScreen *screen, Time timestamp); void meta_display_queue_autoraise_callback (MetaDisplay *display, diff --git a/src/keybindings.c b/src/keybindings.c index e1872a0e3..a70a5359e 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -1451,11 +1451,15 @@ primary_modifier_still_pressed (MetaDisplay *display, int x, y, root_x, root_y; Window root, child; guint mask; + MetaScreen *random_screen; + Window random_xwindow; primary_modifier = get_primary_modifier (display, entire_binding_mask); + random_screen = display->screens->data; + random_xwindow = random_screen->no_focus_window; XQueryPointer (display->xdisplay, - display->no_focus_window, /* some random window */ + random_xwindow, /* some random window */ &root, &child, &root_x, &root_y, &x, &y, diff --git a/src/screen.c b/src/screen.c index 62a0f87a1..300c81f14 100644 --- a/src/screen.c +++ b/src/screen.c @@ -577,16 +577,14 @@ meta_screen_new (MetaDisplay *display, reload_xinerama_infos (screen); meta_screen_set_cursor (screen, META_CURSOR_DEFAULT); - - if (display->no_focus_window == None) - { - display->no_focus_window = meta_create_offscreen_window (display->xdisplay, - screen->xroot); - XSelectInput (display->xdisplay, display->no_focus_window, - FocusChangeMask | KeyPressMask | KeyReleaseMask); - XMapWindow (display->xdisplay, display->no_focus_window); - } + /* Handle creating a no_focus_window for this screen */ + screen->no_focus_window = meta_create_offscreen_window (display->xdisplay, + screen->xroot); + XSelectInput (display->xdisplay, screen->no_focus_window, + FocusChangeMask | KeyPressMask | KeyReleaseMask); + XMapWindow (display->xdisplay, screen->no_focus_window); + /* Done with no_focus_window stuff */ set_wm_icon_size_hint (screen); diff --git a/src/screen.h b/src/screen.h index 50cfa075b..29411ea9b 100644 --- a/src/screen.h +++ b/src/screen.h @@ -72,6 +72,11 @@ struct _MetaScreen MetaWorkspace *active_workspace; + /* This window holds the focus when we don't want to focus + * any actual clients + */ + Window no_focus_window; + GList *workspaces; MetaStack *stack; diff --git a/src/window.c b/src/window.c index 19bb2790c..f74005a6b 100644 --- a/src/window.c +++ b/src/window.c @@ -241,7 +241,7 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_verbose ("Attempting to manage 0x%lx\n", xwindow); - if (xwindow == display->no_focus_window) + if (meta_display_xwindow_is_a_no_focus_window (display, xwindow)) { meta_verbose ("Not managing no_focus_window 0x%lx\n", xwindow); @@ -1763,7 +1763,7 @@ meta_window_show (MetaWindow *window) "ancestor.\n", window->display->focus_window->desc, window->desc); - meta_display_focus_the_no_focus_window (window->display, meta_display_get_current_time_roundtrip (window->display)); + meta_display_focus_the_no_focus_window (window->display, window->screen, meta_display_get_current_time_roundtrip (window->display)); } else { diff --git a/src/workspace.c b/src/workspace.c index d19e6a8fb..3988cb963 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -925,6 +925,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace, "Setting focus to no_focus_window, since no valid " "window to focus found.\n"); meta_display_focus_the_no_focus_window (workspace->screen->display, + workspace->screen, timestamp); } } @@ -1014,6 +1015,7 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, { meta_topic (META_DEBUG_FOCUS, "No MRU window to focus found; focusing no_focus_window.\n"); meta_display_focus_the_no_focus_window (workspace->screen->display, + workspace->screen, timestamp); } }