From ea901abd61263b7618cae18abf49b42df38df4f3 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 30 Jun 2015 22:14:03 -0700 Subject: [PATCH] frame: Don't allow resizing of edges that are constrained https://bugzilla.gnome.org/show_bug.cgi?id=751857 --- src/core/frame.c | 12 ++++++++++++ src/meta/common.h | 6 +++++- src/ui/theme.c | 19 +++++++++++-------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/core/frame.c b/src/core/frame.c index c4be91a89..81e0e68bc 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -283,6 +283,18 @@ meta_frame_get_flags (MetaFrame *frame) if (frame->window->wm_state_above) flags |= META_FRAME_ABOVE; + if (frame->window->constrained_edges & META_DIRECTION_LEFT) + flags |= META_FRAME_CONSTRAINED_LEFT_EDGE; + + if (frame->window->constrained_edges & META_DIRECTION_RIGHT) + flags |= META_FRAME_CONSTRAINED_RIGHT_EDGE; + + if (frame->window->constrained_edges & META_DIRECTION_TOP) + flags |= META_FRAME_CONSTRAINED_TOP_EDGE; + + if (frame->window->constrained_edges & META_DIRECTION_BOTTOM) + flags |= META_FRAME_CONSTRAINED_BOTTOM_EDGE; + return flags; } diff --git a/src/meta/common.h b/src/meta/common.h index 4bcc67b9a..77d906b2f 100644 --- a/src/meta/common.h +++ b/src/meta/common.h @@ -83,7 +83,11 @@ typedef enum META_FRAME_IS_FLASHING = 1 << 14, META_FRAME_ABOVE = 1 << 15, META_FRAME_TILED_LEFT = 1 << 16, - META_FRAME_TILED_RIGHT = 1 << 17 + META_FRAME_TILED_RIGHT = 1 << 17, + META_FRAME_CONSTRAINED_LEFT_EDGE = 1 << 18, + META_FRAME_CONSTRAINED_RIGHT_EDGE = 1 << 19, + META_FRAME_CONSTRAINED_TOP_EDGE = 1 << 20, + META_FRAME_CONSTRAINED_BOTTOM_EDGE = 1 << 21, } MetaFrameFlags; /** diff --git a/src/ui/theme.c b/src/ui/theme.c index 0dbfdf6e0..c39035636 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -100,22 +100,25 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout, if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) { - 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_CONSTRAINED_LEFT_EDGE)) + borders->invisible.left = MAX (borders->invisible.left, + draggable_borders - borders->visible.left); + if (!(flags & META_FRAME_CONSTRAINED_RIGHT_EDGE)) + borders->invisible.right = MAX (borders->invisible.right, + draggable_borders - borders->visible.right); } if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) { - 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) + if (!(flags & META_FRAME_CONSTRAINED_TOP_EDGE) && type != META_FRAME_TYPE_ATTACHED) borders->invisible.top = MAX (borders->invisible.top, draggable_borders - 2); + + if (!(flags & META_FRAME_CONSTRAINED_BOTTOM_EDGE)) + borders->invisible.bottom = MAX (borders->invisible.bottom, + draggable_borders - borders->visible.bottom); } borders->total.left = borders->invisible.left + borders->visible.left;