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.
This commit is contained in:
Colin Walters 2009-08-11 14:54:51 -04:00
parent b51bcf3e2b
commit 789e24b59a

View File

@ -271,9 +271,6 @@ get_cleaned_wmclass_for_window (MetaWindow *window)
char *wmclass; char *wmclass;
char *cleaned_wmclass; char *cleaned_wmclass;
if (meta_window_get_window_type (window) != META_WINDOW_NORMAL)
return NULL;
wmclass = get_wmclass_for_window (window); wmclass = get_wmclass_for_window (window);
if (!wmclass) if (!wmclass)
return NULL; return NULL;
@ -510,6 +507,16 @@ track_window (ShellAppMonitor *self,
{ {
ShellAppInfo *app; ShellAppInfo *app;
AppUsage *usage; 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); app = get_app_for_window (window);
if (!app) if (!app)
@ -634,6 +641,8 @@ on_session_status_changed (DBusGProxy *proxy,
* @self: * @self:
* @appid: Find windows for this id * @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 * Returns: (transfer container) (element-type MetaWindow): List of #MetaWindow corresponding to appid
*/ */
GSList * GSList *
@ -826,7 +835,14 @@ ShellAppInfo *
shell_app_monitor_get_window_app (ShellAppMonitor *monitor, shell_app_monitor_get_window_app (ShellAppMonitor *monitor,
MetaWindow *metawin) 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) if (info)
shell_app_info_ref (info); shell_app_info_ref (info);
return info; return info;