[mutter/wip/mult-window-actors: 6/9] window-actor: Remove (private) xwindow property



commit 015003c1240b900484f7f067841b41b1ec2b930f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 23 18:46:27 2012 -0400

    window-actor: Remove (private) xwindow property
    
    This should make it easier to construct a MetaWindowActor from bindings.
    
    There's some potential annoying boilerplate code that I'm planning on
    cleaning up into a separate meta_window_get_toplevel_xwindow utility
    method.

 src/compositor/meta-window-actor.c |   84 +++++++++--------------------------
 1 files changed, 22 insertions(+), 62 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 4412d66..3b9828f 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -40,7 +40,6 @@ static guint signals[LAST_SIGNAL] = {0};
 struct _MetaWindowActorPrivate
 {
   MetaWindow       *window;
-  Window            xwindow;
   MetaScreen       *screen;
 
   ClutterActor     *actor;
@@ -125,7 +124,6 @@ enum
 {
   PROP_META_WINDOW = 1,
   PROP_META_SCREEN,
-  PROP_X_WINDOW,
   PROP_NO_SHADOW,
   PROP_SHADOW_CLASS
 };
@@ -194,18 +192,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
                                    PROP_META_SCREEN,
                                    pspec);
 
-  pspec = g_param_spec_ulong ("x-window",
-			      "Window",
-			      "Window",
-			      0,
-			      G_MAXULONG,
-			      0,
-			      G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
-  g_object_class_install_property (object_class,
-                                   PROP_X_WINDOW,
-                                   pspec);
-
   pspec = g_param_spec_boolean ("no-shadow",
                                 "No shadow",
                                 "Do not add shaddow to this window",
@@ -259,11 +245,9 @@ window_decorated_notify (MetaWindow *mw,
 {
   MetaWindowActor        *self     = META_WINDOW_ACTOR (data);
   MetaWindowActorPrivate *priv     = self->priv;
-  MetaFrame              *frame    = meta_window_get_frame (mw);
   MetaScreen             *screen   = priv->screen;
   MetaDisplay            *display  = meta_screen_get_display (screen);
   Display                *xdisplay = meta_display_get_xdisplay (display);
-  Window                  new_xwindow;
 
   /*
    * Basically, we have to reconstruct the the internals of this object
@@ -271,11 +255,6 @@ window_decorated_notify (MetaWindow *mw,
    */
   priv->redecorating = TRUE;
 
-  if (frame)
-    new_xwindow = meta_frame_get_xwindow (frame);
-  else
-    new_xwindow = meta_window_get_xwindow (mw);
-
   meta_window_actor_detach (self);
 
   /*
@@ -293,8 +272,6 @@ window_decorated_notify (MetaWindow *mw,
   g_free (priv->desc);
   priv->desc = NULL;
 
-  priv->xwindow = new_xwindow;
-
   /*
    * Recreate the contents.
    */
@@ -316,10 +293,16 @@ meta_window_actor_constructed (GObject *object)
   MetaWindowActorPrivate *priv     = self->priv;
   MetaScreen             *screen   = priv->screen;
   MetaDisplay            *display  = meta_screen_get_display (screen);
-  Window                  xwindow  = priv->xwindow;
   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);
@@ -468,9 +451,6 @@ meta_window_actor_set_property (GObject      *object,
     case PROP_META_SCREEN:
       priv->screen = g_value_get_pointer (value);
       break;
-    case PROP_X_WINDOW:
-      priv->xwindow = g_value_get_ulong (value);
-      break;
     case PROP_NO_SHADOW:
       {
         gboolean newv = g_value_get_boolean (value);
@@ -518,9 +498,6 @@ meta_window_actor_get_property (GObject      *object,
     case PROP_META_SCREEN:
       g_value_set_pointer (value, priv->screen);
       break;
-    case PROP_X_WINDOW:
-      g_value_set_ulong (value, priv->xwindow);
-      break;
     case PROP_NO_SHADOW:
       g_value_set_boolean (value, priv->no_shadow);
       break;
@@ -785,19 +762,6 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
 }
 
 /**
- * meta_window_actor_get_x_window: (skip)
- *
- */
-Window
-meta_window_actor_get_x_window (MetaWindowActor *self)
-{
-  if (!self)
-    return None;
-
-  return self->priv->xwindow;
-}
-
-/**
  * meta_window_actor_get_meta_window:
  *
  * Gets the #MetaWindow object that the the #MetaWindowActor is displaying
@@ -852,12 +816,6 @@ const char *meta_window_actor_get_description (MetaWindowActor *self)
   if (self->priv->window)
     return meta_window_get_description (self->priv->window);
 
-  if (G_UNLIKELY (self->priv->desc == NULL))
-    {
-      self->priv->desc = g_strdup_printf ("Override Redirect (0x%x)",
-                                         (guint) self->priv->xwindow);
-    }
-
   return self->priv->desc;
 }
 
@@ -1225,10 +1183,16 @@ void
 meta_window_actor_set_redirected (MetaWindowActor *self, gboolean state)
 {
   MetaWindow *metaWindow = meta_window_actor_get_meta_window (self);
+  MetaFrame *frame = meta_window_get_frame (metaWindow);
   MetaDisplay *display = meta_window_get_display (metaWindow);
 
   Display *xdisplay = meta_display_get_xdisplay (display);
-  Window  xwin = meta_window_actor_get_x_window (self);
+  Window  xwin;
+
+  if (frame)
+    xwin = meta_frame_get_xwindow (frame);
+  else
+    xwin = meta_window_get_xwindow (metaWindow);
 
   if (state)
     {
@@ -1465,20 +1429,9 @@ meta_window_actor_new (MetaWindow *window)
   MetaScreen	 	 *screen = meta_window_get_screen (window);
   MetaWindowActor        *self;
   MetaWindowActorPrivate *priv;
-  MetaFrame		 *frame;
-  Window		  top_window;
-
-  frame = meta_window_get_frame (window);
-  if (frame)
-    top_window = meta_frame_get_xwindow (frame);
-  else
-    top_window = meta_window_get_xwindow (window);
-
-  meta_verbose ("add window: Meta %p, xwin 0x%x\n", window, (guint)top_window);
 
   self = g_object_new (META_TYPE_WINDOW_ACTOR,
                        "meta-window",         window,
-                       "x-window",            top_window,
                        "meta-screen",         screen,
                        NULL);
 
@@ -1780,8 +1733,10 @@ check_needs_pixmap (MetaWindowActor *self)
   MetaDisplay         *display  = meta_screen_get_display (screen);
   Display             *xdisplay = meta_display_get_xdisplay (display);
   MetaCompScreen      *info     = meta_screen_get_compositor_data (screen);
+  MetaWindow          *window   = meta_window_actor_get_meta_window (self);
+  MetaFrame           *frame    = meta_window_get_frame (window);
   MetaCompositor      *compositor;
-  Window               xwindow  = priv->xwindow;
+  Window               xwindow;
 
   if (!priv->needs_pixmap)
     return;
@@ -1789,6 +1744,11 @@ check_needs_pixmap (MetaWindowActor *self)
   if (!priv->mapped)
     return;
 
+  if (frame)
+    xwindow = meta_frame_get_xwindow (frame);
+  else
+    xwindow = meta_window_get_xwindow (window);
+
   if (xwindow == meta_screen_get_xroot (screen) ||
       xwindow == clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage)))
     return;



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