[mutter/bilelmoussaoui/gdk-x11-only: 15/23] core: Add a in-tree copy of GtkBorder




commit 51a25f36866e1881c09d3e9f1c92524af3f5cd11
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Mon May 9 11:24:23 2022 +0200

    core: Add a in-tree copy of GtkBorder

 src/core/window-private.h |  2 +-
 src/core/window.c         |  4 ++--
 src/meta/common.h         | 21 ++++++++++++++++++---
 src/ui/theme-private.h    |  2 +-
 src/ui/theme.c            | 10 +++++-----
 src/x11/window-props.c    | 10 +++++-----
 6 files changed, 32 insertions(+), 17 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 8d2d4a0203..c8d2e2a623 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -479,7 +479,7 @@ struct _MetaWindow
   Window user_time_window;
 
   gboolean has_custom_frame_extents;
-  GtkBorder custom_frame_extents;
+  MetaFrameBorder custom_frame_extents;
 
   /* The rectangles here are in "frame rect" coordinates. See the
    * comment at the top of meta_window_move_resize_internal() for more
diff --git a/src/core/window.c b/src/core/window.c
index 95a8e33e04..5e71df7c71 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4307,7 +4307,7 @@ meta_window_client_rect_to_frame_rect (MetaWindow    *window,
     }
   else
     {
-      const GtkBorder *extents = &window->custom_frame_extents;
+      const MetaFrameBorder *extents = &window->custom_frame_extents;
       frame_rect->x += extents->left;
       frame_rect->y += extents->top;
       if (frame_rect->width != G_MAXINT)
@@ -4348,7 +4348,7 @@ meta_window_frame_rect_to_client_rect (MetaWindow    *window,
     }
   else
     {
-      const GtkBorder *extents = &window->custom_frame_extents;
+      const MetaFrameBorder *extents = &window->custom_frame_extents;
       client_rect->x -= extents->left;
       client_rect->y -= extents->top;
       client_rect->width += extents->left + extents->right;
diff --git a/src/meta/common.h b/src/meta/common.h
index 5984b1729e..d1f5caddd3 100644
--- a/src/meta/common.h
+++ b/src/meta/common.h
@@ -418,6 +418,21 @@ typedef enum
   META_WINDOW_MENU_APP
 } MetaWindowMenuType;
 
+/**
+ * MetaFrameBorder:
+ * @left: left border
+ * @right: right border
+ * @top: top border
+ * @bottom: bottom border
+ */
+typedef struct _MetaFrameBorder
+{
+  int16_t left;
+  int16_t right;
+  int16_t top;
+  int16_t bottom;
+} MetaFrameBorder;
+
 /**
  * MetaFrameBorders:
  * @visible: inner visible portion of frame border
@@ -430,12 +445,12 @@ struct _MetaFrameBorders
   /* The frame border is made up of two pieces - an inner visible portion
    * and an outer portion that is invisible but responds to events.
    */
-  GtkBorder visible;
-  GtkBorder invisible;
+  MetaFrameBorder visible;
+  MetaFrameBorder invisible;
 
   /* For convenience, we have a "total" border which is equal to the sum
    * of the two borders above. */
-  GtkBorder total;
+  MetaFrameBorder total;
 };
 
 /* sets all dimensions to zero */
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
index 269dbe8670..4b225e7924 100644
--- a/src/ui/theme-private.h
+++ b/src/ui/theme-private.h
@@ -124,7 +124,7 @@ struct _MetaFrameGeometry
 
   GdkRectangle title_rect;
 
-  GtkBorder content_border;
+  MetaFrameBorder content_border;
 
   /* used for a memset hack */
 #define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
diff --git a/src/ui/theme.c b/src/ui/theme.c
index a4c8a0de29..0a2dc07774 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -94,7 +94,7 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
   borders->visible.right  = layout->frame_border.right;
   borders->visible.bottom = layout->frame_border.bottom;
 
-  borders->invisible = layout->invisible_border;
+  borders->invisible = *((MetaFrameBorder *)&layout->invisible_border);
 
   draggable_borders = meta_prefs_get_draggable_border_width ();
 
@@ -124,9 +124,9 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
   borders->total.top    = borders->invisible.top    + borders->visible.top;
 
   /* Scale geometry for HiDPI, see comment in meta_frame_layout_draw_with_style() */
-  scale_border (&borders->visible, scale);
-  scale_border (&borders->invisible, scale);
-  scale_border (&borders->total, scale);
+  scale_border ((GtkBorder *)&borders->visible, scale);
+  scale_border ((GtkBorder *)&borders->invisible, scale);
+  scale_border ((GtkBorder *)&borders->total, scale);
 }
 
 int
@@ -384,7 +384,7 @@ meta_frame_layout_calc_geometry (MetaFrameLayout        *layout,
   fgeom->borders = borders;
 
   /* Scale geometry for HiDPI, see comment in meta_frame_layout_draw_with_style() */
-  fgeom->content_border = layout->frame_border;
+  fgeom->content_border = *((MetaFrameBorder *)&layout->frame_border);
   fgeom->content_border.left   += layout->titlebar_border.left * scale;
   fgeom->content_border.right  += layout->titlebar_border.right * scale;
   fgeom->content_border.top    += layout->titlebar_border.top * scale;
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index aa4fab99cd..1b01630ab0 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -346,14 +346,14 @@ reload_icon_geometry (MetaWindow    *window,
 }
 
 static void
-meta_window_set_custom_frame_extents (MetaWindow *window,
-                                      GtkBorder  *extents,
-                                      gboolean    is_initial)
+meta_window_set_custom_frame_extents (MetaWindow       *window,
+                                      MetaFrameBorder  *extents,
+                                      gboolean          is_initial)
 {
   if (extents)
     {
       if (window->has_custom_frame_extents &&
-          memcmp (&window->custom_frame_extents, extents, sizeof (GtkBorder)) == 0)
+          memcmp (&window->custom_frame_extents, extents, sizeof (MetaFrameBorder)) == 0)
         return;
 
       window->has_custom_frame_extents = TRUE;
@@ -396,7 +396,7 @@ reload_gtk_frame_extents (MetaWindow    *window,
         }
       else
         {
-          GtkBorder extents;
+          MetaFrameBorder extents;
           extents.left   = (int)value->v.cardinal_list.cardinals[0];
           extents.right  = (int)value->v.cardinal_list.cardinals[1];
           extents.top    = (int)value->v.cardinal_list.cardinals[2];


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