diff options
author | Florian Müllner <fmuellner@gnome.org> | 2016-01-20 18:01:41 +0100 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2016-01-20 18:25:16 +0100 |
commit | e0b22cab4c8c797eb3e8337dc72459e0198bf119 (patch) | |
tree | bea8ac67eb9315c2028ab371a45859be9b56d75c | |
parent | 5ef7363a742ce841a9b8fc399e1fe10602d3c605 (diff) | |
download | mutter-wip/fmuellner/theme-updates.tar.gz |
theme: Take invisible borders required by the theme into accountwip/fmuellner/theme-updates
GTK+ paints some elements like box shadows (which Adwaita likes to (ab)use
for borders) outside the rectangle passed to gtk_render_*. This is not
an issue if our own invisible frame border is big enough, but in case
of non-resizable windows we end up clipping away part of the decoration.
Use the newly added gtk_render_background_get_clip() to make sure we
always use a mask that is large enough to contain all decorations.
-rw-r--r-- | src/ui/theme-private.h | 2 | ||||
-rw-r--r-- | src/ui/theme.c | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h index 3ebe06b2e..eaee95d10 100644 --- a/src/ui/theme-private.h +++ b/src/ui/theme-private.h @@ -53,6 +53,8 @@ typedef struct _MetaFrameGeometry MetaFrameGeometry; **/ struct _MetaFrameLayout { + /** Invisible border required by the theme */ + GtkBorder invisible_border; /** Border/padding of the entire frame */ GtkBorder frame_border; /** Border/padding of the titlebar region */ diff --git a/src/ui/theme.c b/src/ui/theme.c index 04b235a7d..4c62915cc 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -94,23 +94,28 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout, borders->visible.right = layout->frame_border.right; borders->visible.bottom = layout->frame_border.bottom; + borders->invisible = layout->invisible_border; + draggable_borders = meta_prefs_get_draggable_border_width (); if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) { - borders->invisible.left = MAX (0, draggable_borders - borders->visible.left); - borders->invisible.right = MAX (0, draggable_borders - borders->visible.right); + borders->invisible.left = MAX (borders->invisible.left, + draggable_borders - borders->visible.left); + borders->invisible.right = MAX (borders->invisible.right, + draggable_borders - borders->visible.right); } if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) { - borders->invisible.bottom = MAX (0, draggable_borders - borders->visible.bottom); + borders->invisible.bottom = MAX (borders->invisible.bottom, + draggable_borders - borders->visible.bottom); /* borders.visible.top is the height of the *title bar*. We can't do the same * algorithm here, titlebars are expectedly much bigger. Just subtract a couple * pixels to get a proper feel. */ if (type != META_FRAME_TYPE_ATTACHED) - borders->invisible.top = MAX (0, draggable_borders - 2); + borders->invisible.top = MAX (borders->invisible.top, draggable_borders - 2); } borders->total.left = borders->invisible.left + borders->visible.left; @@ -266,6 +271,7 @@ meta_frame_layout_sync_with_style (MetaFrameLayout *layout, GtkStyleContext *style; GtkBorder border; GtkRequisition requisition; + GdkRectangle clip_rect; int border_radius, max_radius; meta_style_info_set_flags (style_info, flags); @@ -274,6 +280,12 @@ meta_frame_layout_sync_with_style (MetaFrameLayout *layout, get_padding_and_border (style, &layout->frame_border); scale_border (&layout->frame_border, layout->title_scale); + gtk_render_background_get_clip (style, 0, 0, 0, 0, &clip_rect); + layout->invisible_border.left = -clip_rect.x; + layout->invisible_border.right = clip_rect.width + clip_rect.x; + layout->invisible_border.top = -clip_rect.y; + layout->invisible_border.bottom = clip_rect.height + clip_rect.y; + if (layout->hide_buttons) layout->icon_size = 0; |