[mutter/wip/mult-window-actors: 1/8] Move position-changed / size-changed signals to the MetaWindow



commit 0601987651e9846ca1a02f39c3d4a13e39945126
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Dec 6 15:39:24 2013 -0500

    Move position-changed / size-changed signals to the MetaWindow
    
    They fit more appropriately over here...

 src/compositor/meta-window-actor.c |   35 -----------------------------------
 src/core/window.c                  |   24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 35 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 83e949d..66f6532 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -34,15 +34,6 @@
 #include "monitor-private.h"
 #include "meta-cullable.h"
 
-enum {
-  POSITION_CHANGED,
-  SIZE_CHANGED,
-  LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = {0};
-
-
 struct _MetaWindowActorPrivate
 {
   MetaWindow       *window;
@@ -271,19 +262,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
   g_object_class_install_property (object_class,
                                    PROP_SHADOW_CLASS,
                                    pspec);
-
-  signals[POSITION_CHANGED] =
-    g_signal_new ("position-changed",
-                  G_TYPE_FROM_CLASS (klass),
-                  G_SIGNAL_RUN_LAST,
-                  0, NULL, NULL, NULL,
-                  G_TYPE_NONE, 0);
-  signals[SIZE_CHANGED] =
-    g_signal_new ("size-changed",
-                  G_TYPE_FROM_CLASS (klass),
-                  G_SIGNAL_RUN_LAST,
-                  0, NULL, NULL, NULL,
-                  G_TYPE_NONE, 0);
 }
 
 static void
@@ -1417,8 +1395,6 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
                               window_rect.x, window_rect.y);
   clutter_actor_set_size (CLUTTER_ACTOR (self),
                           window_rect.width, window_rect.height);
-
-  g_signal_emit (self, signals[POSITION_CHANGED], 0);
 }
 
 void
@@ -1918,17 +1894,6 @@ check_needs_pixmap (MetaWindowActor *self)
        */
       if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
         g_warning ("NOTE: Not using GLX TFP!\n");
-
-      /* ::size-changed is supposed to refer to meta_window_get_frame_rect().
-       * Emitting it here works pretty much OK because a new value of the
-       * *input* rect (which is the outer rect with the addition of invisible
-       * borders) forces a new pixmap and we get here. In the rare case where
-       * a change to the window size was exactly balanced by a change to the
-       * invisible borders, we would miss emitting the signal. We would also
-       * emit spurious signals when we get a new pixmap without a new size,
-       * but that should be mostly harmless.
-       */
-      g_signal_emit (self, signals[SIZE_CHANGED], 0);
     }
 
   priv->needs_pixmap = FALSE;
diff --git a/src/core/window.c b/src/core/window.c
index b9f4455..c4c5046 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -194,6 +194,8 @@ enum
   FOCUS,
   RAISED,
   UNMANAGED,
+  SIZE_CHANGED,
+  POSITION_CHANGED,
 
   LAST_SIGNAL
 };
@@ -587,6 +589,22 @@ meta_window_class_init (MetaWindowClass *klass)
                   G_STRUCT_OFFSET (MetaWindowClass, unmanaged),
                   NULL, NULL, NULL,
                   G_TYPE_NONE, 0);
+
+  window_signals[POSITION_CHANGED] =
+    g_signal_new ("position-changed",
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 0);
+
+  window_signals[SIZE_CHANGED] =
+    g_signal_new ("size-changed",
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 0);
 }
 
 static void
@@ -5283,6 +5301,12 @@ meta_window_move_resize_internal (MetaWindow          *window,
   else if (is_user_action)
     save_user_window_placement (window);
 
+  if (need_move_frame)
+    g_signal_emit (window, window_signals[POSITION_CHANGED], 0);
+
+  if (need_resize_client)
+    g_signal_emit (window, window_signals[SIZE_CHANGED], 0);
+
   if (need_move_frame || need_resize_frame ||
       need_move_client || need_resize_client ||
       did_placement)


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