[mutter/wayland] Remove any possibility for zaphod mode
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] Remove any possibility for zaphod mode
- Date: Wed, 26 Mar 2014 21:18:46 +0000 (UTC)
commit d7519f4ebc3202998e3fd0662735b05b32974577
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Oct 3 18:31:09 2013 -0400
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.
src/compositor/compositor.c | 34 +-----
src/core/bell.c | 20 +----
src/core/core.c | 9 +-
src/core/display-private.h | 7 +-
src/core/display.c | 241 ++++++-------------------------------------
src/core/events.c | 186 ++++++++-------------------------
src/core/keybindings.c | 44 ++-------
src/core/screen.c | 22 ----
src/core/window.c | 3 +-
src/meta/display.h | 6 -
src/meta/screen.h | 2 -
src/x11/session.c | 2 +-
src/x11/window-x11.c | 16 +--
13 files changed, 100 insertions(+), 492 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 3881ff9..9f30b7e 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -935,10 +935,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
MetaWindow *window)
{
MetaDisplay *display = compositor->display;
- MetaScreen *screen = display->screens->data;
- MetaCompScreen *info;
-
- info = meta_screen_get_compositor_data (screen);
+ MetaCompScreen *info = meta_screen_get_compositor_data (display->screen);
if (is_modal (display) && is_grabbed_event (compositor->display, event))
{
@@ -1367,18 +1364,8 @@ static gboolean
meta_repaint_func (gpointer data)
{
MetaCompositor *compositor = data;
- GSList *screens = meta_display_get_screens (compositor->display);
- GSList *l;
-
- 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);
- }
+ MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
+ pre_paint_windows (info);
return TRUE;
}
@@ -1387,20 +1374,11 @@ static void
on_shadow_factory_changed (MetaShadowFactory *factory,
MetaCompositor *compositor)
{
- GSList *screens = meta_display_get_screens (compositor->display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
GList *l;
- GSList *sl;
- for (sl = screens; sl; sl = sl->next)
- {
- 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);
- }
+ for (l = info->windows; l; l = l->next)
+ meta_window_actor_invalidate_shadow (l->data);
}
/**
diff --git a/src/core/bell.c b/src/core/bell.c
index 5479142..0b1457b 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -74,26 +74,8 @@ static void
bell_flash_fullscreen (MetaDisplay *display,
XkbAnyEvent *xkb_ev)
{
- XkbBellNotifyEvent *xkb_bell_ev = (XkbBellNotifyEvent *) xkb_ev;
- MetaScreen *screen;
-
g_assert (xkb_ev->xkb_type == XkbBellNotify);
- if (xkb_bell_ev->window != None)
- {
- 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;
- }
- }
+ meta_compositor_flash_screen (display->compositor, display->screen);
}
/**
diff --git a/src/core/core.c b/src/core/core.c
index 0c46a2f..c189756 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -274,7 +274,7 @@ meta_core_lower_beneath_grab_window (Display *xdisplay,
MetaStackWindow stack_sibling;
display = meta_display_for_x_display (xdisplay);
- screen = meta_display_screen_for_xwindow (display, xwindow);
+ screen = display->screen;
grab_window = display->grab_window;
if (grab_window == NULL)
@@ -603,13 +603,10 @@ meta_core_get_workspace_name_with_index (Display *xdisplay,
int index)
{
MetaDisplay *display;
- MetaScreen *screen;
MetaWorkspace *workspace;
display = meta_display_for_x_display (xdisplay);
- screen = meta_display_screen_for_root (display, xroot);
- g_assert (screen != NULL);
- workspace = meta_screen_get_workspace_by_index (screen, index);
+ workspace = meta_screen_get_workspace_by_index (display->screen, index);
return workspace ? meta_workspace_get_name (workspace) : NULL;
}
@@ -630,7 +627,7 @@ meta_core_begin_grab_op (Display *xdisplay,
MetaScreen *screen;
display = meta_display_for_x_display (xdisplay);
- screen = meta_display_screen_for_xwindow (display, frame_xwindow);
+ screen = display->screen;
g_assert (screen != NULL);
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 8859401..1a78402 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -148,8 +148,7 @@ struct _MetaDisplay
/*< private-ish >*/
guint error_trap_synced_at_last_pop : 1;
- GSList *screens;
- MetaScreen *active_screen;
+ MetaScreen *screen;
GHashTable *xids;
GHashTable *wayland_windows;
int error_traps;
@@ -351,10 +350,6 @@ struct _MetaDisplayClass
gboolean meta_display_open (void);
void meta_display_close (MetaDisplay *display,
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_ungrab (MetaDisplay *display);
diff --git a/src/core/display.c b/src/core/display.c
index c63f2ce..372bb1e 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -362,8 +362,6 @@ sn_error_trap_pop (SnDisplay *sn_display,
static void
enable_compositor (MetaDisplay *display)
{
- GSList *list;
-
if (!META_DISPLAY_HAS_COMPOSITE (display) ||
!META_DISPLAY_HAS_DAMAGE (display) ||
!META_DISPLAY_HAS_RENDER (display))
@@ -379,14 +377,8 @@ enable_compositor (MetaDisplay *display)
if (!display->compositor)
return;
-
- for (list = display->screens; list != NULL; list = list->next)
- {
- MetaScreen *screen = list->data;
-
- meta_compositor_manage_screen (screen->display->compositor,
- screen);
- }
+
+ meta_compositor_manage_screen (display->compositor, display->screen);
}
static void
@@ -440,7 +432,6 @@ gboolean
meta_display_open (void)
{
Display *xdisplay;
- GSList *screens;
MetaScreen *screen;
int i;
guint32 timestamp;
@@ -536,8 +527,7 @@ meta_display_open (void)
the_display->window_with_menu = NULL;
the_display->window_menu = NULL;
- the_display->screens = NULL;
- the_display->active_screen = NULL;
+ the_display->screen = NULL;
#ifdef HAVE_STARTUP_NOTIFICATION
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_user_time = timestamp;
the_display->compositor = NULL;
-
+
/* 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
- * environment variable. The screens GSList is left for simplicity.
+ * environment variable.
*/
- screens = NULL;
-
i = meta_ui_get_screen_number ();
-
screen = meta_screen_new (the_display, i, timestamp);
if (!screen)
@@ -861,9 +848,7 @@ meta_display_open (void)
return FALSE;
}
- screens = g_slist_prepend (screens, screen);
-
- the_display->screens = screens;
+ the_display->screen = screen;
enable_compositor (the_display);
@@ -895,7 +880,7 @@ meta_display_open (void)
if (focus == None || focus == PointerRoot)
/* Just focus the no_focus_window on the first screen */
meta_display_focus_the_no_focus_window (the_display,
- the_display->screens->data,
+ the_display->screen,
timestamp);
else
{
@@ -906,7 +891,7 @@ meta_display_open (void)
else
/* Just focus the no_focus_window on the first screen */
meta_display_focus_the_no_focus_window (the_display,
- the_display->screens->data,
+ the_display->screen,
timestamp);
}
@@ -948,8 +933,8 @@ meta_display_list_windows (MetaDisplay *display,
MetaListWindowsFlags flags)
{
GSList *winlist;
- GSList *tmp;
GSList *prev;
+ GSList *tmp;
GHashTableIter iter;
gpointer key, value;
@@ -1024,8 +1009,6 @@ void
meta_display_close (MetaDisplay *display,
guint32 timestamp)
{
- GSList *tmp;
-
g_assert (display != NULL);
if (display->closing != 0)
@@ -1053,17 +1036,7 @@ meta_display_close (MetaDisplay *display,
/* Stop caring about events */
meta_display_free_events (display);
- /* Free all screens */
- 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;
+ meta_screen_free (display->screen, timestamp);
#ifdef HAVE_STARTUP_NOTIFICATION
if (display->sn_display)
@@ -1099,77 +1072,6 @@ meta_display_close (MetaDisplay *display,
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.
* 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
@@ -1775,7 +1677,6 @@ request_xserver_input_focus_change (MetaDisplay *display,
meta_error_trap_pop (display);
display->last_focus_time = timestamp;
- display->active_screen = screen;
if (meta_window == NULL || meta_window != display->autoraise_window)
meta_display_remove_autoraise_callback (display);
@@ -1877,18 +1778,7 @@ 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;
+ return xwindow == display->screen->no_focus_window;
}
static MetaCursor
@@ -2517,30 +2407,19 @@ meta_display_increment_event_serial (MetaDisplay *display)
void
meta_display_update_active_window_hint (MetaDisplay *display)
{
- GSList *tmp;
-
gulong data[1];
if (display->focus_window)
data[0] = display->focus_window->xwindow;
else
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);
-
- tmp = tmp->next;
- }
+ meta_error_trap_push (display);
+ XChangeProperty (display->xdisplay, display->screen->xroot,
+ display->atom__NET_ACTIVE_WINDOW,
+ XA_WINDOW,
+ 32, PropModeReplace, (guchar*) data, 1);
+ meta_error_trap_pop (display);
}
void
@@ -2578,22 +2457,12 @@ void
meta_display_set_cursor_theme (const char *theme,
int size)
{
- GSList *tmp;
-
MetaDisplay *display = meta_get_display ();
XcursorSetTheme (display->xdisplay, theme);
XcursorSetDefaultSize (display->xdisplay, size);
- tmp = display->screens;
- while (tmp != NULL)
- {
- MetaScreen *screen = tmp->data;
-
- meta_screen_update_cursor (screen);
-
- tmp = tmp->next;
- }
+ meta_screen_update_cursor (display->screen);
}
/*
@@ -2808,7 +2677,6 @@ get_focused_group (MetaDisplay *display)
static MetaWindow*
find_tab_forward (MetaDisplay *display,
MetaTabList type,
- MetaScreen *screen,
MetaWorkspace *workspace,
GList *start,
gboolean skip_first)
@@ -2826,8 +2694,7 @@ find_tab_forward (MetaDisplay *display,
{
MetaWindow *window = tmp->data;
- if (window->screen == screen &&
- IN_TAB_CHAIN (window, type))
+ if (IN_TAB_CHAIN (window, type))
return window;
tmp = tmp->next;
@@ -2850,7 +2717,6 @@ find_tab_forward (MetaDisplay *display,
static MetaWindow*
find_tab_backward (MetaDisplay *display,
MetaTabList type,
- MetaScreen *screen,
MetaWorkspace *workspace,
GList *start,
gboolean skip_last)
@@ -2867,8 +2733,7 @@ find_tab_backward (MetaDisplay *display,
{
MetaWindow *window = tmp->data;
- if (window->screen == screen &&
- IN_TAB_CHAIN (window, type))
+ if (IN_TAB_CHAIN (window, type))
return window;
tmp = tmp->prev;
@@ -2909,21 +2774,19 @@ mru_cmp (gconstpointer a,
* meta_display_get_tab_list:
* @display: a #MetaDisplay
* @type: type of tab list
- * @screen: a #MetaScreen
* @workspace: (allow-none): origin workspace
*
* Determine the list of windows that should be displayed for Alt-TAB
* functionality. The windows are returned in most recently used order.
* If @workspace is not %NULL, the list only conains windows that are on
* @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
*/
GList*
meta_display_get_tab_list (MetaDisplay *display,
MetaTabList type,
- MetaScreen *screen,
MetaWorkspace *workspace)
{
GList *tab_list = NULL;
@@ -2948,8 +2811,7 @@ meta_display_get_tab_list (MetaDisplay *display,
{
MetaWindow *window = tmp->data;
- if (window->screen == screen &&
- IN_TAB_CHAIN (window, type))
+ if (IN_TAB_CHAIN (window, type))
tab_list = g_list_prepend (tab_list, window);
}
@@ -2979,7 +2841,6 @@ meta_display_get_tab_list (MetaDisplay *display,
* meta_display_get_tab_next:
* @display: a #MetaDisplay
* @type: type of tab list
- * @screen: a #MetaScreen
* @workspace: origin workspace
* @window: (allow-none): starting window
* @backward: If %TRUE, look for the previous window.
@@ -2993,7 +2854,6 @@ 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)
@@ -3001,10 +2861,7 @@ meta_display_get_tab_next (MetaDisplay *display,
gboolean skip;
GList *tab_list;
MetaWindow *ret;
- tab_list = meta_display_get_tab_list(display,
- type,
- screen,
- workspace);
+ tab_list = meta_display_get_tab_list (display, type, workspace);
if (tab_list == NULL)
return NULL;
@@ -3014,26 +2871,18 @@ meta_display_get_tab_next (MetaDisplay *display,
g_assert (window->display == display);
if (backward)
- ret = find_tab_backward (display, type, screen, workspace,
- g_list_find (tab_list,
- window),
- TRUE);
+ ret = find_tab_backward (display, type, workspace, g_list_find (tab_list, window), TRUE);
else
- ret = find_tab_forward (display, type, screen, workspace,
- g_list_find (tab_list,
- window),
- TRUE);
+ ret = find_tab_forward (display, type, workspace, g_list_find (tab_list, window), TRUE);
}
else
{
skip = display->focus_window != NULL &&
tab_list->data == display->focus_window;
if (backward)
- ret = find_tab_backward (display, type, screen, workspace,
- tab_list, skip);
+ ret = find_tab_backward (display, type, workspace, tab_list, skip);
else
- ret = find_tab_forward (display, type, screen, workspace,
- tab_list, skip);
+ ret = find_tab_forward (display, type, workspace, tab_list, skip);
}
g_list_free (tab_list);
@@ -3044,7 +2893,6 @@ meta_display_get_tab_next (MetaDisplay *display,
* meta_display_get_tab_current:
* @display: a #MetaDisplay
* @type: type of tab list
- * @screen: a #MetaScreen
* @workspace: origin workspace
*
* Determine the active window that should be displayed for Alt-TAB.
@@ -3055,7 +2903,6 @@ meta_display_get_tab_next (MetaDisplay *display,
MetaWindow*
meta_display_get_tab_current (MetaDisplay *display,
MetaTabList type,
- MetaScreen *screen,
MetaWorkspace *workspace)
{
MetaWindow *window;
@@ -3063,7 +2910,6 @@ meta_display_get_tab_current (MetaDisplay *display,
window = display->focus_window;
if (window != NULL &&
- window->screen == screen &&
IN_TAB_CHAIN (window, type) &&
(workspace == NULL ||
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",
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_display_close (display, timestamp);
+ meta_screen_free (screen, timestamp);
+ meta_display_close (display, timestamp);
}
void
@@ -3178,15 +3019,7 @@ meta_display_stack_cmp (const void *a,
MetaWindow *aw = (void*) a;
MetaWindow *bw = (void*) b;
- if (aw->screen == bw->screen)
- 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 */
+ return meta_stack_windows_cmp (aw->screen->stack, aw, bw);
}
/**
@@ -3322,7 +3155,7 @@ meta_display_increment_focus_sentinel (MetaDisplay *display)
data[0] = meta_display_get_current_time (display);
XChangeProperty (display->xdisplay,
- ((MetaScreen*) display->screens->data)->xroot,
+ display->screen->xroot,
display->atom__MUTTER_SENTINEL,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
@@ -3526,18 +3359,6 @@ meta_display_get_compositor (MetaDisplay *display)
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
meta_display_has_shape (MetaDisplay *display)
{
diff --git a/src/core/events.c b/src/core/events.c
index 3425036..137c605 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -666,10 +666,10 @@ G_GNUC_UNUSED static void
meta_spew_event (MetaDisplay *display,
XEvent *event)
{
+ MetaScreen *screen = display->screen;
const char *name = NULL;
char *extra = NULL;
char *winname;
- MetaScreen *screen;
XIEvent *input_event;
/* filter overnumerous events */
@@ -693,9 +693,7 @@ meta_spew_event (MetaDisplay *display,
else
meta_spew_core_event (display, event, &name, &extra);
- screen = meta_display_screen_for_root (display, event->xany.window);
-
- if (screen)
+ if (event->xany.window == screen->xroot)
winname = g_strdup_printf ("root %d", screen->number);
else
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))
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";
else
window_type = "unknown window";
@@ -855,7 +853,7 @@ handle_input_xevent (MetaDisplay *display,
XIEnterEvent *enter_event = (XIEnterEvent *) input_event;
Window modified;
MetaWindow *window;
- MetaScreen *screen;
+ MetaScreen *screen = display->screen;
if (input_event == NULL)
return FALSE;
@@ -869,20 +867,6 @@ handle_input_xevent (MetaDisplay *display,
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
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
* avoid races.
*/
@@ -923,8 +907,6 @@ handle_input_xevent (MetaDisplay *display,
if (enter_event->root != enter_event->event)
break;
- screen = meta_display_screen_for_root (display, enter_event->root);
-
if (enter_event->evtype == XI_FocusIn &&
enter_event->mode == XINotifyDetailNone)
{
@@ -1013,21 +995,9 @@ process_request_frame_extents (MetaDisplay *display,
if ((hints_set && hints->decorations) || !hints_set)
{
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. */
- meta_ui_theme_get_frame_borders (screen->ui,
+ meta_ui_theme_get_frame_borders (display->screen->ui,
META_FRAME_TYPE_NORMAL,
0,
&borders);
@@ -1052,28 +1022,6 @@ process_request_frame_extents (MetaDisplay *display,
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 */
static gboolean
convert_property (MetaDisplay *display,
@@ -1128,14 +1076,11 @@ static void
process_selection_request (MetaDisplay *display,
XEvent *event)
{
+ MetaScreen *screen = display->screen;
XSelectionEvent reply;
- MetaScreen *screen;
-
- screen = find_screen_for_selection (display,
- event->xselectionrequest.owner,
- event->xselectionrequest.selection);
- if (screen == NULL)
+ if (screen->wm_sn_selection_window != event->xselectionrequest.owner ||
+ screen->wm_sn_atom != event->xselectionrequest.selection)
{
char *str;
@@ -1231,41 +1176,31 @@ static void
process_selection_clear (MetaDisplay *display,
XEvent *event)
{
- /* We need to unmanage the screen on which we lost the selection */
- MetaScreen *screen;
-
- screen = find_screen_for_selection (display,
- event->xselectionclear.window,
- event->xselectionclear.selection);
+ MetaScreen *screen = display->screen;
-
- if (screen != NULL)
+ if (screen->wm_sn_selection_window != event->xselectionclear.window ||
+ screen->wm_sn_atom != event->xselectionclear.selection)
{
- meta_verbose ("Got selection clear for screen %d on display %s\n",
- screen->number, display->name);
+ char *str;
- meta_display_unmanage_screen (display,
- screen,
- event->xselectionclear.time);
+ meta_error_trap_push (display);
+ str = XGetAtomName (display->xdisplay,
+ 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;
}
- {
- char *str;
+ meta_verbose ("Got selection clear for screen %d on display %s\n",
+ screen->number, display->name);
- meta_error_trap_push (display);
- str = XGetAtomName (display->xdisplay,
- 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);
- }
+ meta_display_unmanage_screen (display, display->screen,
+ event->xselectionclear.time);
}
static gboolean
@@ -1356,24 +1291,16 @@ handle_other_xevent (MetaDisplay *display,
break;
case CreateNotify:
{
- MetaScreen *screen;
-
- screen = meta_display_screen_for_root (display,
- event->xcreatewindow.parent);
- if (screen)
- meta_stack_tracker_create_event (screen->stack_tracker,
+ if (event->xcreatewindow.parent == display->screen->xroot)
+ meta_stack_tracker_create_event (display->screen->stack_tracker,
&event->xcreatewindow);
}
break;
case DestroyNotify:
{
- MetaScreen *screen;
-
- screen = meta_display_screen_for_root (display,
- event->xdestroywindow.event);
- if (screen)
- meta_stack_tracker_destroy_event (screen->stack_tracker,
+ if (event->xdestroywindow.event == display->screen->xroot)
+ meta_stack_tracker_destroy_event (display->screen->stack_tracker,
&event->xdestroywindow);
}
if (window)
@@ -1447,8 +1374,7 @@ handle_other_xevent (MetaDisplay *display,
/* NB: override redirect windows wont cause a map request so we
* watch out for map notifies against any root windows too if a
* compositor is enabled: */
- if (window == NULL
- && meta_display_screen_for_root (display, event->xmap.event))
+ if (window == NULL)
{
window = meta_window_x11_new (display, event->xmap.window,
FALSE, META_COMP_EFFECT_CREATE);
@@ -1480,24 +1406,16 @@ handle_other_xevent (MetaDisplay *display,
break;
case ReparentNotify:
{
- MetaScreen *screen;
-
- screen = meta_display_screen_for_root (display,
- event->xconfigure.event);
- if (screen)
- meta_stack_tracker_reparent_event (screen->stack_tracker,
+ if (event->xreparent.event == display->screen->xroot)
+ meta_stack_tracker_reparent_event (display->screen->stack_tracker,
&event->xreparent);
}
break;
case ConfigureNotify:
if (event->xconfigure.event != event->xconfigure.window)
{
- MetaScreen *screen;
-
- screen = meta_display_screen_for_root (display,
- event->xconfigure.event);
- if (screen)
- meta_stack_tracker_configure_event (screen->stack_tracker,
+ if (event->xconfigure.event == display->screen->xroot)
+ meta_stack_tracker_configure_event (display->screen->stack_tracker,
&event->xconfigure);
}
@@ -1551,7 +1469,6 @@ handle_other_xevent (MetaDisplay *display,
case PropertyNotify:
{
MetaGroup *group;
- MetaScreen *screen;
if (window && !frame_was_receiver)
meta_window_x11_property_notify (window, event);
@@ -1563,24 +1480,18 @@ handle_other_xevent (MetaDisplay *display,
if (group != NULL)
meta_group_property_notify (group, event);
- screen = NULL;
- 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.window == display->screen->xroot)
{
if (event->xproperty.atom ==
display->atom__NET_DESKTOP_LAYOUT)
- meta_screen_update_workspace_layout (screen);
+ meta_screen_update_workspace_layout (display->screen);
else if (event->xproperty.atom ==
display->atom__NET_DESKTOP_NAMES)
- meta_screen_update_workspace_names (screen);
+ meta_screen_update_workspace_names (display->screen);
else if (meta_is_wayland_compositor () &&
event->xproperty.atom ==
display->atom__XKB_RULES_NAMES)
- reload_xkb_rules (screen);
+ reload_xkb_rules (display->screen);
#if 0
else if (event->xproperty.atom ==
display->atom__NET_RESTACK_WINDOW)
@@ -1629,12 +1540,7 @@ handle_other_xevent (MetaDisplay *display,
}
else
{
- MetaScreen *screen;
-
- screen = meta_display_screen_for_root (display,
- event->xclient.window);
-
- if (screen)
+ if (event->xclient.window == display->screen->xroot)
{
if (event->xclient.message_type ==
display->atom__NET_CURRENT_DESKTOP)
@@ -1650,9 +1556,7 @@ handle_other_xevent (MetaDisplay *display,
"specified timestamp of %u\n",
space, time);
- workspace =
- meta_screen_get_workspace_by_index (screen,
- space);
+ workspace = meta_screen_get_workspace_by_index (display->screen, space);
/* Handle clients using the older version of the spec... */
if (time == 0 && workspace)
@@ -1693,11 +1597,11 @@ handle_other_xevent (MetaDisplay *display,
showing_desktop ? "show" : "hide");
if (showing_desktop)
- meta_screen_show_desktop (screen, timestamp);
+ meta_screen_show_desktop (display->screen, timestamp);
else
{
- meta_screen_unshow_desktop (screen);
- meta_workspace_focus_default_window (screen->active_workspace, NULL, timestamp);
+ meta_screen_unshow_desktop (display->screen);
+ meta_workspace_focus_default_window (display->screen->active_workspace, NULL,
timestamp);
}
}
else if (event->xclient.message_type ==
@@ -1837,7 +1741,6 @@ meta_display_handle_xevent (MetaDisplay *display,
gboolean bypass_compositor = FALSE, bypass_gtk = FALSE;
XIEvent *input_event;
MetaMonitorManager *monitor;
- MetaScreen *screen;
#if 0
meta_spew_event (display, event);
@@ -1875,10 +1778,9 @@ meta_display_handle_xevent (MetaDisplay *display,
FALSE);
}
- screen = meta_display_screen_for_root (display, event->xany.window);
- if (screen)
+ if (event->xany.window == display->screen->xroot)
{
- if (meta_screen_handle_xevent (screen, event))
+ if (meta_screen_handle_xevent (display->screen, event))
{
bypass_gtk = bypass_compositor = TRUE;
goto out;
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index a574f6c..32c1eca 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -685,15 +685,7 @@ ungrab_key_bindings (MetaDisplay *display)
meta_error_trap_push (display); /* for efficiency push outer trap */
- tmp = display->screens;
- while (tmp != NULL)
- {
- MetaScreen *screen = tmp->data;
-
- meta_screen_ungrab_keys (screen);
-
- tmp = tmp->next;
- }
+ meta_screen_ungrab_keys (display->screen);
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
tmp = windows;
@@ -718,15 +710,7 @@ grab_key_bindings (MetaDisplay *display)
meta_error_trap_push (display); /* for efficiency push outer trap */
- tmp = display->screens;
- while (tmp != NULL)
- {
- MetaScreen *screen = tmp->data;
-
- meta_screen_grab_keys (screen);
-
- tmp = tmp->next;
- }
+ meta_screen_grab_keys (display->screen);
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
tmp = windows;
@@ -1298,7 +1282,6 @@ meta_display_grab_accelerator (MetaDisplay *display,
guint keycode = 0;
guint mask = 0;
MetaVirtualModifier modifiers = 0;
- GSList *l;
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))
return META_KEYBINDING_ACTION_NONE;
- for (l = display->screens; l; l = l->next)
- {
- MetaScreen *screen = l->data;
- meta_change_keygrab (display, screen->xroot, TRUE, keysym, keycode, mask);
- }
+ meta_change_keygrab (display, display->screen->xroot, TRUE, keysym, keycode, mask);
grab = g_new0 (MetaKeyGrab, 1);
grab->action = next_dynamic_keybinding_action ();
@@ -1372,16 +1351,11 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
if (binding)
{
guint32 index_key;
- GSList *l;
- for (l = display->screens; l; l = l->next)
- {
- MetaScreen *screen = l->data;
- meta_change_keygrab (display, screen->xroot, FALSE,
- binding->keysym,
- binding->keycode,
- binding->mask);
- }
+ meta_change_keygrab (display, display->screen->xroot, FALSE,
+ binding->keysym,
+ 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));
@@ -1871,8 +1845,7 @@ meta_display_process_key_event (MetaDisplay *display,
/* window may be NULL */
- /* XXX */
- screen = display->active_screen;
+ screen = display->screen;
all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed;
if (!all_keys_grabbed)
@@ -2824,7 +2797,6 @@ do_choose_window (MetaDisplay *display,
initial_selection = meta_display_get_tab_next (display,
type,
- screen,
screen->active_workspace,
NULL,
backward);
diff --git a/src/core/screen.c b/src/core/screen.c
index 5538aee..36290dc 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -900,28 +900,6 @@ meta_screen_manage_all_windows (MetaScreen *screen)
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
prefs_changed_callback (MetaPreference pref,
gpointer data)
diff --git a/src/core/window.c b/src/core/window.c
index eb2ed9d..c70993c 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1248,7 +1248,7 @@ meta_window_wayland_new (MetaDisplay *display,
MetaWaylandSurface *surface)
{
XWindowAttributes attrs;
- MetaScreen *scr = display->screens->data;
+ MetaScreen *scr = display->screen;
MetaWindow *window;
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
* the code to make sure it knows about non X based clients...
*/
-
meta_error_trap_push (display); /* Push a trap over all of window
* creation, to reduce XSync() calls
*/
diff --git a/src/meta/display.h b/src/meta/display.h
index c13f151..8d1e669 100644
--- a/src/meta/display.h
+++ b/src/meta/display.h
@@ -73,12 +73,9 @@ int meta_display_get_xinput_opcode (MetaDisplay *display);
gboolean meta_display_supports_extended_barriers (MetaDisplay *display);
Display *meta_display_get_xdisplay (MetaDisplay *display);
MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
-GSList *meta_display_get_screens (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);
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,
MetaTabList type,
- MetaScreen *screen,
MetaWorkspace *workspace);
MetaWindow* meta_display_get_tab_next (MetaDisplay *display,
MetaTabList type,
- MetaScreen *screen,
MetaWorkspace *workspace,
MetaWindow *window,
gboolean backward);
MetaWindow* meta_display_get_tab_current (MetaDisplay *display,
MetaTabList type,
- MetaScreen *screen,
MetaWorkspace *workspace);
gboolean meta_display_begin_grab_op (MetaDisplay *display,
diff --git a/src/meta/screen.h b/src/meta/screen.h
index 6e0cde7..8c65246 100644
--- a/src/meta/screen.h
+++ b/src/meta/screen.h
@@ -48,8 +48,6 @@ gpointer meta_screen_get_compositor_data (MetaScreen *screen);
void meta_screen_set_compositor_data (MetaScreen *screen,
gpointer info);
-MetaScreen *meta_screen_for_x_screen (Screen *xscreen);
-
void meta_screen_set_cm_selection (MetaScreen *screen);
void meta_screen_unset_cm_selection (MetaScreen *screen);
diff --git a/src/x11/session.c b/src/x11/session.c
index 269d4d0..48678ab 100644
--- a/src/x11/session.c
+++ b/src/x11/session.c
@@ -1816,7 +1816,7 @@ warn_about_lame_clients_and_finish_interact (gboolean shutdown)
"and will have to be restarted manually next time "
"you log in."),
"240",
- meta_get_display()->active_screen->screen_name,
+ meta_get_display()->screen->screen_name,
NULL, NULL, NULL,
None,
columns,
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index b5e7d6e..8960032 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -2227,9 +2227,8 @@ meta_window_x11_new (MetaDisplay *display,
gboolean must_be_viewable,
MetaCompEffect effect)
{
+ MetaScreen *screen = display->screen;
XWindowAttributes attrs;
- MetaScreen *screen = NULL;
- GSList *tmp;
gulong existing_wm_state;
MetaWindow *window = NULL;
gulong event_mask;
@@ -2259,19 +2258,12 @@ meta_window_x11_new (MetaDisplay *display,
goto error;
}
- for (tmp = display->screens; tmp != NULL; tmp = tmp->next)
+ if (attrs.root != screen->xroot)
{
- MetaScreen *scr = tmp->data;
-
- if (scr->xroot == attrs.root)
- {
- screen = tmp->data;
- break;
- }
+ meta_verbose ("Not on our screen\n");
+ goto error;
}
- g_assert (screen);
-
if (is_our_xwindow (display, screen, xwindow, &attrs))
{
meta_verbose ("Not managing our own windows\n");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]