diff --git a/ChangeLog b/ChangeLog index 1ef3bd807..2eed8a142 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2002-05-11 Anders Carlsson + + * src/display.c: (find_tab_forward), (find_tab_backward), + (meta_display_get_tab_next): + * src/display.h: + * src/keybindings.c: (handle_tab_forward), (handle_focus_previous): + Add screen argument to meta_display_get_tab_next, since we only + want windows on the same screen to appear in the tab chain. + + * src/screen.c: (meta_screen_new): + Or the event mask with existing events since gtk+ may listen to + certain events and we don't want to disable those events. + + (meta_screen_ensure_tab_popup): + * src/tabpopup.c: (meta_ui_tab_popup_new): + * src/tabpopup.h: + Add a screen number argument to meta_ui_tab_popup_new so we + can position the popup on the correct screen. + 2002-05-11 Havoc Pennington * src/main.c: include locale.h, fix from Hidetoshi Tajima @@ -47,6 +66,7 @@ the calc_showing, don't focus it, it's probably on another workspace or something. +>>>>>>> 1.239 2002-05-09 Havoc Pennington * src/frames.c (show_tip_now): DefaultScreen() returns the screen diff --git a/src/display.c b/src/display.c index e7c3a838c..81ced59b4 100644 --- a/src/display.c +++ b/src/display.c @@ -2615,19 +2615,21 @@ meta_display_window_has_pending_pings (MetaDisplay *display, static MetaWindow* find_tab_forward (MetaDisplay *display, MetaTabList type, + MetaScreen *screen, MetaWorkspace *workspace, GList *start) { GList *tmp; g_return_val_if_fail (start != NULL, NULL); - + tmp = start->next; while (tmp != NULL) { MetaWindow *window = tmp->data; - if (IN_TAB_CHAIN (window, type) && + if (window->screen == screen && + IN_TAB_CHAIN (window, type) && (workspace == NULL || meta_window_visible_on_workspace (window, workspace))) return window; @@ -2654,6 +2656,7 @@ find_tab_forward (MetaDisplay *display, static MetaWindow* find_tab_backward (MetaDisplay *display, MetaTabList type, + MetaScreen *screen, MetaWorkspace *workspace, GList *start) { @@ -2666,7 +2669,8 @@ find_tab_backward (MetaDisplay *display, { MetaWindow *window = tmp->data; - if (IN_TAB_CHAIN (window, type) && + if (window->screen == screen && + IN_TAB_CHAIN (window, type) && (workspace == NULL || meta_window_visible_on_workspace (window, workspace))) return window; @@ -2727,6 +2731,7 @@ meta_display_get_tab_list (MetaDisplay *display, MetaWindow* meta_display_get_tab_next (MetaDisplay *display, MetaTabList type, + MetaScreen *screen, MetaWorkspace *workspace, MetaWindow *window, gboolean backward) @@ -2739,20 +2744,20 @@ meta_display_get_tab_next (MetaDisplay *display, g_assert (window->display == display); if (backward) - return find_tab_backward (display, type, workspace, + return find_tab_backward (display, type, screen, workspace, g_list_find (display->mru_list, window)); else - return find_tab_forward (display, type, workspace, + return find_tab_forward (display, type, screen, workspace, g_list_find (display->mru_list, window)); } if (backward) - return find_tab_backward (display, type, workspace, + return find_tab_backward (display, type, screen, workspace, g_list_last (display->mru_list)); else - return find_tab_forward (display, type, workspace, + return find_tab_forward (display, type, screen, workspace, display->mru_list); } diff --git a/src/display.h b/src/display.h index 10a2fbf6c..92b2a0259 100644 --- a/src/display.h +++ b/src/display.h @@ -307,6 +307,7 @@ GSList* meta_display_get_tab_list (MetaDisplay *display, MetaWindow* meta_display_get_tab_next (MetaDisplay *display, MetaTabList type, + MetaScreen *screen, MetaWorkspace *workspace, MetaWindow *window, gboolean backward); diff --git a/src/keybindings.c b/src/keybindings.c index 8b4096413..957e6e694 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -1439,6 +1439,7 @@ handle_tab_forward (MetaDisplay *display, { window = meta_display_get_tab_next (display, type, + display->focus_window->screen, display->focus_window->screen->active_workspace, display->focus_window, backward); @@ -1458,6 +1459,7 @@ handle_tab_forward (MetaDisplay *display, { window = meta_display_get_tab_next (screen->display, type, + screen, screen->active_workspace, NULL, backward); @@ -1525,6 +1527,7 @@ handle_focus_previous (MetaDisplay *display, /* Pick first window in tab order */ window = meta_display_get_tab_next (screen->display, META_TAB_LIST_NORMAL, + screen, screen->active_workspace, NULL, TRUE); diff --git a/src/screen.c b/src/screen.c index 98c7a4257..c765eda4c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -165,6 +165,8 @@ meta_screen_new (MetaDisplay *display, MetaScreen *screen; Window xroot; Display *xdisplay; + XWindowAttributes attr; + int xinerama_event_base, xinerama_error_base; /* Only display->name, display->xdisplay, and display->error_traps @@ -191,13 +193,18 @@ meta_screen_new (MetaDisplay *display, /* Select our root window events */ meta_error_trap_push (display); + + /* We need to or with the existing event mask since + * gtk+ may be interested in other events. + */ + XGetWindowAttributes (xdisplay, xroot, &attr); XSelectInput (xdisplay, xroot, SubstructureRedirectMask | SubstructureNotifyMask | ColormapChangeMask | PropertyChangeMask | LeaveWindowMask | EnterWindowMask | ButtonPressMask | ButtonReleaseMask | - FocusChangeMask); + FocusChangeMask | attr.your_event_mask); if (meta_error_trap_pop (display) != Success) { meta_warning (_("Screen %d on display '%s' already has a window manager\n"), @@ -683,7 +690,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, GSList *tmp; int len; int i; - + if (screen->tab_popup) return; @@ -747,8 +754,8 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, ++i; tmp = tmp->next; } - - screen->tab_popup = meta_ui_tab_popup_new (entries); + + screen->tab_popup = meta_ui_tab_popup_new (entries, screen->number); g_free (entries); g_slist_free (tab_list); diff --git a/src/tabpopup.c b/src/tabpopup.c index c5db90203..54f7828cc 100644 --- a/src/tabpopup.c +++ b/src/tabpopup.c @@ -19,6 +19,8 @@ * 02111-1307, USA. */ +#include + #include "util.h" #include "core.h" #include "tabpopup.h" @@ -90,7 +92,8 @@ outline_window_expose (GtkWidget *widget, } MetaTabPopup* -meta_ui_tab_popup_new (const MetaTabEntry *entries) +meta_ui_tab_popup_new (const MetaTabEntry *entries, + int screen_number) { MetaTabPopup *popup; int i, left, right, top, bottom; @@ -103,10 +106,16 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries) GList *tmp; GtkWidget *frame; int max_label_width; - + popup = g_new (MetaTabPopup, 1); popup->outline_window = gtk_window_new (GTK_WINDOW_POPUP); +#ifdef HAVE_GTK_MULTIHEAD + gtk_window_set_screen (GTK_WINDOW (popup->outline_window), + gdk_display_get_screen (gdk_get_default_display (), + screen_number)); +#endif + gtk_widget_set_app_paintable (popup->outline_window, TRUE); gtk_widget_realize (popup->outline_window); @@ -114,6 +123,12 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries) G_CALLBACK (outline_window_expose), popup); popup->window = gtk_window_new (GTK_WINDOW_POPUP); +#ifdef HAVE_GTK_MULTIHEAD + gtk_window_set_screen (GTK_WINDOW (popup->window), + gdk_display_get_screen (gdk_get_default_display (), + screen_number)); +#endif + gtk_window_set_position (GTK_WINDOW (popup->window), GTK_WIN_POS_CENTER_ALWAYS); /* enable resizing, to get never-shrink behavior */ diff --git a/src/tabpopup.h b/src/tabpopup.h index f861f02f3..417c94172 100644 --- a/src/tabpopup.h +++ b/src/tabpopup.h @@ -40,7 +40,8 @@ struct _MetaTabEntry int inner_x, inner_y, inner_width, inner_height; }; -MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries); +MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries, + int screen_number); void meta_ui_tab_popup_free (MetaTabPopup *popup); void meta_ui_tab_popup_set_showing (MetaTabPopup *popup, gboolean showing);