[mutter] constraints: Make zero sized windows be placed in the correct monitor



commit 8f5a0ec83daf135b91d5fce44db5da7862958f7a
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri Nov 11 17:46:49 2016 +0100

    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 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 281fddd..14044a9 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]