From 79a614240b04f3f7aca852f9220570fecc1d59b5 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 16 Oct 2009 10:50:33 -0400 Subject: [PATCH] [ShellApp] fix app/window sort order The window lists were not being resorted when user-time changed, and the app list was mistakenly "penalizing" apps for having *any* minimized windows, rather than for having *only* minimized windows. https://bugzilla.gnome.org/show_bug.cgi?id=598389 --- src/shell-app.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/shell-app.c b/src/shell-app.c index bc87a1261..b89fafbec 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -151,11 +151,11 @@ shell_app_has_visible_windows (ShellApp *app) { MetaWindow *window = iter->data; - if (!meta_window_showing_on_its_workspace (window)) - return FALSE; + if (meta_window_showing_on_its_workspace (window)) + return TRUE; } - return TRUE; + return FALSE; } gboolean @@ -242,6 +242,21 @@ shell_app_on_unmanaged (MetaWindow *window, _shell_app_remove_window (app, window); } +static void +shell_app_on_user_time_changed (MetaWindow *window, + GParamSpec *pspec, + ShellApp *app) +{ + /* Ideally we don't want to emit windows-changed if the sort order + * isn't actually changing. This check catches most of those. + */ + if (window != app->windows->data) + { + app->window_sort_stale = TRUE; + g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0); + } +} + static void shell_app_on_ws_switch (MetaScreen *screen, int from, @@ -263,6 +278,7 @@ _shell_app_add_window (ShellApp *app, app->windows = g_slist_prepend (app->windows, g_object_ref (window)); g_signal_connect (window, "unmanaged", G_CALLBACK(shell_app_on_unmanaged), app); + g_signal_connect (window, "notify::user-time", G_CALLBACK(shell_app_on_user_time_changed), app); app->window_sort_stale = TRUE; g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);