diff options
author | Bilal Elmoussaoui <belmouss@redhat.com> | 2022-05-09 11:24:23 +0200 |
---|---|---|
committer | Bilal Elmoussaoui <belmouss@redhat.com> | 2022-12-22 15:13:54 +0100 |
commit | 64ee8d02f7eae5db3974803cfa20cf086f961314 (patch) | |
tree | a7e55ed59c9818fa6c1ce339c8a0f84bcbdbd9cd | |
parent | b0b21e82748264385ab97b7726f14ac7ed7a5ad3 (diff) | |
download | mutter-64ee8d02f7eae5db3974803cfa20cf086f961314.tar.gz |
core: Add a in-tree copy of GtkBorder
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
-rw-r--r-- | src/core/frame.c | 6 | ||||
-rw-r--r-- | src/core/window-private.h | 2 | ||||
-rw-r--r-- | src/core/window.c | 4 | ||||
-rw-r--r-- | src/meta/common.h | 21 | ||||
-rw-r--r-- | src/wayland/meta-window-wayland.c | 2 | ||||
-rw-r--r-- | src/x11/window-props.c | 10 |
6 files changed, 30 insertions, 15 deletions
diff --git a/src/core/frame.c b/src/core/frame.c index 4fa5153a3..498cee010 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -345,7 +345,7 @@ meta_frame_query_borders (MetaFrame *frame, if (res == Success && nitems == 4) { - borders->invisible = (GtkBorder) { + borders->invisible = (MetaFrameBorder) { ((long *) data)[0], ((long *) data)[1], ((long *) data)[2], @@ -371,7 +371,7 @@ meta_frame_query_borders (MetaFrame *frame, if (res == Success && nitems == 4) { - borders->visible = (GtkBorder) { + borders->visible = (MetaFrameBorder) { ((long *) data)[0], ((long *) data)[1], ((long *) data)[2], @@ -381,7 +381,7 @@ meta_frame_query_borders (MetaFrame *frame, g_clear_pointer (&data, XFree); - borders->total = (GtkBorder) { + borders->total = (MetaFrameBorder) { borders->invisible.left + frame->cached_borders.visible.left, borders->invisible.right + frame->cached_borders.visible.right, borders->invisible.top + frame->cached_borders.visible.top, diff --git a/src/core/window-private.h b/src/core/window-private.h index 509862aca..0f7501607 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -278,7 +278,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 57511ed92..5f849b7fb 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -4354,7 +4354,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) @@ -4395,7 +4395,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 b02dc115f..65d7a9808 100644 --- a/src/meta/common.h +++ b/src/meta/common.h @@ -71,6 +71,21 @@ struct _MetaButtonLayout }; /** + * 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 * @invisible: outer invisible portion of frame border @@ -82,12 +97,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/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index 287b03dc1..d4ef5f86c 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -1163,7 +1163,7 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, } else { - window->custom_frame_extents = (GtkBorder) { 0 }; + window->custom_frame_extents = (MetaFrameBorder) { 0 }; } flags = META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE; diff --git a/src/x11/window-props.c b/src/x11/window-props.c index 4cf01daea..60910cebe 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -347,14 +347,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; @@ -397,7 +397,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]; |