From 8f5a0ec83daf135b91d5fce44db5da7862958f7a Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Fri, 11 Nov 2016 17:46:49 +0100 Subject: [PATCH] constraints: Make zero sized windows be placed in the correct monitor Wayland windows can be zero sized until clients attach a buffer, but our rectangle code doesn't deal with this case well, in particular, meta_screen_get_monitor_for_rect() might end up choosing the wrong monitor for a zero sized rectangle since meta_rectangle_contains_rect() considers a zero sized rectangle at the right or bottom edges of another rectangle (the monitor's) to be contained there. Since out size limits constraint will enforce a minimum size of 1x1, we might as well enforce that when setting up the constraint info so that the correct monitor gets chosen and the single monitor constraint doesn't move these windows to the wrong one. https://bugzilla.gnome.org/show_bug.cgi?id=772525 --- src/core/constraints.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/constraints.c b/src/core/constraints.c index 281fdddb8..14044a957 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -340,6 +340,11 @@ setup_constraint_info (ConstraintInfo *info, info->orig = *orig; info->current = *new; + if (info->current.width < 1) + info->current.width = 1; + if (info->current.height < 1) + info->current.height = 1; + if (flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_RESIZE_ACTION) info->action_type = ACTION_MOVE_AND_RESIZE; else if (flags & META_MOVE_RESIZE_RESIZE_ACTION)