[gnome-shell] ShellAppMonitor: Correctly handle transients
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] ShellAppMonitor: Correctly handle transients
- Date: Wed, 12 Aug 2009 14:11:39 +0000 (UTC)
commit 789e24b59a07f20d1658377ebed57567ca7d4299
Author: Colin Walters <walters verbum org>
Date: Tue Aug 11 14:54:51 2009 -0400
ShellAppMonitor: Correctly handle transients
If looking up the application for a transient window, try look up
its transient source. Ignore transients for the purposes of counting
open windows.
src/shell-app-monitor.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/shell-app-monitor.c b/src/shell-app-monitor.c
index 084b437..0a9e80f 100644
--- a/src/shell-app-monitor.c
+++ b/src/shell-app-monitor.c
@@ -271,9 +271,6 @@ get_cleaned_wmclass_for_window (MetaWindow *window)
char *wmclass;
char *cleaned_wmclass;
- if (meta_window_get_window_type (window) != META_WINDOW_NORMAL)
- return NULL;
-
wmclass = get_wmclass_for_window (window);
if (!wmclass)
return NULL;
@@ -510,6 +507,16 @@ track_window (ShellAppMonitor *self,
{
ShellAppInfo *app;
AppUsage *usage;
+ MetaWindow *transient_for;
+
+ /* Just ignore anything that isn't NORMAL */
+ if (meta_window_get_window_type (window) != META_WINDOW_NORMAL)
+ return;
+
+ /* Also ignore transients */
+ transient_for = meta_window_get_transient_for (window);
+ if (transient_for != NULL)
+ return;
app = get_app_for_window (window);
if (!app)
@@ -634,6 +641,8 @@ on_session_status_changed (DBusGProxy *proxy,
* @self:
* @appid: Find windows for this id
*
+ * Returns the normal toplevel windows associated with the given application.
+ *
* Returns: (transfer container) (element-type MetaWindow): List of #MetaWindow corresponding to appid
*/
GSList *
@@ -826,7 +835,14 @@ ShellAppInfo *
shell_app_monitor_get_window_app (ShellAppMonitor *monitor,
MetaWindow *metawin)
{
- ShellAppInfo *info = g_hash_table_lookup (monitor->window_to_app, metawin);
+ MetaWindow *transient_for;
+ ShellAppInfo *info;
+
+ transient_for = meta_window_get_transient_for (metawin);
+ if (transient_for != NULL)
+ metawin = transient_for;
+
+ info = g_hash_table_lookup (monitor->window_to_app, metawin);
if (info)
shell_app_info_ref (info);
return info;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]