mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -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);
|
||||
|
||||
/* 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
|
||||
@ -1745,7 +1745,7 @@ clutter_cmp_remove_window (MetaCompositor *compositor,
|
||||
MutterWindow *cw = NULL;
|
||||
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -1874,7 +1874,7 @@ static void
|
||||
clutter_cmp_map_window (MetaCompositor *compositor, MetaWindow *window)
|
||||
{
|
||||
#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");
|
||||
if (!cw)
|
||||
return;
|
||||
@ -1887,7 +1887,7 @@ static void
|
||||
clutter_cmp_unmap_window (MetaCompositor *compositor, MetaWindow *window)
|
||||
{
|
||||
#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");
|
||||
if (!cw)
|
||||
return;
|
||||
@ -1903,7 +1903,7 @@ clutter_cmp_minimize_window (MetaCompositor *compositor,
|
||||
MetaRectangle *icon_rect)
|
||||
{
|
||||
#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);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
@ -1939,7 +1939,7 @@ clutter_cmp_unminimize_window (MetaCompositor *compositor,
|
||||
{
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
#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);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
@ -1963,7 +1963,7 @@ clutter_cmp_unminimize_window (MetaCompositor *compositor,
|
||||
cw->priv->minimize_in_progress--;
|
||||
}
|
||||
#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");
|
||||
if (!cw)
|
||||
return;
|
||||
@ -1980,7 +1980,7 @@ clutter_cmp_maximize_window (MetaCompositor *compositor,
|
||||
MetaRectangle *rect)
|
||||
{
|
||||
#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);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
@ -2010,7 +2010,7 @@ clutter_cmp_unmaximize_window (MetaCompositor *compositor,
|
||||
MetaRectangle *rect)
|
||||
{
|
||||
#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);
|
||||
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)
|
||||
{
|
||||
MetaWindow *window = tmp->data;
|
||||
MutterWindow *cw = window->compositor_private;
|
||||
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
|
||||
|
||||
if (!cw)
|
||||
{
|
||||
@ -2191,7 +2191,7 @@ clutter_cmp_set_window_hidden (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
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);
|
||||
|
||||
DEBUG_TRACE ("clutter_cmp_set_window_hidden\n");
|
||||
@ -2219,7 +2219,7 @@ clutter_cmp_sync_window_geometry (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
#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);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
|
@ -360,7 +360,7 @@ struct _MetaWindow
|
||||
MetaGroup *group;
|
||||
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
void *compositor_private;
|
||||
GObject *compositor_private;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -8707,7 +8707,15 @@ meta_window_get_description (MetaWindow *window)
|
||||
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)
|
||||
{
|
||||
if (!window)
|
||||
@ -8716,7 +8724,7 @@ meta_window_get_compositor_private (MetaWindow *window)
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_set_compositor_private (MetaWindow *window, void *priv)
|
||||
meta_window_set_compositor_private (MetaWindow *window, GObject *priv)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
@ -92,8 +92,8 @@ void meta_window_change_workspace_by_index (MetaWindow *window,
|
||||
gint space_index,
|
||||
gboolean append,
|
||||
guint32 timestamp);
|
||||
void *meta_window_get_compositor_private (MetaWindow *window);
|
||||
void meta_window_set_compositor_private (MetaWindow *window, void *priv);
|
||||
GObject *meta_window_get_compositor_private (MetaWindow *window);
|
||||
void meta_window_set_compositor_private (MetaWindow *window, GObject *priv);
|
||||
void meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event);
|
||||
const char *meta_window_get_role (MetaWindow *window);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user