frame: Don't allow resizing of edges that are constrained

https://bugzilla.gnome.org/show_bug.cgi?id=751857
This commit is contained in:
Jasper St. Pierre 2015-06-30 22:14:03 -07:00
parent 50e3e3b929
commit 8a481b3e10
3 changed files with 25 additions and 6 deletions

View File

@ -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;
}

View File

@ -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;
/**

View File

@ -94,19 +94,22 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
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);
if (!(flags & META_FRAME_CONSTRAINED_LEFT_EDGE))
borders->invisible.left = MAX (0, draggable_borders - borders->visible.left);
if (!(flags & META_FRAME_CONSTRAINED_RIGHT_EDGE))
borders->invisible.right = MAX (0, draggable_borders - borders->visible.right);
}
if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
{
borders->invisible.bottom = MAX (0, 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 (0, draggable_borders - 2);
if (!(flags & META_FRAME_CONSTRAINED_BOTTOM_EDGE))
borders->invisible.bottom = MAX (0, draggable_borders - borders->visible.bottom);
}
borders->total.left = borders->invisible.left + borders->visible.left;