Add screen argument to meta_display_get_tab_next, since we only want

2002-05-11  Anders Carlsson  <andersca@gnu.org>

	* 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.
This commit is contained in:
Anders Carlsson 2002-05-11 06:59:54 +00:00 committed by Anders Carlsson
parent 41e99288b5
commit af83598ad3
7 changed files with 66 additions and 14 deletions

View File

@ -1,3 +1,22 @@
2002-05-11 Anders Carlsson <andersca@gnu.org>
* 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 <hp@pobox.com> 2002-05-11 Havoc Pennington <hp@pobox.com>
* src/main.c: include locale.h, fix from Hidetoshi Tajima * 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 the calc_showing, don't focus it, it's probably on another
workspace or something. workspace or something.
>>>>>>> 1.239
2002-05-09 Havoc Pennington <hp@redhat.com> 2002-05-09 Havoc Pennington <hp@redhat.com>
* src/frames.c (show_tip_now): DefaultScreen() returns the screen * src/frames.c (show_tip_now): DefaultScreen() returns the screen

View File

@ -2615,19 +2615,21 @@ meta_display_window_has_pending_pings (MetaDisplay *display,
static MetaWindow* static MetaWindow*
find_tab_forward (MetaDisplay *display, find_tab_forward (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace, MetaWorkspace *workspace,
GList *start) GList *start)
{ {
GList *tmp; GList *tmp;
g_return_val_if_fail (start != NULL, NULL); g_return_val_if_fail (start != NULL, NULL);
tmp = start->next; tmp = start->next;
while (tmp != NULL) while (tmp != NULL)
{ {
MetaWindow *window = tmp->data; MetaWindow *window = tmp->data;
if (IN_TAB_CHAIN (window, type) && if (window->screen == screen &&
IN_TAB_CHAIN (window, type) &&
(workspace == NULL || (workspace == NULL ||
meta_window_visible_on_workspace (window, workspace))) meta_window_visible_on_workspace (window, workspace)))
return window; return window;
@ -2654,6 +2656,7 @@ find_tab_forward (MetaDisplay *display,
static MetaWindow* static MetaWindow*
find_tab_backward (MetaDisplay *display, find_tab_backward (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace, MetaWorkspace *workspace,
GList *start) GList *start)
{ {
@ -2666,7 +2669,8 @@ find_tab_backward (MetaDisplay *display,
{ {
MetaWindow *window = tmp->data; MetaWindow *window = tmp->data;
if (IN_TAB_CHAIN (window, type) && if (window->screen == screen &&
IN_TAB_CHAIN (window, type) &&
(workspace == NULL || (workspace == NULL ||
meta_window_visible_on_workspace (window, workspace))) meta_window_visible_on_workspace (window, workspace)))
return window; return window;
@ -2727,6 +2731,7 @@ meta_display_get_tab_list (MetaDisplay *display,
MetaWindow* MetaWindow*
meta_display_get_tab_next (MetaDisplay *display, meta_display_get_tab_next (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace, MetaWorkspace *workspace,
MetaWindow *window, MetaWindow *window,
gboolean backward) gboolean backward)
@ -2739,20 +2744,20 @@ meta_display_get_tab_next (MetaDisplay *display,
g_assert (window->display == display); g_assert (window->display == display);
if (backward) if (backward)
return find_tab_backward (display, type, workspace, return find_tab_backward (display, type, screen, workspace,
g_list_find (display->mru_list, g_list_find (display->mru_list,
window)); window));
else else
return find_tab_forward (display, type, workspace, return find_tab_forward (display, type, screen, workspace,
g_list_find (display->mru_list, g_list_find (display->mru_list,
window)); window));
} }
if (backward) if (backward)
return find_tab_backward (display, type, workspace, return find_tab_backward (display, type, screen, workspace,
g_list_last (display->mru_list)); g_list_last (display->mru_list));
else else
return find_tab_forward (display, type, workspace, return find_tab_forward (display, type, screen, workspace,
display->mru_list); display->mru_list);
} }

View File

@ -307,6 +307,7 @@ GSList* meta_display_get_tab_list (MetaDisplay *display,
MetaWindow* meta_display_get_tab_next (MetaDisplay *display, MetaWindow* meta_display_get_tab_next (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace, MetaWorkspace *workspace,
MetaWindow *window, MetaWindow *window,
gboolean backward); gboolean backward);

View File

@ -1439,6 +1439,7 @@ handle_tab_forward (MetaDisplay *display,
{ {
window = meta_display_get_tab_next (display, window = meta_display_get_tab_next (display,
type, type,
display->focus_window->screen,
display->focus_window->screen->active_workspace, display->focus_window->screen->active_workspace,
display->focus_window, display->focus_window,
backward); backward);
@ -1458,6 +1459,7 @@ handle_tab_forward (MetaDisplay *display,
{ {
window = meta_display_get_tab_next (screen->display, window = meta_display_get_tab_next (screen->display,
type, type,
screen,
screen->active_workspace, screen->active_workspace,
NULL, NULL,
backward); backward);
@ -1525,6 +1527,7 @@ handle_focus_previous (MetaDisplay *display,
/* Pick first window in tab order */ /* Pick first window in tab order */
window = meta_display_get_tab_next (screen->display, window = meta_display_get_tab_next (screen->display,
META_TAB_LIST_NORMAL, META_TAB_LIST_NORMAL,
screen,
screen->active_workspace, screen->active_workspace,
NULL, NULL,
TRUE); TRUE);

View File

@ -165,6 +165,8 @@ meta_screen_new (MetaDisplay *display,
MetaScreen *screen; MetaScreen *screen;
Window xroot; Window xroot;
Display *xdisplay; Display *xdisplay;
XWindowAttributes attr;
int xinerama_event_base, xinerama_error_base; int xinerama_event_base, xinerama_error_base;
/* Only display->name, display->xdisplay, and display->error_traps /* Only display->name, display->xdisplay, and display->error_traps
@ -191,13 +193,18 @@ meta_screen_new (MetaDisplay *display,
/* Select our root window events */ /* Select our root window events */
meta_error_trap_push (display); 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, XSelectInput (xdisplay,
xroot, xroot,
SubstructureRedirectMask | SubstructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask |
ColormapChangeMask | PropertyChangeMask | ColormapChangeMask | PropertyChangeMask |
LeaveWindowMask | EnterWindowMask | LeaveWindowMask | EnterWindowMask |
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
FocusChangeMask); FocusChangeMask | attr.your_event_mask);
if (meta_error_trap_pop (display) != Success) if (meta_error_trap_pop (display) != Success)
{ {
meta_warning (_("Screen %d on display '%s' already has a window manager\n"), 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; GSList *tmp;
int len; int len;
int i; int i;
if (screen->tab_popup) if (screen->tab_popup)
return; return;
@ -747,8 +754,8 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
++i; ++i;
tmp = tmp->next; 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_free (entries);
g_slist_free (tab_list); g_slist_free (tab_list);

View File

@ -19,6 +19,8 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#include <config.h>
#include "util.h" #include "util.h"
#include "core.h" #include "core.h"
#include "tabpopup.h" #include "tabpopup.h"
@ -90,7 +92,8 @@ outline_window_expose (GtkWidget *widget,
} }
MetaTabPopup* MetaTabPopup*
meta_ui_tab_popup_new (const MetaTabEntry *entries) meta_ui_tab_popup_new (const MetaTabEntry *entries,
int screen_number)
{ {
MetaTabPopup *popup; MetaTabPopup *popup;
int i, left, right, top, bottom; int i, left, right, top, bottom;
@ -103,10 +106,16 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
GList *tmp; GList *tmp;
GtkWidget *frame; GtkWidget *frame;
int max_label_width; int max_label_width;
popup = g_new (MetaTabPopup, 1); popup = g_new (MetaTabPopup, 1);
popup->outline_window = gtk_window_new (GTK_WINDOW_POPUP); 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_set_app_paintable (popup->outline_window, TRUE);
gtk_widget_realize (popup->outline_window); gtk_widget_realize (popup->outline_window);
@ -114,6 +123,12 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
G_CALLBACK (outline_window_expose), popup); G_CALLBACK (outline_window_expose), popup);
popup->window = gtk_window_new (GTK_WINDOW_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_window_set_position (GTK_WINDOW (popup->window),
GTK_WIN_POS_CENTER_ALWAYS); GTK_WIN_POS_CENTER_ALWAYS);
/* enable resizing, to get never-shrink behavior */ /* enable resizing, to get never-shrink behavior */

View File

@ -40,7 +40,8 @@ struct _MetaTabEntry
int inner_x, inner_y, inner_width, inner_height; 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_free (MetaTabPopup *popup);
void meta_ui_tab_popup_set_showing (MetaTabPopup *popup, void meta_ui_tab_popup_set_showing (MetaTabPopup *popup,
gboolean showing); gboolean showing);