[mutter] window: Make border_width private to X11



commit e215c07439e94c00aa07dc822622431d7699b292
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue May 20 09:19:10 2014 -0400

    window: Make border_width private to X11

 src/core/window-private.h    |    2 --
 src/core/window.c            |    3 +--
 src/x11/window-x11-private.h |    3 +++
 src/x11/window-x11.c         |   33 ++++++++++++++++++++++++---------
 4 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 4a9f8ff..723be33 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -432,8 +432,6 @@ struct _MetaWindow
   /* Cached net_wm_icon_geometry */
   MetaRectangle icon_geometry;
 
-  /* Requested geometry */
-  int border_width;
   /* x/y/w/h here get filled with ConfigureRequest values */
   XSizeHints size_hints;
 
diff --git a/src/core/window.c b/src/core/window.c
index 79853f5..bac4f03 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -828,8 +828,7 @@ _meta_window_shared_new (MetaDisplay         *display,
   window->rect.width = attrs->width;
   window->rect.height = attrs->height;
 
-  /* And border width, size_hints are the "request" */
-  window->border_width = attrs->border_width;
+  /* size_hints are the "request" */
   window->size_hints.x = attrs->x;
   window->size_hints.y = attrs->y;
   window->size_hints.width = attrs->width;
diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h
index 9afbe8c..9062312 100644
--- a/src/x11/window-x11-private.h
+++ b/src/x11/window-x11-private.h
@@ -51,6 +51,9 @@ struct _MetaWindowX11Private
 
   Atom type_atom;
 
+  /* Requested geometry */
+  int border_width;
+
   MetaResizePopup *grab_resize_popup;
 };
 
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 1fb93f6..c24e26e 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -200,6 +200,8 @@ update_sm_hints (MetaWindow *window)
 static void
 send_configure_notify (MetaWindow *window)
 {
+  MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
+  MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
   XEvent event;
 
   /* from twm */
@@ -208,8 +210,8 @@ send_configure_notify (MetaWindow *window)
   event.xconfigure.display = window->display->xdisplay;
   event.xconfigure.event = window->xwindow;
   event.xconfigure.window = window->xwindow;
-  event.xconfigure.x = window->rect.x - window->border_width;
-  event.xconfigure.y = window->rect.y - window->border_width;
+  event.xconfigure.x = window->rect.x - priv->border_width;
+  event.xconfigure.y = window->rect.y - priv->border_width;
   if (window->frame)
     {
       if (window->withdrawn)
@@ -233,7 +235,7 @@ send_configure_notify (MetaWindow *window)
     }
   event.xconfigure.width = window->rect.width;
   event.xconfigure.height = window->rect.height;
-  event.xconfigure.border_width = window->border_width; /* requested not actual */
+  event.xconfigure.border_width = priv->border_width; /* requested not actual */
   event.xconfigure.above = None; /* FIXME */
   event.xconfigure.override_redirect = False;
 
@@ -256,6 +258,8 @@ adjust_for_gravity (MetaWindow        *window,
                     int                gravity,
                     MetaRectangle     *rect)
 {
+  MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
+  MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
   int ref_x, ref_y;
   int bw;
   int child_x, child_y;
@@ -263,7 +267,7 @@ adjust_for_gravity (MetaWindow        *window,
   MetaFrameBorders borders;
 
   if (coords_assume_border)
-    bw = window->border_width;
+    bw = priv->border_width;
   else
     bw = 0;
 
@@ -550,6 +554,9 @@ meta_window_x11_manage (MetaWindow *window)
 static void
 meta_window_x11_unmanage (MetaWindow *window)
 {
+  MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
+  MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
+
   meta_error_trap_push (window->display);
 
   meta_window_x11_destroy_sync_request_alarm (window);
@@ -593,10 +600,10 @@ meta_window_x11_unmanage (MetaWindow *window)
   meta_display_unregister_x_window (window->display, window->xwindow);
 
   /* Put back anything we messed up */
-  if (window->border_width != 0)
+  if (priv->border_width != 0)
     XSetWindowBorderWidth (window->display->xdisplay,
                            window->xwindow,
-                           window->border_width);
+                           priv->border_width);
 
   /* No save set */
   XRemoveFromSaveSet (window->display->xdisplay,
@@ -1157,7 +1164,7 @@ meta_window_x11_move_resize_internal (MetaWindow                *window,
   if  (is_configure_request &&
        !(need_move_client || need_move_frame ||
          need_resize_client || need_resize_frame ||
-         window->border_width != 0))
+         priv->border_width != 0))
     need_configure_notify = TRUE;
 
   /* We must send configure notify if we move but don't resize, since
@@ -1218,7 +1225,7 @@ meta_window_x11_move_resize_internal (MetaWindow                *window,
   values.height = window->rect.height;
 
   mask = 0;
-  if (is_configure_request && window->border_width != 0)
+  if (is_configure_request && priv->border_width != 0)
     mask |= CWBorderWidth; /* must force to 0 */
   if (need_move_client)
     mask |= (CWX | CWY);
@@ -2126,6 +2133,9 @@ gboolean
 meta_window_x11_configure_request (MetaWindow *window,
                                    XEvent     *event)
 {
+  MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
+  MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
+
   /* Note that x, y is the corner of the window border,
    * and width, height is the size of the window inside
    * its border, but that we always deny border requests
@@ -2133,7 +2143,7 @@ meta_window_x11_configure_request (MetaWindow *window,
    * requested border here.
    */
   if (event->xconfigurerequest.value_mask & CWBorderWidth)
-    window->border_width = event->xconfigurerequest.border_width;
+    priv->border_width = event->xconfigurerequest.border_width;
 
   meta_window_move_resize_request(window,
                                   event->xconfigurerequest.value_mask,
@@ -3069,6 +3079,11 @@ meta_window_x11_new (MetaDisplay       *display,
                                     effect,
                                     &attrs);
 
+  MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
+  MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
+
+  priv->border_width = attrs.border_width;
+
   meta_window_grab_keys (window);
   if (window->type != META_WINDOW_DOCK && !window->override_redirect)
     {


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