ratpoison-devel
[Top][All Lists]
Advanced

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

[RP] [PATCH] Fix: check frame overlap in find_frame_left, find_frame_rig


From: Antoine Busque
Subject: [RP] [PATCH] Fix: check frame overlap in find_frame_left, find_frame_right
Date: Mon, 26 Jun 2017 18:04:19 -0400

When compared with the existing overlap check in
`find_frame_{up,down}`, it appears that the original implementation of
the overlap test for `find_frame_{left,right}` is erroneous. Indeed,
the wrong boundaries are used, which causes issues like allowing
finding a frame in one direction, but not finding the frame when going
back in the reverse direction.

Commands like `focus{left,right}` rely on the corresponding
`find_frame` function. The original boundaries check issue meant that,
on differently sized screens, focus could pass from one screen to the
next in one direction, but not in the other.

The boundary checks have therefore been corrected to mirror those in
`find_frame_{up,down}`, and check for actual overlap between the
frames.

Signed-off-by: Antoine Busque <address@hidden>
---
 src/split.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/split.c b/src/split.c
index a9d69cd..98c0cda 100644
--- a/src/split.c
+++ b/src/split.c
@@ -1046,7 +1046,7 @@ find_frame_left (rp_frame *frame)
       list_for_each_entry (cur, &s->frames, node)
         {
           if (frame_left_abs (frame) == frame_right_abs (cur))
-            if (frame_top_abs (frame) >= frame_top_abs (cur) && frame_top_abs 
(frame) < frame_bottom_abs (cur))
+            if (frame_bottom_abs (frame) >= frame_top_abs (cur) && 
frame_top_abs (frame) <= frame_bottom_abs (cur))
               return cur;
         }
     }
@@ -1065,7 +1065,7 @@ find_frame_right (rp_frame *frame)
       list_for_each_entry (cur, &s->frames, node)
         {
           if (frame_right_abs (frame) == frame_left_abs (cur))
-            if (frame_top_abs (frame) >= frame_top_abs (cur) && frame_top_abs 
(frame) < frame_bottom_abs (cur))
+            if (frame_bottom_abs (frame) >= frame_top_abs (cur) && 
frame_top_abs (frame) <= frame_bottom_abs (cur))
               return cur;
         }
     }
-- 
2.13.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]