[mutter/wayland] surface-actor-x11: Recreate damage when the toplevel X window changes



commit 020cfa7283c0d8ba9e9ee7b241f1b10600cdfa48
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Feb 20 14:49:22 2014 -0500

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

 src/compositor/meta-surface-actor-x11.c |   28 +++++++++++++++++++++++++---
 src/compositor/meta-window-actor.c      |   28 +---------------------------
 2 files changed, 26 insertions(+), 30 deletions(-)
---
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index 3eea2c3..020c847 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -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;
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 597a209..8eaf669 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -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 */
@@ -220,26 +219,6 @@ meta_window_actor_init (MetaWindowActor *self)
 }
 
 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,
                                gpointer    data)
@@ -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;
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]