[mutter/bilelmoussaoui/gdk-x11-only: 3/6] core: Add a in-tree copy of GtkBorder
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/bilelmoussaoui/gdk-x11-only: 3/6] core: Add a in-tree copy of GtkBorder
- Date: Mon, 9 May 2022 09:49:22 +0000 (UTC)
commit 22eb17aa63aa661e3462cc4aa2e27396ed8c0836
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/meta-border.h | 8 ++++++++
src/core/window-private.h | 3 ++-
src/core/window.c | 4 ++--
src/meta/common.h | 7 ++++---
src/ui/theme-private.h | 2 +-
src/ui/theme.c | 10 +++++-----
src/x11/window-props.c | 10 +++++-----
7 files changed, 27 insertions(+), 17 deletions(-)
---
diff --git a/src/core/meta-border.h b/src/core/meta-border.h
index dd76db5c99..650f630f89 100644
--- a/src/core/meta-border.h
+++ b/src/core/meta-border.h
@@ -35,6 +35,14 @@ typedef enum
META_BORDER_MOTION_DIRECTION_NEGATIVE_Y = 1 << 3,
} MetaBorderMotionDirection;
+typedef struct _MetaSimpleBorder
+{
+ gint16 left;
+ gint16 right;
+ gint16 top;
+ gint16 bottom;
+} MetaSimpleBorder;
+
typedef struct _MetaVector2
{
float x;
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 8d2d4a0203..e4b2528c12 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -38,6 +38,7 @@
#include "backends/meta-logical-monitor.h"
#include "clutter/clutter.h"
+#include "core/meta-border.h"
#include "core/stack.h"
#include "meta/compositor.h"
#include "meta/meta-close-dialog.h"
@@ -479,7 +480,7 @@ struct _MetaWindow
Window user_time_window;
gboolean has_custom_frame_extents;
- GtkBorder custom_frame_extents;
+ MetaSimpleBorder 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 e22bd5a0e3..03a19359a1 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4305,7 +4305,7 @@ meta_window_client_rect_to_frame_rect (MetaWindow *window,
}
else
{
- const GtkBorder *extents = &window->custom_frame_extents;
+ const MetaSimpleBorder *extents = &window->custom_frame_extents;
frame_rect->x += extents->left;
frame_rect->y += extents->top;
if (frame_rect->width != G_MAXINT)
@@ -4346,7 +4346,7 @@ meta_window_frame_rect_to_client_rect (MetaWindow *window,
}
else
{
- const GtkBorder *extents = &window->custom_frame_extents;
+ const MetaSimpleBorder *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..680cd8c554 100644
--- a/src/meta/common.h
+++ b/src/meta/common.h
@@ -31,6 +31,7 @@
#include <glib.h>
#include "clutter/clutter.h"
+#include "core/meta-border.h"
/**
* SECTION:common
@@ -430,12 +431,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;
+ MetaSimpleBorder visible;
+ MetaSimpleBorder invisible;
/* For convenience, we have a "total" border which is equal to the sum
* of the two borders above. */
- GtkBorder total;
+ MetaSimpleBorder total;
};
/* sets all dimensions to zero */
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
index 269dbe8670..ee3f4a0d93 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;
+ MetaSimpleBorder 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..933671a836 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 = *((MetaSimpleBorder *)&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 = *((MetaSimpleBorder *)&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..2e340c0669 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,
+ MetaSimpleBorder *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 (MetaSimpleBorder)) == 0)
return;
window->has_custom_frame_extents = TRUE;
@@ -396,7 +396,7 @@ reload_gtk_frame_extents (MetaWindow *window,
}
else
{
- GtkBorder extents;
+ MetaSimpleBorder 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]