surface-actor-x11: Recreate damage when the toplevel X window changes

This commit is contained in:
Jasper St. Pierre 2014-02-20 14:49:22 -05:00
parent 83aca0b53d
commit 020cfa7283
2 changed files with 26 additions and 30 deletions

View File

@ -414,21 +414,43 @@ meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
priv->last_height = -1;
}
static void
create_damage (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
Display *xdisplay = meta_display_get_xdisplay (priv->display);
Window xwindow = meta_window_get_toplevel_xwindow (priv->window);
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
}
static void
window_decorated_notify (MetaWindow *window,
GParamSpec *pspec,
gpointer user_data)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (user_data);
free_damage (self);
create_damage (self);
}
MetaSurfaceActor *
meta_surface_actor_x11_new (MetaWindow *window)
{
MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = meta_window_get_display (window);
Display *xdisplay = meta_display_get_xdisplay (display);
Window xwindow = meta_window_get_toplevel_xwindow (window);
g_assert (!meta_is_wayland_compositor ());
priv->window = window;
priv->display = display;
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
create_damage (self);
g_signal_connect_object (priv->window, "notify::decorated",
G_CALLBACK (window_decorated_notify), self, 0);
update_is_argb32 (self);
priv->unredirected = FALSE;

View File

@ -84,7 +84,6 @@ struct _MetaWindowActorPrivate
guint visible : 1;
guint disposed : 1;
guint redecorating : 1;
/* If set, the client needs to be sent a _NET_WM_FRAME_DRAWN
* client message using the most recent frame in ->frames */
@ -219,26 +218,6 @@ meta_window_actor_init (MetaWindowActor *self)
priv->shadow_class = NULL;
}
static void
window_decorated_notify (MetaWindow *mw,
GParamSpec *arg1,
gpointer data)
{
MetaWindowActor *self = META_WINDOW_ACTOR (data);
MetaWindowActorPrivate *priv = self->priv;
/*
* Basically, we have to reconstruct the the internals of this object
* from scratch, as everything has changed.
*/
priv->redecorating = TRUE;
/*
* Recreate the contents.
*/
meta_window_actor_constructed (G_OBJECT (self));
}
static void
window_appears_focused_notify (MetaWindow *mw,
GParamSpec *arg1,
@ -414,9 +393,6 @@ meta_window_actor_set_property (GObject *object,
{
case PROP_META_WINDOW:
priv->window = g_value_dup_object (value);
g_signal_connect_object (priv->window, "notify::decorated",
G_CALLBACK (window_decorated_notify), self, 0);
g_signal_connect_object (priv->window, "notify::appears-focused",
G_CALLBACK (window_appears_focused_notify), self, 0);
break;
@ -1179,13 +1155,11 @@ meta_window_actor_show (MetaWindowActor *self,
g_assert_not_reached();
}
if (priv->redecorating ||
info->switch_workspace_in_progress ||
if (info->switch_workspace_in_progress ||
event == 0 ||
!start_simple_effect (self, event))
{
clutter_actor_show (CLUTTER_ACTOR (self));
priv->redecorating = FALSE;
}
}