[mutter/wip/mult-window-actors: 7/9] window-actor: Don't do any special initialization in _new



commit acd4b4f6e5bac27f962d625d08e0caadeb2af762
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 23 18:51:03 2012 -0400

    window-actor: Don't do any special initialization in _new

 src/compositor/meta-window-actor.c |  148 +++++++++++++++++-------------------
 1 files changed, 71 insertions(+), 77 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 3b9828f..331e598 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -236,6 +236,9 @@ meta_window_actor_init (MetaWindowActor *self)
 						   MetaWindowActorPrivate);
   priv->opacity = 0xff;
   priv->shadow_class = NULL;
+
+  priv->last_width = -1;
+  priv->last_height = -1;
 }
 
 static void
@@ -287,67 +290,6 @@ window_appears_focused_notify (MetaWindow *mw,
 }
 
 static void
-meta_window_actor_constructed (GObject *object)
-{
-  MetaWindowActor        *self     = META_WINDOW_ACTOR (object);
-  MetaWindowActorPrivate *priv     = self->priv;
-  MetaScreen             *screen   = priv->screen;
-  MetaDisplay            *display  = meta_screen_get_display (screen);
-  MetaWindow             *window   = priv->window;
-  MetaFrame              *frame    = meta_window_get_frame (window);
-  Display                *xdisplay = meta_display_get_xdisplay (display);
-  XRenderPictFormat      *format;
-  Window                  xwindow;
-
-  if (frame)
-    xwindow = meta_frame_get_xwindow (frame);
-  else
-    xwindow = meta_window_get_xwindow (window);
-
-  priv->damage = XDamageCreate (xdisplay, xwindow,
-                                XDamageReportBoundingBox);
-
-  format = XRenderFindVisualFormat (xdisplay, window->xvisual);
-
-  if (format && format->type == PictTypeDirect && format->direct.alphaMask)
-    priv->argb32 = TRUE;
-
-  if (!priv->actor)
-    {
-      priv->actor = meta_shaped_texture_new ();
-
-      clutter_actor_add_child (CLUTTER_ACTOR (self), priv->actor);
-
-      /*
-       * Since we are holding a pointer to this actor independently of the
-       * ClutterContainer internals, and provide a public API to access it,
-       * add a reference here, so that if someone is messing about with us
-       * via the container interface, we do not end up with a dangling pointer.
-       * We will release it in dispose().
-       */
-      g_object_ref (priv->actor);
-
-      g_signal_connect (window, "notify::decorated",
-                        G_CALLBACK (window_decorated_notify), self);
-      g_signal_connect (window, "notify::appears-focused",
-                        G_CALLBACK (window_appears_focused_notify), self);
-    }
-  else
-    {
-      /*
-       * This is the case where existing window is gaining/loosing frame.
-       * Just ensure the actor is top most (i.e., above shadow).
-       */
-      clutter_actor_set_child_above_sibling (CLUTTER_ACTOR (self), priv->actor, NULL);
-    }
-
-  meta_window_actor_update_opacity (self);
-  meta_window_actor_update_shape (self);
-
-  G_OBJECT_CLASS (meta_window_actor_parent_class)->constructed(object);
-}
-
-static void
 meta_window_actor_dispose (GObject *object)
 {
   MetaWindowActor        *self = META_WINDOW_ACTOR (object);
@@ -948,6 +890,73 @@ meta_window_actor_queue_create_pixmap (MetaWindowActor *self)
   clutter_actor_queue_redraw (priv->actor);
 }
 
+static void
+meta_window_actor_constructed (GObject *object)
+{
+  MetaWindowActor        *self     = META_WINDOW_ACTOR (object);
+  MetaWindowActorPrivate *priv     = self->priv;
+  MetaScreen             *screen   = priv->screen;
+  MetaDisplay            *display  = meta_screen_get_display (screen);
+  MetaWindow             *window   = priv->window;
+  MetaFrame              *frame    = meta_window_get_frame (window);
+  Display                *xdisplay = meta_display_get_xdisplay (display);
+  XRenderPictFormat      *format;
+  Window                  xwindow;
+
+  if (frame)
+    xwindow = meta_frame_get_xwindow (frame);
+  else
+    xwindow = meta_window_get_xwindow (window);
+
+  priv->damage = XDamageCreate (xdisplay, xwindow,
+                                XDamageReportBoundingBox);
+
+  format = XRenderFindVisualFormat (xdisplay, window->xvisual);
+
+  if (format && format->type == PictTypeDirect && format->direct.alphaMask)
+    priv->argb32 = TRUE;
+
+  if (!priv->actor)
+    {
+      priv->actor = meta_shaped_texture_new ();
+
+      clutter_actor_add_child (CLUTTER_ACTOR (self), priv->actor);
+
+      /*
+       * Since we are holding a pointer to this actor independently of the
+       * ClutterContainer internals, and provide a public API to access it,
+       * add a reference here, so that if someone is messing about with us
+       * via the container interface, we do not end up with a dangling pointer.
+       * We will release it in dispose().
+       */
+      g_object_ref (priv->actor);
+
+      g_signal_connect (window, "notify::decorated",
+                        G_CALLBACK (window_decorated_notify), self);
+      g_signal_connect (window, "notify::appears-focused",
+                        G_CALLBACK (window_appears_focused_notify), self);
+    }
+  else
+    {
+      /*
+       * This is the case where existing window is gaining/loosing frame.
+       * Just ensure the actor is top most (i.e., above shadow).
+       */
+      clutter_actor_set_child_above_sibling (clutter_actor_get_parent (priv->actor),
+                                             priv->actor,
+                                             NULL);
+    }
+
+  meta_window_actor_update_opacity (self);
+  meta_window_actor_update_shape (self);
+
+  priv->mapped = meta_window_toplevel_is_mapped (priv->window);
+  if (priv->mapped)
+    meta_window_actor_queue_create_pixmap (self);
+
+  meta_window_actor_sync_actor_position (self);
+}
+
 static gboolean
 is_freeze_thaw_effect (gulong event)
 {
@@ -1427,26 +1436,11 @@ MetaWindowActor *
 meta_window_actor_new (MetaWindow *window)
 {
   MetaScreen	 	 *screen = meta_window_get_screen (window);
-  MetaWindowActor        *self;
-  MetaWindowActorPrivate *priv;
 
-  self = g_object_new (META_TYPE_WINDOW_ACTOR,
+  return g_object_new (META_TYPE_WINDOW_ACTOR,
                        "meta-window",         window,
                        "meta-screen",         screen,
                        NULL);
-
-  priv = self->priv;
-
-  priv->last_width = -1;
-  priv->last_height = -1;
-
-  priv->mapped = meta_window_toplevel_is_mapped (priv->window);
-  if (priv->mapped)
-    meta_window_actor_queue_create_pixmap (self);
-
-  meta_window_actor_sync_actor_position (self);
-
-  return self;
 }
 
 void



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