summaryrefslogtreecommitdiff
path: root/src/ui/frames.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-04-12 07:58:30 -0400
committerraveit65 <[email protected]>2019-06-16 18:12:44 +0200
commitcfd49bdf68ef48fcd53a084c74626372fc169688 (patch)
tree4f20be7afc95f063f04bb6114a90c5aa7c650c6b /src/ui/frames.c
parent147a9bd1e56201bb93879627cd186c235e050ca4 (diff)
downloadmarco-cfd49bdf68ef48fcd53a084c74626372fc169688.tar.bz2
marco-cfd49bdf68ef48fcd53a084c74626372fc169688.tar.xz
Replace public MetaFrameGeometry with MetaFrameBorders
There were actually *two* MetaFrameGeometry structs: one in theme-private.h, one in frame.h. The latter public struct was populated by a mix of (void*) casting and int pointers, usually pulling directly from the data in the private struct. Remove the public struct, replace it with MetaFrameBorders and scrap all the pointer hacks to populate it, instead relying on both structs being used in common code. This commit should be relatively straightforward, and it should not do any tricky logic at all, just a sophisticated find and replace. https://bugzilla.gnome.org/show_bug.cgi?id=644930 upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/72224a165 NOTE: Patch copied from metacity and adapted for marco.
Diffstat (limited to 'src/ui/frames.c')
-rw-r--r--src/ui/frames.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 8e6eefd3..264e2373 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -668,10 +668,9 @@ meta_frames_lookup_window (MetaFrames *frames,
}
void
-meta_frames_get_geometry (MetaFrames *frames,
- Window xwindow,
- int *top_height, int *bottom_height,
- int *left_width, int *right_width)
+meta_frames_get_borders (MetaFrames *frames,
+ Window xwindow,
+ MetaFrameBorders *borders)
{
MetaFrameFlags flags;
MetaUIFrame *frame;
@@ -702,14 +701,13 @@ meta_frames_get_geometry (MetaFrames *frames,
type,
frame->text_height,
flags,
- top_height, bottom_height,
- left_width, right_width);
+ borders);
/* Scale frame geometry to ensure proper frame position */
- *top_height *= scale;
- *bottom_height *= scale;
- *left_width *= scale;
- *right_width *= scale;
+ borders->visible.top *= scale;
+ borders->visible.bottom *= scale;
+ borders->visible.left *= scale;
+ borders->visible.right *= scale;
}
#ifdef HAVE_SHAPE
@@ -2062,6 +2060,7 @@ populate_cache (MetaFrames *frames,
MetaUIFrame *frame)
{
int top, bottom, left, right;
+ MetaFrameBorders borders;
int width, height;
int frame_width, frame_height, screen_width, screen_height;
gint scale;
@@ -2092,7 +2091,12 @@ populate_cache (MetaFrames *frames,
frame_type,
frame->text_height,
frame_flags,
- &top, &bottom, &left, &right);
+ &borders);
+
+ top = borders.visible.top;
+ left = borders.visible.left;
+ right = borders.visible.right;
+ bottom = borders.visible.bottom;
pixels = get_cache (frames, frame);
scale = gdk_window_get_scale_factor (frame->window);
@@ -2197,6 +2201,7 @@ subtract_client_area (cairo_region_t *region, MetaUIFrame *frame)
GdkRectangle area;
MetaFrameFlags flags;
MetaFrameType type;
+ MetaFrameBorders borders;
cairo_region_t *tmp_region;
Display *display;
gint scale;
@@ -2212,13 +2217,13 @@ subtract_client_area (cairo_region_t *region, MetaUIFrame *frame)
META_CORE_GET_END);
meta_theme_get_frame_borders (meta_theme_get_current (),
- type, frame->text_height, flags,
- &area.x, NULL, &area.y, NULL);
+ type, frame->text_height, flags,
+ &borders);
area.width /= scale;
area.height /= scale;
- area.x /= scale;
- area.y /= scale;
+ area.x = borders.visible.left / scale;
+ area.y = borders.visible.top / scale;
tmp_region = cairo_region_create_rectangle (&area);
cairo_region_subtract (region, tmp_region);