diff options
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 6dc4691c..1db34950 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; @@ -268,7 +265,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)) @@ -304,7 +301,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)) @@ -349,11 +346,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); } } @@ -367,10 +364,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 |