mutter_window_get_description()

Human redable description useful for debugging, now accessible to plugins and
  and also for override redirect windows.
This commit is contained in:
Tomas Frydrych 2008-10-30 08:30:42 +00:00
parent b2fe0097e6
commit ce2bfc008d
4 changed files with 34 additions and 1 deletions

View File

@ -173,6 +173,8 @@ struct _MutterWindowPrivate
guint8 opacity;
gchar * desc;
/*
* These need to be counters rather than flags, since more plugins
* can implement same effect; the practicality of stacking effects
@ -390,6 +392,8 @@ mutter_window_dispose (GObject *object)
info->windows = g_list_remove (info->windows, (gconstpointer) self);
g_hash_table_remove (info->windows_by_xid, (gpointer) priv->xwindow);
g_free (priv->desc);
G_OBJECT_CLASS (mutter_window_parent_class)->dispose (object);
}
@ -734,11 +738,30 @@ mutter_window_is_override_redirect (MutterWindow *mcw)
return FALSE;
}
const char *mutter_window_get_description (MutterWindow *mcw)
{
/*
* For windows managed by the WM, we just defer to the WM for the window
* description. For override-redirect windows, we create the description
* ourselves, but only on demand.
*/
if (mcw->priv->window)
return meta_window_get_description (mcw->priv->window);
if (G_UNLIKELY (mcw->priv->desc == NULL))
{
mcw->priv->desc = g_strdup_printf ("Override Redirect (0x%x)",
(guint) mcw->priv->xwindow);
}
return mcw->priv->desc;
}
gint
mutter_window_get_workspace (MutterWindow *mcw)
{
MutterWindowPrivate *priv;
MetaWorkspace *workspace;
MetaWorkspace *workspace;
if (!mcw)
return -1;

View File

@ -8293,3 +8293,11 @@ meta_window_is_hidden (MetaWindow *window)
return window->hidden;
}
const char *
meta_window_get_description (MetaWindow *window)
{
if (!window)
return NULL;
return window->desc;
}

View File

@ -64,6 +64,7 @@ gboolean mutter_window_is_hidden (MutterWindow *mcw);
MetaWindow * mutter_window_get_meta_window (MutterWindow *mcw);
ClutterActor * mutter_window_get_texture (MutterWindow *mcw);
gboolean mutter_window_is_override_redirect (MutterWindow *mcw);
const char * mutter_window_get_description (MutterWindow *mcw);
/* Compositor API */
MetaCompositor *mutter_new (MetaDisplay *display);

View File

@ -63,5 +63,6 @@ void meta_window_activate (MetaWindow *window,guint32 current_time);
void meta_window_activate_with_workspace (MetaWindow *window,
guint32 current_time,
MetaWorkspace *workspace);
const char * meta_window_get_description (MetaWindow *window);
#endif