Hi all, I've noticed what seems to a bug in the latest version (master
branch) of ratpoison.

When I have two identical screens, each of them with an identical
split (e.g., two screens with a horizontal split across the middle)
and I use the "focusdown"/"focusup" commands, the focus will often
change to the upper/lower frame, but to the opposite screen of the
currently focused frame. Looking at the source code, I can see that
the "find_frame_*" functions, e.g. "find_frame_down", don't check
whether the frame to be focused to belongs to the same screen as the
current frame, resulting in this behavior when the dimensions of the
frames are identical across the two screens (and at least for me, this
is a common scenario).

Here's a patch with a simple fix: check whether the candidate target
frame for the "find_frame_*" functions belongs to the same screen as
the current frame. For me this has fixed the issue. I didn't find this
addressed before in these archives, so apologies if it has been raised
before.
best,
Daniel
diff --git a/src/split.c b/src/split.c
index eed0f50..a652eaf 100644
--- a/src/split.c
+++ b/src/split.c
@@ -1005,9 +1005,14 @@ find_frame_up (rp_frame *frame)
 {
   rp_screen *s;
   rp_frame *cur;
+  rp_screen *frame_s;
+
+  frame_s = frames_screen(frame);
 
   list_for_each_entry (s, &rp_screens, node)
     {
+      if (s != frame_s)
+        continue;
       list_for_each_entry (cur, &s->frames, node)
         {
           if (frame_top_abs (frame) == frame_bottom_abs (cur))
@@ -1024,9 +1029,14 @@ find_frame_down (rp_frame *frame)
 {
   rp_screen *s;
   rp_frame *cur;
+  rp_screen *frame_s;
+
+  frame_s = frames_screen(frame);
 
   list_for_each_entry (s, &rp_screens, node)
     {
+      if (s != frame_s)
+        continue;
       list_for_each_entry (cur, &s->frames, node)
         {
           if (frame_bottom_abs (frame) == frame_top_abs (cur))
@@ -1043,9 +1053,14 @@ find_frame_left (rp_frame *frame)
 {
   rp_screen *s;
   rp_frame *cur;
+  rp_screen *frame_s;
+
+  frame_s = frames_screen(frame);
 
   list_for_each_entry (s, &rp_screens, node)
     {
+      if (s != frame_s)
+        continue;
       list_for_each_entry (cur, &s->frames, node)
         {
           if (frame_left_abs (frame) == frame_right_abs (cur))
@@ -1062,9 +1077,14 @@ find_frame_right (rp_frame *frame)
 {
   rp_screen *s;
   rp_frame *cur;
+  rp_screen *frame_s;
+
+  frame_s = frames_screen(frame);
 
   list_for_each_entry (s, &rp_screens, node)
     {
+      if (s != frame_s)
+        continue;
       list_for_each_entry (cur, &s->frames, node)
         {
           if (frame_right_abs (frame) == frame_left_abs (cur))
_______________________________________________
Ratpoison-devel mailing list
Ratpoison-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/ratpoison-devel

Reply via email to