diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2017-01-08 02:39:10 +0200 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2017-01-08 02:39:10 +0200 |
commit | 171f4dbc1cde5980e46abff66a5427dc943897f5 (patch) | |
tree | 01ebfc2a039c40ca78204a7e171b44338853e362 | |
parent | dcef5ec3650b94ac347cf9d1506bdac18a19b992 (diff) | |
download | metacity-171f4dbc1cde5980e46abff66a5427dc943897f5.tar.gz |
display: replace active_screen and screens with screen
-rw-r--r-- | src/core/bell.c | 10 | ||||
-rw-r--r-- | src/core/display-private.h | 3 | ||||
-rw-r--r-- | src/core/display.c | 177 | ||||
-rw-r--r-- | src/core/keybindings.c | 18 | ||||
-rw-r--r-- | src/core/session.c | 2 | ||||
-rw-r--r-- | src/core/window.c | 19 |
6 files changed, 44 insertions, 185 deletions
diff --git a/src/core/bell.c b/src/core/bell.c index 3203331a..5db805c5 100644 --- a/src/core/bell.c +++ b/src/core/bell.c @@ -158,17 +158,11 @@ bell_flash_fullscreen (MetaDisplay *display, { screen = meta_display_screen_for_xwindow (display, xkb_bell_ev->window); if (screen) - bell_flash_screen (display, screen); + bell_flash_screen (display, screen); } else { - GSList *screen_list = display->screens; - while (screen_list) - { - screen = (MetaScreen *) screen_list->data; - bell_flash_screen (display, screen); - screen_list = screen_list->next; - } + bell_flash_screen (display, display->screen); } } diff --git a/src/core/display-private.h b/src/core/display-private.h index 50ead9b6..08d0211a 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -130,8 +130,7 @@ struct _MetaDisplay /*< private-ish >*/ guint error_trap_synced_at_last_pop : 1; MetaEventQueue *events; - GSList *screens; - MetaScreen *active_screen; + MetaScreen *screen; GHashTable *window_ids; int error_traps; int (* error_trap_handler) (Display *display, diff --git a/src/core/display.c b/src/core/display.c index 2bd702ae..43e91bb1 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -247,41 +247,25 @@ static void enable_compositor (MetaDisplay *display, gboolean composite_windows) { - GSList *list; - if (!display->compositor) display->compositor = meta_compositor_new (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); - if (composite_windows) - meta_screen_composite_all_windows (screen); - } + if (composite_windows) + meta_screen_composite_all_windows (display->screen); } static void disable_compositor (MetaDisplay *display) { - GSList *list; - if (!display->compositor) return; - for (list = display->screens; list != NULL; list = list->next) - { - MetaScreen *screen = list->data; - - meta_compositor_unmanage_screen (screen->display->compositor, - screen); - } + meta_compositor_unmanage_screen (display->compositor, display->screen); meta_compositor_destroy (display->compositor); display->compositor = NULL; @@ -301,8 +285,6 @@ gboolean meta_display_open (void) { Display *xdisplay; - GSList *screens; - GSList *tmp; int i; guint32 timestamp; MetaScreen *screen; @@ -398,8 +380,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, @@ -665,20 +646,14 @@ meta_display_open (void) the_display->last_user_time = timestamp; the_display->compositor = NULL; - screens = NULL; - i = XDefaultScreen (the_display->xdisplay); screen = meta_screen_new (the_display, i, timestamp); + the_display->screen = screen; - if (screen) - screens = g_slist_prepend (screens, screen); - - the_display->screens = screens; - - if (screens == NULL) + if (screen == NULL) { - /* This would typically happen because all the screens already - * have window managers. + /* This would typically happen because the screen already + * have window manager. */ meta_display_close (the_display, timestamp); return FALSE; @@ -693,15 +668,7 @@ meta_display_open (void) meta_display_grab (the_display); /* Now manage all existing windows */ - tmp = the_display->screens; - while (tmp != NULL) - { - screen = tmp->data; - - meta_screen_manage_all_windows (screen); - - tmp = tmp->next; - } + meta_screen_manage_all_windows (the_display->screen); { Window focus; @@ -723,7 +690,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 { @@ -734,7 +701,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); } @@ -824,8 +791,6 @@ void meta_display_close (MetaDisplay *display, guint32 timestamp) { - GSList *tmp; - g_assert (display != NULL); if (display->closing != 0) @@ -851,18 +816,12 @@ meta_display_close (MetaDisplay *display, event_callback, display); - /* Free all screens */ - tmp = display->screens; - while (tmp != NULL) + if (display->screen != NULL) { - MetaScreen *screen = tmp->data; - meta_screen_free (screen, timestamp); - tmp = tmp->next; + meta_screen_free (display->screen, timestamp); + display->screen = NULL; } - g_slist_free (display->screens); - display->screens = NULL; - #ifdef HAVE_STARTUP_NOTIFICATION if (display->sn_display) { @@ -901,18 +860,8 @@ 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; - } + if (display->screen->xroot == xroot) + return display->screen; return NULL; } @@ -943,18 +892,8 @@ 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; - } + if (display->screen->xscreen == xscreen) + return display->screen; return NULL; } @@ -1909,7 +1848,7 @@ event_callback (XEvent *event, MetaScreen *new_screen = meta_display_screen_for_root (display, event->xcrossing.root); - if (new_screen != NULL && display->active_screen != new_screen) + if (new_screen != NULL) meta_workspace_focus_default_window (new_screen->active_workspace, NULL, event->xcrossing.time); @@ -3164,18 +3103,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 display->screen->no_focus_window == xwindow; } Cursor @@ -4087,8 +4015,6 @@ 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) @@ -4096,21 +4022,12 @@ meta_display_update_active_window_hint (MetaDisplay *display) 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); + meta_error_trap_push (display); + XChangeProperty (display->xdisplay, display->screen->xroot, + display->atom__NET_ACTIVE_WINDOW, XA_WINDOW, + 32, PropModeReplace, (guchar*) data, 1); - tmp = tmp->next; - } + meta_error_trap_pop (display); } void @@ -4152,23 +4069,12 @@ meta_display_set_cursor_theme (const char *theme, int size) { #ifdef HAVE_XCURSOR - 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); #endif } @@ -4798,19 +4704,9 @@ 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; - } + if (display->screen->wm_sn_selection_window == owner && + display->screen->wm_sn_atom == selection) + return display->screen; return NULL; } @@ -5017,13 +4913,12 @@ 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); + g_return_if_fail (display->screen != NULL); meta_screen_free (screen, timestamp); - display->screens = g_slist_remove (display->screens, screen); + display->screen = NULL; - if (display->screens == NULL) - meta_display_close (display, timestamp); + meta_display_close (display, timestamp); } void @@ -5218,7 +5113,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__METACITY_SENTINEL, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); @@ -5356,7 +5251,6 @@ meta_display_set_input_focus_window (MetaDisplay *display, display->expected_focus_window = window; display->last_focus_time = timestamp; - display->active_screen = window->screen; if (window != display->autoraise_window) meta_display_remove_autoraise_callback (window->display); @@ -5376,7 +5270,6 @@ meta_display_focus_the_no_focus_window (MetaDisplay *display, timestamp); display->expected_focus_window = NULL; display->last_focus_time = timestamp; - display->active_screen = screen; meta_display_remove_autoraise_callback (display); } @@ -5407,7 +5300,7 @@ meta_display_get_compositor (MetaDisplay *display) MetaScreen * meta_display_get_screen (MetaDisplay *display) { - return display->screens->data; + return display->screen; } gboolean diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 4aba1ecb..acfbf6fb 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -464,16 +464,8 @@ regrab_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); - meta_screen_grab_keys (screen); - - tmp = tmp->next; - } + meta_screen_ungrab_keys (display->screen); + meta_screen_grab_keys (display->screen); windows = meta_display_list_windows (display); tmp = windows; @@ -1151,15 +1143,11 @@ primary_modifier_still_pressed (MetaDisplay *display, int x, y, root_x, root_y; Window root, child; guint mask; - MetaScreen *random_screen; - Window random_xwindow; primary_modifier = get_primary_modifier (display, entire_binding_mask); - random_screen = display->screens->data; - random_xwindow = random_screen->no_focus_window; XQueryPointer (display->xdisplay, - random_xwindow, /* some random window */ + display->screen->no_focus_window, /* some random window */ &root, &child, &root_x, &root_y, &x, &y, diff --git a/src/core/session.c b/src/core/session.c index 13d64245..0afa3420 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -1813,7 +1813,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, None, columns, diff --git a/src/core/window.c b/src/core/window.c index fd24faad..15b36c37 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -246,7 +246,6 @@ meta_window_new_with_attrs (MetaDisplay *display, XWindowAttributes *attrs) { MetaWindow *window; - GSList *tmp; MetaWorkspace *space; gulong existing_wm_state; gulong event_mask; @@ -254,6 +253,7 @@ meta_window_new_with_attrs (MetaDisplay *display, gboolean has_shape; g_assert (attrs != NULL); + g_assert (display->screen->xroot == attrs->root); meta_verbose ("Attempting to manage 0x%lx\n", xwindow); @@ -391,22 +391,7 @@ meta_window_new_with_attrs (MetaDisplay *display, window->sync_request_time.tv_sec = 0; window->sync_request_time.tv_usec = 0; - window->screen = NULL; - tmp = display->screens; - while (tmp != NULL) - { - MetaScreen *scr = tmp->data; - - if (scr->xroot == attrs->root) - { - window->screen = tmp->data; - break; - } - - tmp = tmp->next; - } - - g_assert (window->screen); + window->screen = display->screen; window->desc = g_strdup_printf ("0x%lx", window->xwindow); |