Remove any possibility for zaphod mode

We previously separated out MetaDisplay and MetaScreen. mutter
would only manage one screen, but we still kept a list of screens
for simplicity.

With Wayland support, we no longer care about the ability to
manage more than one screen at a time. Remove this by killing
the list of screens, in favor of having just one MetaScreen
in MetaDisplay.

We also kill off active_screen at the same time, since it's
not necessary anymore.

A future cleanup should merge MetaDisplay and MetaScreen. To avoid
breaking API, we should probably keep MetaScreen around as a dummy
type.
This commit is contained in:
Jasper St. Pierre 2013-10-03 18:31:09 -04:00
parent 97ea4e8717
commit d7519f4ebc
13 changed files with 100 additions and 492 deletions

View File

@ -935,10 +935,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
MetaWindow *window) MetaWindow *window)
{ {
MetaDisplay *display = compositor->display; MetaDisplay *display = compositor->display;
MetaScreen *screen = display->screens->data; MetaCompScreen *info = meta_screen_get_compositor_data (display->screen);
MetaCompScreen *info;
info = meta_screen_get_compositor_data (screen);
if (is_modal (display) && is_grabbed_event (compositor->display, event)) if (is_modal (display) && is_grabbed_event (compositor->display, event))
{ {
@ -1367,18 +1364,8 @@ static gboolean
meta_repaint_func (gpointer data) meta_repaint_func (gpointer data)
{ {
MetaCompositor *compositor = data; MetaCompositor *compositor = data;
GSList *screens = meta_display_get_screens (compositor->display); MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
GSList *l; pre_paint_windows (info);
for (l = screens; l; l = l->next)
{
MetaScreen *screen = l->data;
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
if (!info)
continue;
pre_paint_windows (info);
}
return TRUE; return TRUE;
} }
@ -1387,20 +1374,11 @@ static void
on_shadow_factory_changed (MetaShadowFactory *factory, on_shadow_factory_changed (MetaShadowFactory *factory,
MetaCompositor *compositor) MetaCompositor *compositor)
{ {
GSList *screens = meta_display_get_screens (compositor->display); MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
GList *l; GList *l;
GSList *sl;
for (sl = screens; sl; sl = sl->next) for (l = info->windows; l; l = l->next)
{ meta_window_actor_invalidate_shadow (l->data);
MetaScreen *screen = sl->data;
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
if (!info)
continue;
for (l = info->windows; l; l = l->next)
meta_window_actor_invalidate_shadow (l->data);
}
} }
/** /**

View File

@ -74,26 +74,8 @@ static void
bell_flash_fullscreen (MetaDisplay *display, bell_flash_fullscreen (MetaDisplay *display,
XkbAnyEvent *xkb_ev) XkbAnyEvent *xkb_ev)
{ {
XkbBellNotifyEvent *xkb_bell_ev = (XkbBellNotifyEvent *) xkb_ev;
MetaScreen *screen;
g_assert (xkb_ev->xkb_type == XkbBellNotify); g_assert (xkb_ev->xkb_type == XkbBellNotify);
if (xkb_bell_ev->window != None) meta_compositor_flash_screen (display->compositor, display->screen);
{
screen = meta_display_screen_for_xwindow (display, xkb_bell_ev->window);
if (screen)
meta_compositor_flash_screen (display->compositor, screen);
}
else
{
GSList *screen_list = display->screens;
while (screen_list)
{
screen = (MetaScreen *) screen_list->data;
meta_compositor_flash_screen (display->compositor, screen);
screen_list = screen_list->next;
}
}
} }
/** /**

View File

@ -274,7 +274,7 @@ meta_core_lower_beneath_grab_window (Display *xdisplay,
MetaStackWindow stack_sibling; MetaStackWindow stack_sibling;
display = meta_display_for_x_display (xdisplay); display = meta_display_for_x_display (xdisplay);
screen = meta_display_screen_for_xwindow (display, xwindow); screen = display->screen;
grab_window = display->grab_window; grab_window = display->grab_window;
if (grab_window == NULL) if (grab_window == NULL)
@ -603,13 +603,10 @@ meta_core_get_workspace_name_with_index (Display *xdisplay,
int index) int index)
{ {
MetaDisplay *display; MetaDisplay *display;
MetaScreen *screen;
MetaWorkspace *workspace; MetaWorkspace *workspace;
display = meta_display_for_x_display (xdisplay); display = meta_display_for_x_display (xdisplay);
screen = meta_display_screen_for_root (display, xroot); workspace = meta_screen_get_workspace_by_index (display->screen, index);
g_assert (screen != NULL);
workspace = meta_screen_get_workspace_by_index (screen, index);
return workspace ? meta_workspace_get_name (workspace) : NULL; return workspace ? meta_workspace_get_name (workspace) : NULL;
} }
@ -630,7 +627,7 @@ meta_core_begin_grab_op (Display *xdisplay,
MetaScreen *screen; MetaScreen *screen;
display = meta_display_for_x_display (xdisplay); display = meta_display_for_x_display (xdisplay);
screen = meta_display_screen_for_xwindow (display, frame_xwindow); screen = display->screen;
g_assert (screen != NULL); g_assert (screen != NULL);

View File

@ -148,8 +148,7 @@ struct _MetaDisplay
/*< private-ish >*/ /*< private-ish >*/
guint error_trap_synced_at_last_pop : 1; guint error_trap_synced_at_last_pop : 1;
GSList *screens; MetaScreen *screen;
MetaScreen *active_screen;
GHashTable *xids; GHashTable *xids;
GHashTable *wayland_windows; GHashTable *wayland_windows;
int error_traps; int error_traps;
@ -351,10 +350,6 @@ struct _MetaDisplayClass
gboolean meta_display_open (void); gboolean meta_display_open (void);
void meta_display_close (MetaDisplay *display, void meta_display_close (MetaDisplay *display,
guint32 timestamp); guint32 timestamp);
MetaScreen* meta_display_screen_for_x_screen (MetaDisplay *display,
Screen *screen);
MetaScreen* meta_display_screen_for_xwindow (MetaDisplay *display,
Window xindow);
void meta_display_grab (MetaDisplay *display); void meta_display_grab (MetaDisplay *display);
void meta_display_ungrab (MetaDisplay *display); void meta_display_ungrab (MetaDisplay *display);

View File

@ -362,8 +362,6 @@ sn_error_trap_pop (SnDisplay *sn_display,
static void static void
enable_compositor (MetaDisplay *display) enable_compositor (MetaDisplay *display)
{ {
GSList *list;
if (!META_DISPLAY_HAS_COMPOSITE (display) || if (!META_DISPLAY_HAS_COMPOSITE (display) ||
!META_DISPLAY_HAS_DAMAGE (display) || !META_DISPLAY_HAS_DAMAGE (display) ||
!META_DISPLAY_HAS_RENDER (display)) !META_DISPLAY_HAS_RENDER (display))
@ -379,14 +377,8 @@ enable_compositor (MetaDisplay *display)
if (!display->compositor) if (!display->compositor)
return; return;
for (list = display->screens; list != NULL; list = list->next) meta_compositor_manage_screen (display->compositor, display->screen);
{
MetaScreen *screen = list->data;
meta_compositor_manage_screen (screen->display->compositor,
screen);
}
} }
static void static void
@ -440,7 +432,6 @@ gboolean
meta_display_open (void) meta_display_open (void)
{ {
Display *xdisplay; Display *xdisplay;
GSList *screens;
MetaScreen *screen; MetaScreen *screen;
int i; int i;
guint32 timestamp; guint32 timestamp;
@ -536,8 +527,7 @@ meta_display_open (void)
the_display->window_with_menu = NULL; the_display->window_with_menu = NULL;
the_display->window_menu = NULL; the_display->window_menu = NULL;
the_display->screens = NULL; the_display->screen = NULL;
the_display->active_screen = NULL;
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
the_display->sn_display = sn_display_new (the_display->xdisplay, the_display->sn_display = sn_display_new (the_display->xdisplay,
@ -841,15 +831,12 @@ meta_display_open (void)
the_display->last_focus_time = timestamp; the_display->last_focus_time = timestamp;
the_display->last_user_time = timestamp; the_display->last_user_time = timestamp;
the_display->compositor = NULL; the_display->compositor = NULL;
/* Mutter used to manage all X screens of the display in a single process, but /* Mutter used to manage all X screens of the display in a single process, but
* now it always manages exactly one screen as specified by the DISPLAY * now it always manages exactly one screen as specified by the DISPLAY
* environment variable. The screens GSList is left for simplicity. * environment variable.
*/ */
screens = NULL;
i = meta_ui_get_screen_number (); i = meta_ui_get_screen_number ();
screen = meta_screen_new (the_display, i, timestamp); screen = meta_screen_new (the_display, i, timestamp);
if (!screen) if (!screen)
@ -861,9 +848,7 @@ meta_display_open (void)
return FALSE; return FALSE;
} }
screens = g_slist_prepend (screens, screen); the_display->screen = screen;
the_display->screens = screens;
enable_compositor (the_display); enable_compositor (the_display);
@ -895,7 +880,7 @@ meta_display_open (void)
if (focus == None || focus == PointerRoot) if (focus == None || focus == PointerRoot)
/* Just focus the no_focus_window on the first screen */ /* Just focus the no_focus_window on the first screen */
meta_display_focus_the_no_focus_window (the_display, meta_display_focus_the_no_focus_window (the_display,
the_display->screens->data, the_display->screen,
timestamp); timestamp);
else else
{ {
@ -906,7 +891,7 @@ meta_display_open (void)
else else
/* Just focus the no_focus_window on the first screen */ /* Just focus the no_focus_window on the first screen */
meta_display_focus_the_no_focus_window (the_display, meta_display_focus_the_no_focus_window (the_display,
the_display->screens->data, the_display->screen,
timestamp); timestamp);
} }
@ -948,8 +933,8 @@ meta_display_list_windows (MetaDisplay *display,
MetaListWindowsFlags flags) MetaListWindowsFlags flags)
{ {
GSList *winlist; GSList *winlist;
GSList *tmp;
GSList *prev; GSList *prev;
GSList *tmp;
GHashTableIter iter; GHashTableIter iter;
gpointer key, value; gpointer key, value;
@ -1024,8 +1009,6 @@ void
meta_display_close (MetaDisplay *display, meta_display_close (MetaDisplay *display,
guint32 timestamp) guint32 timestamp)
{ {
GSList *tmp;
g_assert (display != NULL); g_assert (display != NULL);
if (display->closing != 0) if (display->closing != 0)
@ -1053,17 +1036,7 @@ meta_display_close (MetaDisplay *display,
/* Stop caring about events */ /* Stop caring about events */
meta_display_free_events (display); meta_display_free_events (display);
/* Free all screens */ meta_screen_free (display->screen, timestamp);
tmp = display->screens;
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
meta_screen_free (screen, timestamp);
tmp = tmp->next;
}
g_slist_free (display->screens);
display->screens = NULL;
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
if (display->sn_display) if (display->sn_display)
@ -1099,77 +1072,6 @@ meta_display_close (MetaDisplay *display,
meta_quit (META_EXIT_SUCCESS); meta_quit (META_EXIT_SUCCESS);
} }
/**
* meta_display_screen_for_root:
* @display: a #MetaDisplay
* @xroot: a X window
*
* Return the #MetaScreen corresponding to a specified X root window ID.
*
* Return Value: (transfer none): the screen for the specified root window ID, or %NULL
*/
MetaScreen*
meta_display_screen_for_root (MetaDisplay *display,
Window xroot)
{
GSList *tmp;
tmp = display->screens;
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
if (xroot == screen->xroot)
return screen;
tmp = tmp->next;
}
return NULL;
}
MetaScreen*
meta_display_screen_for_xwindow (MetaDisplay *display,
Window xwindow)
{
XWindowAttributes attr;
int result;
meta_error_trap_push (display);
attr.screen = NULL;
result = XGetWindowAttributes (display->xdisplay, xwindow, &attr);
meta_error_trap_pop (display);
/* Note, XGetWindowAttributes is on all kinds of crack
* and returns 1 on success 0 on failure, rather than Success
* on success.
*/
if (result == 0 || attr.screen == NULL)
return NULL;
return meta_display_screen_for_x_screen (display, attr.screen);
}
MetaScreen*
meta_display_screen_for_x_screen (MetaDisplay *display,
Screen *xscreen)
{
GSList *tmp;
tmp = display->screens;
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
if (xscreen == screen->xscreen)
return screen;
tmp = tmp->next;
}
return NULL;
}
/* Grab/ungrab routines taken from fvwm. /* Grab/ungrab routines taken from fvwm.
* Calling this function will cause X to ignore all other clients until * Calling this function will cause X to ignore all other clients until
* you ungrab. This may not be quite as bad as it sounds, yet there is * you ungrab. This may not be quite as bad as it sounds, yet there is
@ -1775,7 +1677,6 @@ request_xserver_input_focus_change (MetaDisplay *display,
meta_error_trap_pop (display); meta_error_trap_pop (display);
display->last_focus_time = timestamp; display->last_focus_time = timestamp;
display->active_screen = screen;
if (meta_window == NULL || meta_window != display->autoraise_window) if (meta_window == NULL || meta_window != display->autoraise_window)
meta_display_remove_autoraise_callback (display); meta_display_remove_autoraise_callback (display);
@ -1877,18 +1778,7 @@ gboolean
meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display, meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
Window xwindow) Window xwindow)
{ {
gboolean is_a_no_focus_window = FALSE; return xwindow == display->screen->no_focus_window;
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;
} }
static MetaCursor static MetaCursor
@ -2517,30 +2407,19 @@ meta_display_increment_event_serial (MetaDisplay *display)
void void
meta_display_update_active_window_hint (MetaDisplay *display) meta_display_update_active_window_hint (MetaDisplay *display)
{ {
GSList *tmp;
gulong data[1]; gulong data[1];
if (display->focus_window) if (display->focus_window)
data[0] = display->focus_window->xwindow; data[0] = display->focus_window->xwindow;
else else
data[0] = None; data[0] = None;
tmp = display->screens;
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
meta_error_trap_push (display);
XChangeProperty (display->xdisplay, screen->xroot,
display->atom__NET_ACTIVE_WINDOW,
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (display); meta_error_trap_push (display);
XChangeProperty (display->xdisplay, display->screen->xroot,
tmp = tmp->next; display->atom__NET_ACTIVE_WINDOW,
} XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (display);
} }
void void
@ -2578,22 +2457,12 @@ void
meta_display_set_cursor_theme (const char *theme, meta_display_set_cursor_theme (const char *theme,
int size) int size)
{ {
GSList *tmp;
MetaDisplay *display = meta_get_display (); MetaDisplay *display = meta_get_display ();
XcursorSetTheme (display->xdisplay, theme); XcursorSetTheme (display->xdisplay, theme);
XcursorSetDefaultSize (display->xdisplay, size); XcursorSetDefaultSize (display->xdisplay, size);
tmp = display->screens; meta_screen_update_cursor (display->screen);
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
meta_screen_update_cursor (screen);
tmp = tmp->next;
}
} }
/* /*
@ -2808,7 +2677,6 @@ get_focused_group (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,
gboolean skip_first) gboolean skip_first)
@ -2826,8 +2694,7 @@ find_tab_forward (MetaDisplay *display,
{ {
MetaWindow *window = tmp->data; MetaWindow *window = tmp->data;
if (window->screen == screen && if (IN_TAB_CHAIN (window, type))
IN_TAB_CHAIN (window, type))
return window; return window;
tmp = tmp->next; tmp = tmp->next;
@ -2850,7 +2717,6 @@ 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,
gboolean skip_last) gboolean skip_last)
@ -2867,8 +2733,7 @@ find_tab_backward (MetaDisplay *display,
{ {
MetaWindow *window = tmp->data; MetaWindow *window = tmp->data;
if (window->screen == screen && if (IN_TAB_CHAIN (window, type))
IN_TAB_CHAIN (window, type))
return window; return window;
tmp = tmp->prev; tmp = tmp->prev;
@ -2909,21 +2774,19 @@ mru_cmp (gconstpointer a,
* meta_display_get_tab_list: * meta_display_get_tab_list:
* @display: a #MetaDisplay * @display: a #MetaDisplay
* @type: type of tab list * @type: type of tab list
* @screen: a #MetaScreen
* @workspace: (allow-none): origin workspace * @workspace: (allow-none): origin workspace
* *
* Determine the list of windows that should be displayed for Alt-TAB * Determine the list of windows that should be displayed for Alt-TAB
* functionality. The windows are returned in most recently used order. * functionality. The windows are returned in most recently used order.
* If @workspace is not %NULL, the list only conains windows that are on * If @workspace is not %NULL, the list only conains windows that are on
* @workspace or have the demands-attention hint set; otherwise it contains * @workspace or have the demands-attention hint set; otherwise it contains
* all windows on @screen. * all windows.
* *
* Returns: (transfer container) (element-type Meta.Window): List of windows * Returns: (transfer container) (element-type Meta.Window): List of windows
*/ */
GList* GList*
meta_display_get_tab_list (MetaDisplay *display, meta_display_get_tab_list (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace) MetaWorkspace *workspace)
{ {
GList *tab_list = NULL; GList *tab_list = NULL;
@ -2948,8 +2811,7 @@ meta_display_get_tab_list (MetaDisplay *display,
{ {
MetaWindow *window = tmp->data; MetaWindow *window = tmp->data;
if (window->screen == screen && if (IN_TAB_CHAIN (window, type))
IN_TAB_CHAIN (window, type))
tab_list = g_list_prepend (tab_list, window); tab_list = g_list_prepend (tab_list, window);
} }
@ -2979,7 +2841,6 @@ meta_display_get_tab_list (MetaDisplay *display,
* meta_display_get_tab_next: * meta_display_get_tab_next:
* @display: a #MetaDisplay * @display: a #MetaDisplay
* @type: type of tab list * @type: type of tab list
* @screen: a #MetaScreen
* @workspace: origin workspace * @workspace: origin workspace
* @window: (allow-none): starting window * @window: (allow-none): starting window
* @backward: If %TRUE, look for the previous window. * @backward: If %TRUE, look for the previous window.
@ -2993,7 +2854,6 @@ 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)
@ -3001,10 +2861,7 @@ meta_display_get_tab_next (MetaDisplay *display,
gboolean skip; gboolean skip;
GList *tab_list; GList *tab_list;
MetaWindow *ret; MetaWindow *ret;
tab_list = meta_display_get_tab_list(display, tab_list = meta_display_get_tab_list (display, type, workspace);
type,
screen,
workspace);
if (tab_list == NULL) if (tab_list == NULL)
return NULL; return NULL;
@ -3014,26 +2871,18 @@ meta_display_get_tab_next (MetaDisplay *display,
g_assert (window->display == display); g_assert (window->display == display);
if (backward) if (backward)
ret = find_tab_backward (display, type, screen, workspace, ret = find_tab_backward (display, type, workspace, g_list_find (tab_list, window), TRUE);
g_list_find (tab_list,
window),
TRUE);
else else
ret = find_tab_forward (display, type, screen, workspace, ret = find_tab_forward (display, type, workspace, g_list_find (tab_list, window), TRUE);
g_list_find (tab_list,
window),
TRUE);
} }
else else
{ {
skip = display->focus_window != NULL && skip = display->focus_window != NULL &&
tab_list->data == display->focus_window; tab_list->data == display->focus_window;
if (backward) if (backward)
ret = find_tab_backward (display, type, screen, workspace, ret = find_tab_backward (display, type, workspace, tab_list, skip);
tab_list, skip);
else else
ret = find_tab_forward (display, type, screen, workspace, ret = find_tab_forward (display, type, workspace, tab_list, skip);
tab_list, skip);
} }
g_list_free (tab_list); g_list_free (tab_list);
@ -3044,7 +2893,6 @@ meta_display_get_tab_next (MetaDisplay *display,
* meta_display_get_tab_current: * meta_display_get_tab_current:
* @display: a #MetaDisplay * @display: a #MetaDisplay
* @type: type of tab list * @type: type of tab list
* @screen: a #MetaScreen
* @workspace: origin workspace * @workspace: origin workspace
* *
* Determine the active window that should be displayed for Alt-TAB. * Determine the active window that should be displayed for Alt-TAB.
@ -3055,7 +2903,6 @@ meta_display_get_tab_next (MetaDisplay *display,
MetaWindow* MetaWindow*
meta_display_get_tab_current (MetaDisplay *display, meta_display_get_tab_current (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace) MetaWorkspace *workspace)
{ {
MetaWindow *window; MetaWindow *window;
@ -3063,7 +2910,6 @@ meta_display_get_tab_current (MetaDisplay *display,
window = display->focus_window; window = display->focus_window;
if (window != NULL && if (window != NULL &&
window->screen == screen &&
IN_TAB_CHAIN (window, type) && IN_TAB_CHAIN (window, type) &&
(workspace == NULL || (workspace == NULL ||
meta_window_located_on_workspace (window, workspace))) meta_window_located_on_workspace (window, workspace)))
@ -3129,14 +2975,9 @@ meta_display_unmanage_screen (MetaDisplay *display,
{ {
meta_verbose ("Unmanaging screen %d on display %s\n", meta_verbose ("Unmanaging screen %d on display %s\n",
screen->number, display->name); screen->number, display->name);
g_return_if_fail (g_slist_find (display->screens, screen) != NULL);
meta_screen_free (screen, timestamp);
display->screens = g_slist_remove (display->screens, screen);
if (display->screens == NULL) meta_screen_free (screen, timestamp);
meta_display_close (display, timestamp); meta_display_close (display, timestamp);
} }
void void
@ -3178,15 +3019,7 @@ meta_display_stack_cmp (const void *a,
MetaWindow *aw = (void*) a; MetaWindow *aw = (void*) a;
MetaWindow *bw = (void*) b; MetaWindow *bw = (void*) b;
if (aw->screen == bw->screen) return meta_stack_windows_cmp (aw->screen->stack, aw, bw);
return meta_stack_windows_cmp (aw->screen->stack, aw, bw);
/* Then assume screens are stacked by number */
else if (aw->screen->number < bw->screen->number)
return -1;
else if (aw->screen->number > bw->screen->number)
return 1;
else
return 0; /* not reached in theory, if windows on same display */
} }
/** /**
@ -3322,7 +3155,7 @@ meta_display_increment_focus_sentinel (MetaDisplay *display)
data[0] = meta_display_get_current_time (display); data[0] = meta_display_get_current_time (display);
XChangeProperty (display->xdisplay, XChangeProperty (display->xdisplay,
((MetaScreen*) display->screens->data)->xroot, display->screen->xroot,
display->atom__MUTTER_SENTINEL, display->atom__MUTTER_SENTINEL,
XA_CARDINAL, XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1); 32, PropModeReplace, (guchar*) data, 1);
@ -3526,18 +3359,6 @@ meta_display_get_compositor (MetaDisplay *display)
return display->compositor; return display->compositor;
} }
/**
* meta_display_get_screens:
* @display: a #MetaDisplay
*
* Returns: (transfer none) (element-type Meta.Screen): Screens for this display
*/
GSList *
meta_display_get_screens (MetaDisplay *display)
{
return display->screens;
}
gboolean gboolean
meta_display_has_shape (MetaDisplay *display) meta_display_has_shape (MetaDisplay *display)
{ {

View File

@ -666,10 +666,10 @@ G_GNUC_UNUSED static void
meta_spew_event (MetaDisplay *display, meta_spew_event (MetaDisplay *display,
XEvent *event) XEvent *event)
{ {
MetaScreen *screen = display->screen;
const char *name = NULL; const char *name = NULL;
char *extra = NULL; char *extra = NULL;
char *winname; char *winname;
MetaScreen *screen;
XIEvent *input_event; XIEvent *input_event;
/* filter overnumerous events */ /* filter overnumerous events */
@ -693,9 +693,7 @@ meta_spew_event (MetaDisplay *display,
else else
meta_spew_core_event (display, event, &name, &extra); meta_spew_core_event (display, event, &name, &extra);
screen = meta_display_screen_for_root (display, event->xany.window); if (event->xany.window == screen->xroot)
if (screen)
winname = g_strdup_printf ("root %d", screen->number); winname = g_strdup_printf ("root %d", screen->number);
else else
winname = g_strdup_printf ("0x%lx", event->xany.window); winname = g_strdup_printf ("0x%lx", event->xany.window);
@ -735,7 +733,7 @@ handle_window_focus_event (MetaDisplay *display,
} }
else if (meta_display_xwindow_is_a_no_focus_window (display, event->event)) else if (meta_display_xwindow_is_a_no_focus_window (display, event->event))
window_type = "no_focus_window"; window_type = "no_focus_window";
else if (meta_display_screen_for_root (display, event->event)) else if (event->event == display->screen->xroot)
window_type = "root window"; window_type = "root window";
else else
window_type = "unknown window"; window_type = "unknown window";
@ -855,7 +853,7 @@ handle_input_xevent (MetaDisplay *display,
XIEnterEvent *enter_event = (XIEnterEvent *) input_event; XIEnterEvent *enter_event = (XIEnterEvent *) input_event;
Window modified; Window modified;
MetaWindow *window; MetaWindow *window;
MetaScreen *screen; MetaScreen *screen = display->screen;
if (input_event == NULL) if (input_event == NULL)
return FALSE; return FALSE;
@ -869,20 +867,6 @@ handle_input_xevent (MetaDisplay *display,
if (display->grab_op == META_GRAB_OP_COMPOSITOR) if (display->grab_op == META_GRAB_OP_COMPOSITOR)
break; break;
/* If the mouse switches screens, active the default window on the new
* screen; this will make keybindings and workspace-launched items
* actually appear on the right screen.
*/
{
MetaScreen *new_screen =
meta_display_screen_for_root (display, enter_event->root);
if (new_screen != NULL && display->active_screen != new_screen)
meta_workspace_focus_default_window (new_screen->active_workspace,
NULL,
enter_event->time);
}
/* Check if we've entered a window; do this even if window->has_focus to /* Check if we've entered a window; do this even if window->has_focus to
* avoid races. * avoid races.
*/ */
@ -923,8 +907,6 @@ handle_input_xevent (MetaDisplay *display,
if (enter_event->root != enter_event->event) if (enter_event->root != enter_event->event)
break; break;
screen = meta_display_screen_for_root (display, enter_event->root);
if (enter_event->evtype == XI_FocusIn && if (enter_event->evtype == XI_FocusIn &&
enter_event->mode == XINotifyDetailNone) enter_event->mode == XINotifyDetailNone)
{ {
@ -1013,21 +995,9 @@ process_request_frame_extents (MetaDisplay *display,
if ((hints_set && hints->decorations) || !hints_set) if ((hints_set && hints->decorations) || !hints_set)
{ {
MetaFrameBorders borders; MetaFrameBorders borders;
MetaScreen *screen;
screen = meta_display_screen_for_xwindow (display,
event->xclient.window);
if (screen == NULL)
{
meta_warning ("Received request to set _NET_FRAME_EXTENTS "
"on 0x%lx which is on a screen we are not managing\n",
event->xclient.window);
meta_XFree (hints);
return;
}
/* Return estimated frame extents for a normal window. */ /* Return estimated frame extents for a normal window. */
meta_ui_theme_get_frame_borders (screen->ui, meta_ui_theme_get_frame_borders (display->screen->ui,
META_FRAME_TYPE_NORMAL, META_FRAME_TYPE_NORMAL,
0, 0,
&borders); &borders);
@ -1052,28 +1022,6 @@ process_request_frame_extents (MetaDisplay *display,
meta_XFree (hints); meta_XFree (hints);
} }
static MetaScreen*
find_screen_for_selection (MetaDisplay *display,
Window owner,
Atom selection)
{
GSList *tmp;
tmp = display->screens;
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
if (screen->wm_sn_selection_window == owner &&
screen->wm_sn_atom == selection)
return screen;
tmp = tmp->next;
}
return NULL;
}
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */ /* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */
static gboolean static gboolean
convert_property (MetaDisplay *display, convert_property (MetaDisplay *display,
@ -1128,14 +1076,11 @@ static void
process_selection_request (MetaDisplay *display, process_selection_request (MetaDisplay *display,
XEvent *event) XEvent *event)
{ {
MetaScreen *screen = display->screen;
XSelectionEvent reply; XSelectionEvent reply;
MetaScreen *screen;
screen = find_screen_for_selection (display, if (screen->wm_sn_selection_window != event->xselectionrequest.owner ||
event->xselectionrequest.owner, screen->wm_sn_atom != event->xselectionrequest.selection)
event->xselectionrequest.selection);
if (screen == NULL)
{ {
char *str; char *str;
@ -1231,41 +1176,31 @@ static void
process_selection_clear (MetaDisplay *display, process_selection_clear (MetaDisplay *display,
XEvent *event) XEvent *event)
{ {
/* We need to unmanage the screen on which we lost the selection */ MetaScreen *screen = display->screen;
MetaScreen *screen;
screen = find_screen_for_selection (display, if (screen->wm_sn_selection_window != event->xselectionclear.window ||
event->xselectionclear.window, screen->wm_sn_atom != event->xselectionclear.selection)
event->xselectionclear.selection);
if (screen != NULL)
{ {
meta_verbose ("Got selection clear for screen %d on display %s\n", char *str;
screen->number, display->name);
meta_display_unmanage_screen (display, meta_error_trap_push (display);
screen, str = XGetAtomName (display->xdisplay,
event->xselectionclear.time); event->xselectionclear.selection);
meta_error_trap_pop (display);
/* display and screen may both be invalid memory... */ meta_verbose ("Selection clear with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
str ? str : "(bad atom)", event->xselectionclear.window);
meta_XFree (str);
return; return;
} }
{ meta_verbose ("Got selection clear for screen %d on display %s\n",
char *str; screen->number, display->name);
meta_error_trap_push (display); meta_display_unmanage_screen (display, display->screen,
str = XGetAtomName (display->xdisplay, event->xselectionclear.time);
event->xselectionclear.selection);
meta_error_trap_pop (display);
meta_verbose ("Selection clear with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
str ? str : "(bad atom)", event->xselectionclear.window);
meta_XFree (str);
}
} }
static gboolean static gboolean
@ -1356,24 +1291,16 @@ handle_other_xevent (MetaDisplay *display,
break; break;
case CreateNotify: case CreateNotify:
{ {
MetaScreen *screen; if (event->xcreatewindow.parent == display->screen->xroot)
meta_stack_tracker_create_event (display->screen->stack_tracker,
screen = meta_display_screen_for_root (display,
event->xcreatewindow.parent);
if (screen)
meta_stack_tracker_create_event (screen->stack_tracker,
&event->xcreatewindow); &event->xcreatewindow);
} }
break; break;
case DestroyNotify: case DestroyNotify:
{ {
MetaScreen *screen; if (event->xdestroywindow.event == display->screen->xroot)
meta_stack_tracker_destroy_event (display->screen->stack_tracker,
screen = meta_display_screen_for_root (display,
event->xdestroywindow.event);
if (screen)
meta_stack_tracker_destroy_event (screen->stack_tracker,
&event->xdestroywindow); &event->xdestroywindow);
} }
if (window) if (window)
@ -1447,8 +1374,7 @@ handle_other_xevent (MetaDisplay *display,
/* NB: override redirect windows wont cause a map request so we /* NB: override redirect windows wont cause a map request so we
* watch out for map notifies against any root windows too if a * watch out for map notifies against any root windows too if a
* compositor is enabled: */ * compositor is enabled: */
if (window == NULL if (window == NULL)
&& meta_display_screen_for_root (display, event->xmap.event))
{ {
window = meta_window_x11_new (display, event->xmap.window, window = meta_window_x11_new (display, event->xmap.window,
FALSE, META_COMP_EFFECT_CREATE); FALSE, META_COMP_EFFECT_CREATE);
@ -1480,24 +1406,16 @@ handle_other_xevent (MetaDisplay *display,
break; break;
case ReparentNotify: case ReparentNotify:
{ {
MetaScreen *screen; if (event->xreparent.event == display->screen->xroot)
meta_stack_tracker_reparent_event (display->screen->stack_tracker,
screen = meta_display_screen_for_root (display,
event->xconfigure.event);
if (screen)
meta_stack_tracker_reparent_event (screen->stack_tracker,
&event->xreparent); &event->xreparent);
} }
break; break;
case ConfigureNotify: case ConfigureNotify:
if (event->xconfigure.event != event->xconfigure.window) if (event->xconfigure.event != event->xconfigure.window)
{ {
MetaScreen *screen; if (event->xconfigure.event == display->screen->xroot)
meta_stack_tracker_configure_event (display->screen->stack_tracker,
screen = meta_display_screen_for_root (display,
event->xconfigure.event);
if (screen)
meta_stack_tracker_configure_event (screen->stack_tracker,
&event->xconfigure); &event->xconfigure);
} }
@ -1551,7 +1469,6 @@ handle_other_xevent (MetaDisplay *display,
case PropertyNotify: case PropertyNotify:
{ {
MetaGroup *group; MetaGroup *group;
MetaScreen *screen;
if (window && !frame_was_receiver) if (window && !frame_was_receiver)
meta_window_x11_property_notify (window, event); meta_window_x11_property_notify (window, event);
@ -1563,24 +1480,18 @@ handle_other_xevent (MetaDisplay *display,
if (group != NULL) if (group != NULL)
meta_group_property_notify (group, event); meta_group_property_notify (group, event);
screen = NULL; if (event->xproperty.window == display->screen->xroot)
if (window == NULL &&
group == NULL) /* window/group != NULL means it wasn't a root window */
screen = meta_display_screen_for_root (display,
event->xproperty.window);
if (screen != NULL)
{ {
if (event->xproperty.atom == if (event->xproperty.atom ==
display->atom__NET_DESKTOP_LAYOUT) display->atom__NET_DESKTOP_LAYOUT)
meta_screen_update_workspace_layout (screen); meta_screen_update_workspace_layout (display->screen);
else if (event->xproperty.atom == else if (event->xproperty.atom ==
display->atom__NET_DESKTOP_NAMES) display->atom__NET_DESKTOP_NAMES)
meta_screen_update_workspace_names (screen); meta_screen_update_workspace_names (display->screen);
else if (meta_is_wayland_compositor () && else if (meta_is_wayland_compositor () &&
event->xproperty.atom == event->xproperty.atom ==
display->atom__XKB_RULES_NAMES) display->atom__XKB_RULES_NAMES)
reload_xkb_rules (screen); reload_xkb_rules (display->screen);
#if 0 #if 0
else if (event->xproperty.atom == else if (event->xproperty.atom ==
display->atom__NET_RESTACK_WINDOW) display->atom__NET_RESTACK_WINDOW)
@ -1629,12 +1540,7 @@ handle_other_xevent (MetaDisplay *display,
} }
else else
{ {
MetaScreen *screen; if (event->xclient.window == display->screen->xroot)
screen = meta_display_screen_for_root (display,
event->xclient.window);
if (screen)
{ {
if (event->xclient.message_type == if (event->xclient.message_type ==
display->atom__NET_CURRENT_DESKTOP) display->atom__NET_CURRENT_DESKTOP)
@ -1650,9 +1556,7 @@ handle_other_xevent (MetaDisplay *display,
"specified timestamp of %u\n", "specified timestamp of %u\n",
space, time); space, time);
workspace = workspace = meta_screen_get_workspace_by_index (display->screen, space);
meta_screen_get_workspace_by_index (screen,
space);
/* Handle clients using the older version of the spec... */ /* Handle clients using the older version of the spec... */
if (time == 0 && workspace) if (time == 0 && workspace)
@ -1693,11 +1597,11 @@ handle_other_xevent (MetaDisplay *display,
showing_desktop ? "show" : "hide"); showing_desktop ? "show" : "hide");
if (showing_desktop) if (showing_desktop)
meta_screen_show_desktop (screen, timestamp); meta_screen_show_desktop (display->screen, timestamp);
else else
{ {
meta_screen_unshow_desktop (screen); meta_screen_unshow_desktop (display->screen);
meta_workspace_focus_default_window (screen->active_workspace, NULL, timestamp); meta_workspace_focus_default_window (display->screen->active_workspace, NULL, timestamp);
} }
} }
else if (event->xclient.message_type == else if (event->xclient.message_type ==
@ -1837,7 +1741,6 @@ meta_display_handle_xevent (MetaDisplay *display,
gboolean bypass_compositor = FALSE, bypass_gtk = FALSE; gboolean bypass_compositor = FALSE, bypass_gtk = FALSE;
XIEvent *input_event; XIEvent *input_event;
MetaMonitorManager *monitor; MetaMonitorManager *monitor;
MetaScreen *screen;
#if 0 #if 0
meta_spew_event (display, event); meta_spew_event (display, event);
@ -1875,10 +1778,9 @@ meta_display_handle_xevent (MetaDisplay *display,
FALSE); FALSE);
} }
screen = meta_display_screen_for_root (display, event->xany.window); if (event->xany.window == display->screen->xroot)
if (screen)
{ {
if (meta_screen_handle_xevent (screen, event)) if (meta_screen_handle_xevent (display->screen, event))
{ {
bypass_gtk = bypass_compositor = TRUE; bypass_gtk = bypass_compositor = TRUE;
goto out; goto out;

View File

@ -685,15 +685,7 @@ ungrab_key_bindings (MetaDisplay *display)
meta_error_trap_push (display); /* for efficiency push outer trap */ meta_error_trap_push (display); /* for efficiency push outer trap */
tmp = display->screens; meta_screen_ungrab_keys (display->screen);
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
meta_screen_ungrab_keys (screen);
tmp = tmp->next;
}
windows = meta_display_list_windows (display, META_LIST_DEFAULT); windows = meta_display_list_windows (display, META_LIST_DEFAULT);
tmp = windows; tmp = windows;
@ -718,15 +710,7 @@ grab_key_bindings (MetaDisplay *display)
meta_error_trap_push (display); /* for efficiency push outer trap */ meta_error_trap_push (display); /* for efficiency push outer trap */
tmp = display->screens; meta_screen_grab_keys (display->screen);
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
meta_screen_grab_keys (screen);
tmp = tmp->next;
}
windows = meta_display_list_windows (display, META_LIST_DEFAULT); windows = meta_display_list_windows (display, META_LIST_DEFAULT);
tmp = windows; tmp = windows;
@ -1298,7 +1282,6 @@ meta_display_grab_accelerator (MetaDisplay *display,
guint keycode = 0; guint keycode = 0;
guint mask = 0; guint mask = 0;
MetaVirtualModifier modifiers = 0; MetaVirtualModifier modifiers = 0;
GSList *l;
if (!meta_ui_parse_accelerator (accelerator, &keysym, &keycode, &modifiers)) if (!meta_ui_parse_accelerator (accelerator, &keysym, &keycode, &modifiers))
{ {
@ -1318,11 +1301,7 @@ meta_display_grab_accelerator (MetaDisplay *display,
if (display_get_keybinding (display, keycode, mask)) if (display_get_keybinding (display, keycode, mask))
return META_KEYBINDING_ACTION_NONE; return META_KEYBINDING_ACTION_NONE;
for (l = display->screens; l; l = l->next) meta_change_keygrab (display, display->screen->xroot, TRUE, keysym, keycode, mask);
{
MetaScreen *screen = l->data;
meta_change_keygrab (display, screen->xroot, TRUE, keysym, keycode, mask);
}
grab = g_new0 (MetaKeyGrab, 1); grab = g_new0 (MetaKeyGrab, 1);
grab->action = next_dynamic_keybinding_action (); grab->action = next_dynamic_keybinding_action ();
@ -1372,16 +1351,11 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
if (binding) if (binding)
{ {
guint32 index_key; guint32 index_key;
GSList *l;
for (l = display->screens; l; l = l->next) meta_change_keygrab (display, display->screen->xroot, FALSE,
{ binding->keysym,
MetaScreen *screen = l->data; binding->keycode,
meta_change_keygrab (display, screen->xroot, FALSE, binding->mask);
binding->keysym,
binding->keycode,
binding->mask);
}
index_key = key_binding_key (binding->keycode, binding->mask); index_key = key_binding_key (binding->keycode, binding->mask);
g_hash_table_remove (display->key_bindings_index, GINT_TO_POINTER (index_key)); g_hash_table_remove (display->key_bindings_index, GINT_TO_POINTER (index_key));
@ -1871,8 +1845,7 @@ meta_display_process_key_event (MetaDisplay *display,
/* window may be NULL */ /* window may be NULL */
/* XXX */ screen = display->screen;
screen = display->active_screen;
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)
@ -2824,7 +2797,6 @@ do_choose_window (MetaDisplay *display,
initial_selection = meta_display_get_tab_next (display, initial_selection = meta_display_get_tab_next (display,
type, type,
screen,
screen->active_workspace, screen->active_workspace,
NULL, NULL,
backward); backward);

View File

@ -900,28 +900,6 @@ meta_screen_manage_all_windows (MetaScreen *screen)
meta_stack_thaw (screen->stack); meta_stack_thaw (screen->stack);
} }
/**
* meta_screen_for_x_screen:
* @xscreen: an X screen structure.
*
* Gets the #MetaScreen corresponding to an X screen structure.
*
* Return value: (transfer none): the #MetaScreen for the X screen
* %NULL if Metacity is not managing the screen.
*/
MetaScreen*
meta_screen_for_x_screen (Screen *xscreen)
{
MetaDisplay *display;
display = meta_display_for_x_display (DisplayOfScreen (xscreen));
if (display == NULL)
return NULL;
return meta_display_screen_for_x_screen (display, xscreen);
}
static void static void
prefs_changed_callback (MetaPreference pref, prefs_changed_callback (MetaPreference pref,
gpointer data) gpointer data)

View File

@ -1248,7 +1248,7 @@ meta_window_wayland_new (MetaDisplay *display,
MetaWaylandSurface *surface) MetaWaylandSurface *surface)
{ {
XWindowAttributes attrs; XWindowAttributes attrs;
MetaScreen *scr = display->screens->data; MetaScreen *scr = display->screen;
MetaWindow *window; MetaWindow *window;
attrs.x = 0; attrs.x = 0;
@ -1280,7 +1280,6 @@ meta_window_wayland_new (MetaDisplay *display,
* X requests (passing a window xid of None) until we thoroughly audit all * X requests (passing a window xid of None) until we thoroughly audit all
* the code to make sure it knows about non X based clients... * the code to make sure it knows about non X based clients...
*/ */
meta_error_trap_push (display); /* Push a trap over all of window meta_error_trap_push (display); /* Push a trap over all of window
* creation, to reduce XSync() calls * creation, to reduce XSync() calls
*/ */

View File

@ -73,12 +73,9 @@ int meta_display_get_xinput_opcode (MetaDisplay *display);
gboolean meta_display_supports_extended_barriers (MetaDisplay *display); gboolean meta_display_supports_extended_barriers (MetaDisplay *display);
Display *meta_display_get_xdisplay (MetaDisplay *display); Display *meta_display_get_xdisplay (MetaDisplay *display);
MetaCompositor *meta_display_get_compositor (MetaDisplay *display); MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
GSList *meta_display_get_screens (MetaDisplay *display);
gboolean meta_display_has_shape (MetaDisplay *display); gboolean meta_display_has_shape (MetaDisplay *display);
MetaScreen *meta_display_screen_for_root (MetaDisplay *display,
Window xroot);
MetaWindow *meta_display_get_focus_window (MetaDisplay *display); MetaWindow *meta_display_get_focus_window (MetaDisplay *display);
gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display, gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
@ -99,19 +96,16 @@ unsigned int meta_display_get_ignored_modifier_mask (MetaDisplay *display);
GList* meta_display_get_tab_list (MetaDisplay *display, GList* meta_display_get_tab_list (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace); MetaWorkspace *workspace);
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);
MetaWindow* meta_display_get_tab_current (MetaDisplay *display, MetaWindow* meta_display_get_tab_current (MetaDisplay *display,
MetaTabList type, MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace); MetaWorkspace *workspace);
gboolean meta_display_begin_grab_op (MetaDisplay *display, gboolean meta_display_begin_grab_op (MetaDisplay *display,

View File

@ -48,8 +48,6 @@ gpointer meta_screen_get_compositor_data (MetaScreen *screen);
void meta_screen_set_compositor_data (MetaScreen *screen, void meta_screen_set_compositor_data (MetaScreen *screen,
gpointer info); gpointer info);
MetaScreen *meta_screen_for_x_screen (Screen *xscreen);
void meta_screen_set_cm_selection (MetaScreen *screen); void meta_screen_set_cm_selection (MetaScreen *screen);
void meta_screen_unset_cm_selection (MetaScreen *screen); void meta_screen_unset_cm_selection (MetaScreen *screen);

View File

@ -1816,7 +1816,7 @@ warn_about_lame_clients_and_finish_interact (gboolean shutdown)
"and will have to be restarted manually next time " "and will have to be restarted manually next time "
"you log in."), "you log in."),
"240", "240",
meta_get_display()->active_screen->screen_name, meta_get_display()->screen->screen_name,
NULL, NULL, NULL, NULL, NULL, NULL,
None, None,
columns, columns,

View File

@ -2227,9 +2227,8 @@ meta_window_x11_new (MetaDisplay *display,
gboolean must_be_viewable, gboolean must_be_viewable,
MetaCompEffect effect) MetaCompEffect effect)
{ {
MetaScreen *screen = display->screen;
XWindowAttributes attrs; XWindowAttributes attrs;
MetaScreen *screen = NULL;
GSList *tmp;
gulong existing_wm_state; gulong existing_wm_state;
MetaWindow *window = NULL; MetaWindow *window = NULL;
gulong event_mask; gulong event_mask;
@ -2259,19 +2258,12 @@ meta_window_x11_new (MetaDisplay *display,
goto error; goto error;
} }
for (tmp = display->screens; tmp != NULL; tmp = tmp->next) if (attrs.root != screen->xroot)
{ {
MetaScreen *scr = tmp->data; meta_verbose ("Not on our screen\n");
goto error;
if (scr->xroot == attrs.root)
{
screen = tmp->data;
break;
}
} }
g_assert (screen);
if (is_our_xwindow (display, screen, xwindow, &attrs)) if (is_our_xwindow (display, screen, xwindow, &attrs))
{ {
meta_verbose ("Not managing our own windows\n"); meta_verbose ("Not managing our own windows\n");