Adds a compositor_private member to MetaWindow
Since we often need to find a MutterWindow corresponding to a MetaWindow this make it a simple de-reference of a compositor private pointer.
This commit is contained in:
parent
6d8baea4c2
commit
7ea4380725
@ -474,6 +474,13 @@ static MutterWindow *
|
|||||||
find_window_in_display (MetaDisplay *display, Window xwindow)
|
find_window_in_display (MetaDisplay *display, Window xwindow)
|
||||||
{
|
{
|
||||||
GSList *index;
|
GSList *index;
|
||||||
|
MetaWindow *window = meta_display_lookup_x_window (display, xwindow);
|
||||||
|
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
if (window->compositor_private)
|
||||||
|
return window->compositor_private;
|
||||||
|
}
|
||||||
|
|
||||||
for (index = meta_display_get_screens (display);
|
for (index = meta_display_get_screens (display);
|
||||||
index;
|
index;
|
||||||
@ -1028,6 +1035,7 @@ mutter_window_detach (MutterWindow *self)
|
|||||||
static void
|
static void
|
||||||
destroy_win (MutterWindow *cw, gboolean no_effect)
|
destroy_win (MutterWindow *cw, gboolean no_effect)
|
||||||
{
|
{
|
||||||
|
MetaWindow *window;
|
||||||
MetaCompScreen *info;
|
MetaCompScreen *info;
|
||||||
MutterWindowPrivate *priv;
|
MutterWindowPrivate *priv;
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
@ -1037,6 +1045,14 @@ destroy_win (MutterWindow *cw, gboolean no_effect)
|
|||||||
|
|
||||||
priv = cw->priv;
|
priv = cw->priv;
|
||||||
|
|
||||||
|
window = meta_display_lookup_x_window (priv->screen->display, priv->xwindow);
|
||||||
|
if (window)
|
||||||
|
window->compositor_private = NULL;
|
||||||
|
|
||||||
|
/* If not override redirect */
|
||||||
|
if (window)
|
||||||
|
window->compositor_private = NULL;
|
||||||
|
|
||||||
screen = priv->screen;
|
screen = priv->screen;
|
||||||
info = meta_screen_get_compositor_data (screen);
|
info = meta_screen_get_compositor_data (screen);
|
||||||
|
|
||||||
@ -1296,6 +1312,11 @@ add_win (MetaScreen *screen, MetaWindow *window, Window xwindow)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Hang our compositor window state off the MetaWindow for fast retrieval
|
||||||
|
* if we have one */
|
||||||
|
if (window)
|
||||||
|
window->compositor_private = 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
|
||||||
* map_win can find it again
|
* map_win can find it again
|
||||||
@ -1450,7 +1471,7 @@ process_create (Mutter *compositor,
|
|||||||
{
|
{
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
Window xwindow = event->window;
|
Window xwindow = event->window;
|
||||||
MutterWindow *mw;
|
MutterWindow *cw;
|
||||||
|
|
||||||
screen = meta_display_screen_for_root (compositor->display, event->parent);
|
screen = meta_display_screen_for_root (compositor->display, event->parent);
|
||||||
|
|
||||||
@ -1461,18 +1482,18 @@ process_create (Mutter *compositor,
|
|||||||
* This is quite silly as we end up creating windows as then immediatly
|
* This is quite silly as we end up creating windows as then immediatly
|
||||||
* destroying them as they (likely) become framed and thus reparented.
|
* destroying them as they (likely) become framed and thus reparented.
|
||||||
*/
|
*/
|
||||||
mw = find_window_for_screen (screen, xwindow);
|
cw = find_window_for_screen (screen, xwindow);
|
||||||
|
|
||||||
if (!mw && window)
|
if (!cw && window)
|
||||||
{
|
{
|
||||||
xwindow = meta_window_get_xwindow (window);
|
xwindow = meta_window_get_xwindow (window);
|
||||||
|
|
||||||
mw = find_window_for_screen (screen, xwindow);
|
cw = find_window_for_screen (screen, xwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mw)
|
if (cw)
|
||||||
{
|
{
|
||||||
destroy_win (mw, TRUE);
|
destroy_win (cw, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_win (screen, window, event->window);
|
add_win (screen, window, event->window);
|
||||||
@ -1484,7 +1505,7 @@ process_reparent (Mutter *compositor,
|
|||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
{
|
{
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
MutterWindow *mw;
|
MutterWindow *cw;
|
||||||
Window xwindow = event->window;
|
Window xwindow = event->window;
|
||||||
gboolean viewable = FALSE;
|
gboolean viewable = FALSE;
|
||||||
|
|
||||||
@ -1493,27 +1514,15 @@ process_reparent (Mutter *compositor,
|
|||||||
if (!screen)
|
if (!screen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mw = find_window_for_screen (screen, xwindow);
|
if (window)
|
||||||
|
cw = window->compositor_private;
|
||||||
|
else
|
||||||
|
cw = find_window_for_screen (screen, xwindow);
|
||||||
|
|
||||||
if (!mw && window)
|
if (cw)
|
||||||
{
|
{
|
||||||
xwindow = meta_window_get_xwindow (window);
|
viewable = (cw->priv->attrs.map_state == IsViewable);
|
||||||
|
destroy_win (cw, TRUE);
|
||||||
mw = find_window_for_screen (screen, xwindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mw && window)
|
|
||||||
{
|
|
||||||
xwindow = meta_window_get_xwindow (window);
|
|
||||||
|
|
||||||
mw = find_window_for_screen (screen, xwindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mw)
|
|
||||||
{
|
|
||||||
viewable = (mw->priv->attrs.map_state == IsViewable);
|
|
||||||
destroy_win (mw, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_win (screen, window, event->window);
|
add_win (screen, window, event->window);
|
||||||
@ -1604,11 +1613,11 @@ update_shape (Mutter *compositor,
|
|||||||
|
|
||||||
#ifdef HAVE_SHAPE
|
#ifdef HAVE_SHAPE
|
||||||
static void
|
static void
|
||||||
process_shape (Mutter *compositor,
|
process_shape (Mutter *compositor,
|
||||||
XShapeEvent *event)
|
XShapeEvent *event)
|
||||||
{
|
{
|
||||||
MutterWindow *cw = find_window_in_display (compositor->display,
|
MutterWindow *cw = find_window_in_display (compositor->display,
|
||||||
event->window);
|
event->window);
|
||||||
MutterWindowPrivate *priv = cw->priv;
|
MutterWindowPrivate *priv = cw->priv;
|
||||||
|
|
||||||
if (cw == NULL)
|
if (cw == NULL)
|
||||||
@ -1679,12 +1688,12 @@ process_configure_notify (Mutter *compositor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_unmap (Mutter *compositor,
|
process_unmap (Mutter *compositor,
|
||||||
XUnmapEvent *event)
|
XUnmapEvent *event)
|
||||||
{
|
{
|
||||||
MutterWindow *cw;
|
MutterWindow *cw;
|
||||||
Window xwin = event->window;
|
Window xwin = event->window;
|
||||||
Display *dpy = event->display;
|
Display *dpy = event->display;
|
||||||
|
|
||||||
if (event->from_configure)
|
if (event->from_configure)
|
||||||
{
|
{
|
||||||
@ -1692,7 +1701,7 @@ process_unmap (Mutter *compositor,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw = find_window_in_display (compositor->display, xwin);
|
cw = find_window_in_display (compositor->display, event->window);
|
||||||
|
|
||||||
if (cw)
|
if (cw)
|
||||||
{
|
{
|
||||||
@ -1721,7 +1730,10 @@ process_map (Mutter *compositor,
|
|||||||
MutterWindow *cw;
|
MutterWindow *cw;
|
||||||
Window xwindow = event->window;
|
Window xwindow = event->window;
|
||||||
|
|
||||||
cw = find_window_in_display (compositor->display, xwindow);
|
if (window)
|
||||||
|
cw = window->compositor_private;
|
||||||
|
else
|
||||||
|
cw = find_window_in_display (compositor->display, xwindow);
|
||||||
|
|
||||||
if (cw)
|
if (cw)
|
||||||
{
|
{
|
||||||
@ -1730,8 +1742,8 @@ process_map (Mutter *compositor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_property_notify (Mutter *compositor,
|
process_property_notify (Mutter *compositor,
|
||||||
XPropertyEvent *event)
|
XPropertyEvent *event)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = compositor->display;
|
MetaDisplay *display = compositor->display;
|
||||||
|
|
||||||
@ -1739,7 +1751,7 @@ process_property_notify (Mutter *compositor,
|
|||||||
if (event->atom == compositor->atom_net_wm_window_opacity)
|
if (event->atom == compositor->atom_net_wm_window_opacity)
|
||||||
{
|
{
|
||||||
MutterWindow *cw = find_window_in_display (display, event->window);
|
MutterWindow *cw = find_window_in_display (display, event->window);
|
||||||
gulong value;
|
gulong value;
|
||||||
|
|
||||||
if (!cw)
|
if (!cw)
|
||||||
{
|
{
|
||||||
@ -2353,29 +2365,15 @@ 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;
|
MutterWindow *cw = window->compositor_private;
|
||||||
MetaCompScreen *info;
|
|
||||||
MetaScreen *screen;
|
|
||||||
MetaFrame *f = meta_window_get_frame (window);
|
|
||||||
Window xwindow;
|
|
||||||
|
|
||||||
screen = meta_window_get_screen (window);
|
|
||||||
info = meta_screen_get_compositor_data (screen);
|
|
||||||
|
|
||||||
/* Chances are we actually get the window frame here */
|
|
||||||
xwindow = f ? meta_frame_get_xwindow (f) :
|
|
||||||
meta_window_get_xwindow (window);
|
|
||||||
cw = find_window_for_screen (screen, xwindow);
|
|
||||||
if (!cw)
|
if (!cw)
|
||||||
{
|
{
|
||||||
meta_verbose ("Failed to find corresponding MutterWindow "
|
meta_verbose ("Failed to find corresponding MutterWindow "
|
||||||
"for window 0x%08x\n", (unsigned int)xwindow);
|
"for window %p\n", window);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: cw = window->compositor_priv; */
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME: There should be a seperate composite manager hook
|
/* FIXME: There should be a seperate composite manager hook
|
||||||
* for hiding/unhiding the actor when the window becomes
|
* for hiding/unhiding the actor when the window becomes
|
||||||
|
@ -348,6 +348,10 @@ struct _MetaWindow
|
|||||||
|
|
||||||
/* maintained by group.c */
|
/* maintained by group.c */
|
||||||
MetaGroup *group;
|
MetaGroup *group;
|
||||||
|
|
||||||
|
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||||
|
void *compositor_private;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* These differ from window->has_foo_func in that they consider
|
/* These differ from window->has_foo_func in that they consider
|
||||||
|
Loading…
x
Reference in New Issue
Block a user