Closed agausmann closed 6 years ago
Unfortunately, I don't have enough knowledge of the code structure to track down where this is, and attempting to use git bisect
reveals that my current version of wlc
is not backwards-compatible... If someone else could help me find the offending lines, I would greatly appreciate it!
My guess is that either sway_container.visible
is not checked in these circumstances, or it is not updated properly when the container goes out of focus inside of a stacked/tabbed container.
I've spent some time studying the code and I think I found the place causing part of this issue. In the functionswayc_border_check(*c, *origin)
(passed into container_find()
by handle_pointer_button()
where mouse clicks are used to update focus), there is no check to make sure c->visible == True
.
UPDATE: I just looked at the code where focus changes based on mouse motion (which does work in the given scenario). It is handled by the following series of calls: handle_mouse_motion()
-> pointer_position_set()
-> container_under_pointer()
. The last function there is actually what determines which container will receive focus, where it handles stacked and tabbed containers as special cases. It does not use the visible
field at all, nor does it need to. It just unwraps the tab that is currently selected inside the container and continues execution.
Now I'm not sure whether visible
is the correct field to use, however, I don't see any reason why it shouldn't be used in this case. Setting it for containers within tabs and stacks may actually solve additional issues that have not been found.
Sounds like you're ready to submit a patch?
Working on the patch now. Notes in the meantime:
I was mistaken, visible
was already set correctly in the case of tabs by update_visibility()
. Simply adding a check in swayc_border_check()
resolves that issue.
Additional details on the other erroneus behavior that I had found: Tabbed containers with a container as a child will handle their entire tab bar as the tab of the focused window, whether it be a view or a container. Clicking anywhere on the tab bar only attempts to focus the currently focused child. Additionally, when focusing the child container, the container is focused and all children are updated to match (blue title bar). The parent container's tab color does not update to match its focused state. I suspect these issues have to do with the title bar's geometry set by update_geometry()
Turns out the issue is far more complicated than a single line patch. Tabs which are out of focus have their visible
flag set to false, meaning that clicking their title bars/tabs does not work. Title bar visibility is not the same as full container visibility. This may be fixed by checking the parent container's visibility instead.
Okay, I'm submitting what I have right now; however, containers are far more broken than I've outlined here. The title bars are honestly completely screwed up, and I don't even know where to start with those.
Yeah we'll be rewriting the whole title bar thing soon.
I'm closing issues that are resolved by the yet-unreleased sway 1.0.
Steps to reproduce
(I have done these steps multiple times with various applications)
$mod+w
/$mod+s
- this will be called "parent container".$mod+v
/$mod+b
/$mod+w
/$mod+s
Problems
After performing the steps above, clicking on the child container's tab has no effect, and clicking in the title bar regions of the child container's windows (even when the child container is not in focus) will switch focus to that window.
I have also confirmed that this occurs with any number of tabs in the parent container. There can be any number of "child containers", they all will have this issue. The example above demonstrates the issue with more than 1 window in the child container, but 1 window also works fine.
Additional information
I am running Arch Linux
Linux exams 4.13.12-1-ARCH #1 SMP PREEMPT Wed Nov 8 11:54:06 CET 2017 x86_64 GNU/Linux
, using the officially distributed package for sway 0.15.0-1.