ratpoison-devel
[Top][All Lists]
Advanced

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

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


From: Jeremie Courreges-Anglas
Subject: Re: [RP] [PATCH] Fix: check frame overlap in find_frame_left, find_frame_right
Date: Tue, 04 Jul 2017 06:14:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (berkeley-unix)

Antoine Busque <address@hidden> writes:

> 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.

At first sight it looks right, but I could use additional eyes here.
Pedro, Joseph, any opinion?

Thanks,

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

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



reply via email to

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