[PATCH] Fix edge case for find_frame_[left, right, up, down] functions
Daniel Maturana <[email protected]> Fri, 24 May 2019 02:09:42 -0400
| Newsgroups | gmane.comp.window-managers.ratpoison.devel |
|---|---|
| Message-ID | <CAE=wXuWBdHeaWVcEDJgK0KKBKo0ceHOiHmf0WY7byactEEHCKA@mail.gmail.com> |
--00000000000010503e05899c0c76 Content-Type: text/plain; charset="UTF-8" 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 --00000000000010503e05899c0c76 Content-Type: text/x-patch; charset="US-ASCII"; name="fix_find_frame_x.patch" Content-Disposition: attachment; filename="fix_find_frame_x.patch" Content-Transfer-Encoding: base64 Content-ID: <f_jw1o9ozp0> X-Attachment-Id: f_jw1o9ozp0 ZGlmZiAtLWdpdCBhL3NyYy9zcGxpdC5jIGIvc3JjL3NwbGl0LmMKaW5kZXggZWVkMGY1MC4uYTY1 MmVhZiAxMDA2NDQKLS0tIGEvc3JjL3NwbGl0LmMKKysrIGIvc3JjL3NwbGl0LmMKQEAgLTEwMDUs OSArMTAwNSwxNCBAQCBmaW5kX2ZyYW1lX3VwIChycF9mcmFtZSAqZnJhbWUpCiB7CiAgIHJwX3Nj cmVlbiAqczsKICAgcnBfZnJhbWUgKmN1cjsKKyAgcnBfc2NyZWVuICpmcmFtZV9zOworCisgIGZy YW1lX3MgPSBmcmFtZXNfc2NyZWVuKGZyYW1lKTsKIAogICBsaXN0X2Zvcl9lYWN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29udGludWU7CiAgICAgICBsaXN0X2Zvcl9lYWNoX2Vu dHJ5IChjdXIsICZzLT5mcmFtZXMsIG5vZGUpCiAgICAgICAgIHsKICAgICAgICAgICBpZiAoZnJh bWVfbGVmdF9hYnMgKGZyYW1lKSA9PSBmcmFtZV9yaWdodF9hYnMgKGN1cikpCkBAIC0xMDYyLDkg KzEwNzcsMTQgQEAgZmluZF9mcmFtZV9yaWdodCAocnBfZnJhbWUgKmZyYW1lKQogewogICBycF9z Y3JlZW4gKnM7CiAgIHJwX2ZyYW1lICpjdXI7CisgIHJwX3NjcmVlbiAqZnJhbWVfczsKKworICBm cmFtZV9zID0gZnJhbWVzX3NjcmVlbihmcmFtZSk7CiAKICAgbGlzdF9mb3JfZWFjaF9lbnRyeSAo cywgJnJwX3NjcmVlbnMsIG5vZGUpCiAgICAgeworICAgICAgaWYgKHMgIT0gZnJhbWVfcykKKyAg ICAgICAgY29udGludWU7CiAgICAgICBsaXN0X2Zvcl9lYWNoX2VudHJ5IChjdXIsICZzLT5mcmFt ZXMsIG5vZGUpCiAgICAgICAgIHsKICAgICAgICAgICBpZiAoZnJhbWVfcmlnaHRfYWJzIChmcmFt ZSkgPT0gZnJhbWVfbGVmdF9hYnMgKGN1cikpCg== --00000000000010503e05899c0c76 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Ratpoison-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/ratpoison-devel --00000000000010503e05899c0c76--