mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
Make compositor private a GObject than a void pointer
Requiring the compositor private object to be a GObject allows the return value of meta_window_get_compositor_private() to be used via gobject-introspection, since the type and memory management can be determined. This allows a reverse mapping from MetaWindow to MutterWindow. - Change meta_window_get/set_compositor_private to use GObject rather than void * - Adapt code in compositor-mutter.c to match.
This commit is contained in:
parent
c3884e9900
commit
f4ecc9bab8
@ -1221,7 +1221,7 @@ add_win (MetaWindow *window)
|
|||||||
meta_verbose ("added 0x%x (%p) type:", (guint)top_window, cw);
|
meta_verbose ("added 0x%x (%p) type:", (guint)top_window, cw);
|
||||||
|
|
||||||
/* Hang our compositor window state off the MetaWindow for fast retrieval */
|
/* Hang our compositor window state off the MetaWindow for fast retrieval */
|
||||||
meta_window_set_compositor_private (window, cw);
|
meta_window_set_compositor_private (window, G_OBJECT (cw));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add this to the list at the top of the stack before it is mapped so that
|
* Add this to the list at the top of the stack before it is mapped so that
|
||||||
@ -1745,7 +1745,7 @@ clutter_cmp_remove_window (MetaCompositor *compositor,
|
|||||||
MutterWindow *cw = NULL;
|
MutterWindow *cw = NULL;
|
||||||
|
|
||||||
DEBUG_TRACE ("clutter_cmp_remove_window\n");
|
DEBUG_TRACE ("clutter_cmp_remove_window\n");
|
||||||
cw = meta_window_get_compositor_private (window);
|
cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
if (!cw)
|
if (!cw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1874,7 +1874,7 @@ static void
|
|||||||
clutter_cmp_map_window (MetaCompositor *compositor, MetaWindow *window)
|
clutter_cmp_map_window (MetaCompositor *compositor, MetaWindow *window)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
DEBUG_TRACE ("clutter_cmp_map_window\n");
|
DEBUG_TRACE ("clutter_cmp_map_window\n");
|
||||||
if (!cw)
|
if (!cw)
|
||||||
return;
|
return;
|
||||||
@ -1887,7 +1887,7 @@ static void
|
|||||||
clutter_cmp_unmap_window (MetaCompositor *compositor, MetaWindow *window)
|
clutter_cmp_unmap_window (MetaCompositor *compositor, MetaWindow *window)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
DEBUG_TRACE ("clutter_cmp_unmap_window\n");
|
DEBUG_TRACE ("clutter_cmp_unmap_window\n");
|
||||||
if (!cw)
|
if (!cw)
|
||||||
return;
|
return;
|
||||||
@ -1903,7 +1903,7 @@ clutter_cmp_minimize_window (MetaCompositor *compositor,
|
|||||||
MetaRectangle *icon_rect)
|
MetaRectangle *icon_rect)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
MetaScreen *screen = meta_window_get_screen (window);
|
MetaScreen *screen = meta_window_get_screen (window);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
@ -1939,7 +1939,7 @@ clutter_cmp_unminimize_window (MetaCompositor *compositor,
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
#if 0
|
#if 0
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
MetaScreen *screen = meta_window_get_screen (window);
|
MetaScreen *screen = meta_window_get_screen (window);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
@ -1963,7 +1963,7 @@ clutter_cmp_unminimize_window (MetaCompositor *compositor,
|
|||||||
cw->priv->minimize_in_progress--;
|
cw->priv->minimize_in_progress--;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
DEBUG_TRACE ("clutter_cmp_unminimize_window\n");
|
DEBUG_TRACE ("clutter_cmp_unminimize_window\n");
|
||||||
if (!cw)
|
if (!cw)
|
||||||
return;
|
return;
|
||||||
@ -1980,7 +1980,7 @@ clutter_cmp_maximize_window (MetaCompositor *compositor,
|
|||||||
MetaRectangle *rect)
|
MetaRectangle *rect)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
MetaScreen *screen = meta_window_get_screen (window);
|
MetaScreen *screen = meta_window_get_screen (window);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
@ -2010,7 +2010,7 @@ clutter_cmp_unmaximize_window (MetaCompositor *compositor,
|
|||||||
MetaRectangle *rect)
|
MetaRectangle *rect)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
MetaScreen *screen = meta_window_get_screen (window);
|
MetaScreen *screen = meta_window_get_screen (window);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
@ -2169,7 +2169,7 @@ clutter_cmp_sync_stack (MetaCompositor *compositor,
|
|||||||
for (tmp = stack; tmp != NULL; tmp = tmp->next)
|
for (tmp = stack; tmp != NULL; tmp = tmp->next)
|
||||||
{
|
{
|
||||||
MetaWindow *window = tmp->data;
|
MetaWindow *window = tmp->data;
|
||||||
MutterWindow *cw = window->compositor_private;
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
|
|
||||||
if (!cw)
|
if (!cw)
|
||||||
{
|
{
|
||||||
@ -2191,7 +2191,7 @@ clutter_cmp_set_window_hidden (MetaCompositor *compositor,
|
|||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
gboolean hidden)
|
gboolean hidden)
|
||||||
{
|
{
|
||||||
MutterWindow *cw = window->compositor_private;
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
DEBUG_TRACE ("clutter_cmp_set_window_hidden\n");
|
DEBUG_TRACE ("clutter_cmp_set_window_hidden\n");
|
||||||
@ -2219,7 +2219,7 @@ clutter_cmp_sync_window_geometry (MetaCompositor *compositor,
|
|||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
MutterWindow *cw = meta_window_get_compositor_private (window);
|
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||||
MetaScreen *screen = meta_window_get_screen (window);
|
MetaScreen *screen = meta_window_get_screen (window);
|
||||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ struct _MetaWindow
|
|||||||
MetaGroup *group;
|
MetaGroup *group;
|
||||||
|
|
||||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
void *compositor_private;
|
GObject *compositor_private;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8707,7 +8707,15 @@ meta_window_get_description (MetaWindow *window)
|
|||||||
return window->desc;
|
return window->desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
/**
|
||||||
|
* meta_window_get_compositor_private:
|
||||||
|
* @window: a #MetaWindow
|
||||||
|
*
|
||||||
|
* Gets the compositor's wrapper object for @window.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): the wrapper object.
|
||||||
|
**/
|
||||||
|
GObject *
|
||||||
meta_window_get_compositor_private (MetaWindow *window)
|
meta_window_get_compositor_private (MetaWindow *window)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window)
|
||||||
@ -8716,7 +8724,7 @@ meta_window_get_compositor_private (MetaWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_set_compositor_private (MetaWindow *window, void *priv)
|
meta_window_set_compositor_private (MetaWindow *window, GObject *priv)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
@ -92,8 +92,8 @@ void meta_window_change_workspace_by_index (MetaWindow *window,
|
|||||||
gint space_index,
|
gint space_index,
|
||||||
gboolean append,
|
gboolean append,
|
||||||
guint32 timestamp);
|
guint32 timestamp);
|
||||||
void *meta_window_get_compositor_private (MetaWindow *window);
|
GObject *meta_window_get_compositor_private (MetaWindow *window);
|
||||||
void meta_window_set_compositor_private (MetaWindow *window, void *priv);
|
void meta_window_set_compositor_private (MetaWindow *window, GObject *priv);
|
||||||
void meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event);
|
void meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event);
|
||||||
const char *meta_window_get_role (MetaWindow *window);
|
const char *meta_window_get_role (MetaWindow *window);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user