diff options
author | Victor Kareh <[email protected]> | 2019-04-12 07:58:30 -0400 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2019-06-05 10:49:37 -0400 |
commit | c66b32666e48996b97e691ed002f86b6ff18dec5 (patch) | |
tree | 3e5d1b07331ab708cac920fcfe62e504aa2481ad /src/ui/preview-widget.c | |
parent | 707eb409e7dfeec276f6dfa3e667a0140b3300aa (diff) | |
download | marco-c66b32666e48996b97e691ed002f86b6ff18dec5.tar.bz2 marco-c66b32666e48996b97e691ed002f86b6ff18dec5.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/preview-widget.c')
-rw-r--r-- | src/ui/preview-widget.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c index 50f42b61..6c819707 100644 --- a/src/ui/preview-widget.c +++ b/src/ui/preview-widget.c @@ -98,10 +98,10 @@ meta_preview_init (MetaPreview *preview) META_FRAME_ALLOWS_SHADE | META_FRAME_ALLOWS_MOVE; - preview->left_width = -1; - preview->right_width = -1; - preview->top_height = -1; - preview->bottom_height = -1; + preview->borders.visible.left = -1; + preview->borders.visible.right = -1; + preview->borders.visible.top = -1; + preview->borders.visible.bottom = -1; } GtkWidget* @@ -172,7 +172,7 @@ ensure_info (MetaPreview *preview) pango_font_description_free (font_desc); } - if (preview->top_height < 0) + if (preview->borders.visible.top < 0) { if (preview->theme) { @@ -180,17 +180,14 @@ ensure_info (MetaPreview *preview) preview->type, preview->text_height, preview->flags, - &preview->top_height, - &preview->bottom_height, - &preview->left_width, - &preview->right_width); + &preview->borders); } else { - preview->top_height = 0; - preview->bottom_height = 0; - preview->left_width = 0; - preview->right_width = 0; + preview->borders.visible.top = 0; + preview->borders.visible.bottom = 0; + preview->borders.visible.left = 0; + preview->borders.visible.right = 0; } } } @@ -223,8 +220,8 @@ meta_preview_draw (GtkWidget *widget, border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); gtk_widget_get_allocation (widget, &allocation); - client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2; - client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2; + client_width = allocation.width - preview->borders.visible.left - preview->borders.visible.right - border_width * 2; + client_height = allocation.height - preview->borders.visible.top - preview->borders.visible.bottom - border_width * 2; if (client_width < 0) client_width = 1; @@ -266,7 +263,7 @@ meta_preview_get_preferred_width (GtkWidget *widget, ensure_info (preview); - *minimum = *natural = preview->left_width + preview->right_width; + *minimum = *natural = preview->borders.visible.left + preview->borders.visible.right; child = gtk_bin_get_child (GTK_BIN (preview)); if (child && gtk_widget_get_visible (child)) @@ -302,7 +299,7 @@ meta_preview_get_preferred_height (GtkWidget *widget, ensure_info (preview); - *minimum = *natural = preview->top_height + preview->bottom_height; + *minimum = *natural = preview->borders.visible.top + preview->borders.visible.bottom; child = gtk_bin_get_child (GTK_BIN (preview)); if (child && gtk_widget_get_visible (child)) @@ -347,11 +344,11 @@ meta_preview_size_allocate (GtkWidget *widget, gtk_widget_get_visible (child)) { gtk_widget_get_allocation (widget, &widget_allocation); - child_allocation.x = widget_allocation.x + border_width + preview->left_width; - child_allocation.y = widget_allocation.y + border_width + preview->top_height; + child_allocation.x = widget_allocation.x + border_width + preview->borders.visible.left; + child_allocation.y = widget_allocation.y + border_width + preview->borders.visible.top; - child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->left_width - preview->right_width); - child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->top_height - preview->bottom_height); + child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->borders.visible.left - preview->borders.visible.right); + child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->borders.visible.top - preview->borders.visible.bottom); gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), &child_allocation); } } @@ -365,10 +362,10 @@ clear_cache (MetaPreview *preview) preview->layout = NULL; } - preview->left_width = -1; - preview->right_width = -1; - preview->top_height = -1; - preview->bottom_height = -1; + preview->borders.visible.left = -1; + preview->borders.visible.right = -1; + preview->borders.visible.top = -1; + preview->borders.visible.bottom = -1; } void |