summaryrefslogtreecommitdiff
path: root/src/ui/theme.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/theme.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/theme.c')
-rw-r--r--src/ui/theme.c83
1 files changed, 31 insertions, 52 deletions
diff --git a/src/ui/theme.c b/src/ui/theme.c
index a7368c92..20cf6913 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -405,10 +405,7 @@ void
meta_frame_layout_get_borders (const MetaFrameLayout *layout,
int text_height,
MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width)
+ MetaFrameBorders *borders)
{
int buttons_height, title_height;
@@ -423,34 +420,20 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
layout->title_vertical_pad +
layout->title_border.top + layout->title_border.bottom;
- if (top_height)
- {
- *top_height = MAX (buttons_height, title_height);
- }
-
- if (left_width)
- *left_width = layout->left_width;
- if (right_width)
- *right_width = layout->right_width;
-
- if (bottom_height)
- {
- if (flags & META_FRAME_SHADED)
- *bottom_height = 0;
- else
- *bottom_height = layout->bottom_height;
- }
+ borders->visible.top = MAX (buttons_height, title_height);
+ borders->visible.left = layout->left_width;
+ borders->visible.right = layout->right_width;
+ if (flags & META_FRAME_SHADED)
+ borders->visible.bottom = 0;
+ else
+ borders->visible.bottom = layout->bottom_height;
if (flags & META_FRAME_FULLSCREEN)
{
- if (top_height)
- *top_height = 0;
- if (bottom_height)
- *bottom_height = 0;
- if (left_width)
- *left_width = 0;
- if (right_width)
- *right_width = 0;
+ borders->visible.top = 0;
+ borders->visible.bottom = 0;
+ borders->visible.left = 0;
+ borders->visible.right = 0;
}
}
@@ -647,12 +630,16 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
GdkRectangle *right_bg_rects[MAX_BUTTONS_PER_CORNER];
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
+ MetaFrameBorders borders;
+
meta_frame_layout_get_borders (layout, text_height,
flags,
- &fgeom->top_height,
- &fgeom->bottom_height,
- &fgeom->left_width,
- &fgeom->right_width);
+ &borders);
+
+ fgeom->left_width = borders.visible.left;
+ fgeom->right_width = borders.visible.right;
+ fgeom->top_height = borders.visible.top;
+ fgeom->bottom_height = borders.visible.bottom;
width = client_width + fgeom->left_width + fgeom->right_width;
@@ -5659,30 +5646,23 @@ meta_theme_draw_frame_by_name (MetaTheme *theme,
}
void
-meta_theme_get_frame_borders (MetaTheme *theme,
- MetaFrameType type,
- int text_height,
- MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width)
+meta_theme_get_frame_borders (MetaTheme *theme,
+ MetaFrameType type,
+ int text_height,
+ MetaFrameFlags flags,
+ MetaFrameBorders *borders)
{
MetaFrameStyle *style;
g_return_if_fail (type < META_FRAME_TYPE_LAST);
- if (top_height)
- *top_height = 0;
- if (bottom_height)
- *bottom_height = 0;
- if (left_width)
- *left_width = 0;
- if (right_width)
- *right_width = 0;
-
style = theme_get_style (theme, type, flags);
+ borders->visible.top = 0;
+ borders->visible.left = 0;
+ borders->visible.right = 0;
+ borders->visible.bottom = 0;
+
/* Parser is not supposed to allow this currently */
if (style == NULL)
return;
@@ -5690,8 +5670,7 @@ meta_theme_get_frame_borders (MetaTheme *theme,
meta_frame_layout_get_borders (style->layout,
text_height,
flags,
- top_height, bottom_height,
- left_width, right_width);
+ borders);
}
void