[mutter/wip/fmuellner/contraint-tiling: 11/14] window: Also consider touching edges for matching tiled windows



commit 5a95e5c80a20f6ee9e8f385d74e27bfe89f39253
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jun 15 21:29:48 2017 -0300

    window: Also consider touching edges for matching tiled windows
    
    When computing a potential match for a tiled window, there is a
    chance we face the case where 2 windows really complement each
    other's tile mode (i.e. left and right) but they have different
    sizes, and their borders don't really touch each other.
    
    In that case, the current code would mistakenly assume they're
    tile matches, and would resize them with either a hole or an
    overlapping area between windows. This is clearly a misbehavior
    that is a consequence of the previous assumptions pre-resizable
    tiles.
    
    This patch adapts the tile match algorithm to also consider the
    touching edges when computing the matching tile, unless:
    
     * the window is not currently tiled (for example when computing
       the tile preview)
     * the window is currently resized in tandem with an existing
       tile match
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645153
    
    bar

 src/core/window.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 0cfbe2b..64d654a 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -7682,6 +7682,23 @@ meta_window_find_tile_match (MetaWindow   *window,
 
       meta_window_get_frame_rect (bottommost, &bottommost_rect);
       meta_window_get_frame_rect (topmost, &topmost_rect);
+
+      /*
+       * If we are looking for a tile match while actually being tiled,
+       * rather than a match for a potential tile mode, then discard
+       * windows with too much gap or overlap
+       */
+      if (window->tile_mode == current_mode &&
+          !(meta_grab_op_is_resizing (window->display->grab_op) &&
+            window->display->grab_window == window &&
+            window->tile_match != NULL))
+        {
+          int threshold = meta_prefs_get_drag_threshold ();
+          if (ABS (topmost_rect.x - bottommost_rect.x - bottommost_rect.width) > threshold &&
+              ABS (bottommost_rect.x - topmost_rect.x - topmost_rect.width) > threshold)
+            return NULL;
+        }
+
       /*
        * If there's a window stacked in between which is partially visible
        * behind the topmost tile we don't consider the tiles to match.


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