screen: Add the list window flags to meta_screen_foreach_window

So we can ditch a manual use of list_windows.
This commit is contained in:
Jasper St. Pierre 2014-08-15 20:10:25 -04:00
parent 8627b65f8d
commit 827e0341ab
3 changed files with 6 additions and 24 deletions

View File

@ -140,6 +140,7 @@ void meta_screen_free (MetaScreen *scree
void meta_screen_init_workspaces (MetaScreen *screen); void meta_screen_init_workspaces (MetaScreen *screen);
void meta_screen_manage_all_windows (MetaScreen *screen); void meta_screen_manage_all_windows (MetaScreen *screen);
void meta_screen_foreach_window (MetaScreen *screen, void meta_screen_foreach_window (MetaScreen *screen,
MetaListWindowsFlags flags,
MetaScreenWindowFunc func, MetaScreenWindowFunc func,
gpointer data); gpointer data);

View File

@ -958,17 +958,9 @@ get_screen_name (MetaDisplay *display,
return scr; return scr;
} }
/**
* meta_screen_foreach_window:
* @screen: a #MetaScreen
* @func: function to call for each window
* @data: user data to pass to @func
*
* Calls the specified function for each window on the screen,
* ignoring override-redirect windows.
*/
void void
meta_screen_foreach_window (MetaScreen *screen, meta_screen_foreach_window (MetaScreen *screen,
MetaListWindowsFlags flags,
MetaScreenWindowFunc func, MetaScreenWindowFunc func,
gpointer data) gpointer data)
{ {
@ -978,7 +970,7 @@ meta_screen_foreach_window (MetaScreen *screen,
* of windows might be sensible. * of windows might be sensible.
*/ */
windows = meta_display_list_windows (screen->display, META_LIST_DEFAULT); windows = meta_display_list_windows (screen->display, flags);
g_slist_foreach (windows, (GFunc) func, data); g_slist_foreach (windows, (GFunc) func, data);
@ -2396,8 +2388,6 @@ static void
on_monitors_changed (MetaMonitorManager *manager, on_monitors_changed (MetaMonitorManager *manager,
MetaScreen *screen) MetaScreen *screen)
{ {
GSList *tmp, *windows;
meta_monitor_manager_get_screen_size (manager, meta_monitor_manager_get_screen_size (manager,
&screen->rect.width, &screen->rect.width,
&screen->rect.height); &screen->rect.height);
@ -2422,19 +2412,10 @@ on_monitors_changed (MetaMonitorManager *manager,
} }
/* Queue a resize on all the windows */ /* Queue a resize on all the windows */
meta_screen_foreach_window (screen, meta_screen_resize_func, 0); meta_screen_foreach_window (screen, META_LIST_DEFAULT, meta_screen_resize_func, 0);
/* Fix up monitor for all windows on this screen */ /* Fix up monitor for all windows on this screen */
windows = meta_display_list_windows (screen->display, meta_screen_foreach_window (screen, META_LIST_INCLUDE_OVERRIDE_REDIRECT, (MetaScreenWindowFunc) meta_window_update_for_monitors_changed, 0);
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
for (tmp = windows; tmp != NULL; tmp = tmp->next)
{
MetaWindow *window = tmp->data;
meta_window_update_for_monitors_changed (window);
}
g_slist_free (windows);
meta_screen_queue_check_fullscreen (screen); meta_screen_queue_check_fullscreen (screen);

View File

@ -179,7 +179,7 @@ meta_workspace_new (MetaScreen *screen)
g_list_append (workspace->screen->workspaces, workspace); g_list_append (workspace->screen->workspaces, workspace);
workspace->windows = NULL; workspace->windows = NULL;
workspace->mru_list = NULL; workspace->mru_list = NULL;
meta_screen_foreach_window (screen, maybe_add_to_list, &workspace->mru_list); meta_screen_foreach_window (screen, META_LIST_DEFAULT, maybe_add_to_list, &workspace->mru_list);
workspace->work_areas_invalid = TRUE; workspace->work_areas_invalid = TRUE;
workspace->work_area_monitor = NULL; workspace->work_area_monitor = NULL;