-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: add/use wlr_xwayland_surface_offer_focus() #1142
base: master
Are you sure you want to change the base?
Conversation
This fixes an issue with qmpanel (probably lxqt-panel as well) running in XWayland mode, extremely similar to the recent waybar issue (#1131). The taskbar wants to raise/focus a window if it's not already active, otherwise minimize it. The logic breaks down if the panel itself gets focus. I'd be interested in how this affects other XWayland applications: good, bad, indifferent? Particularly if @kyak would be gracious enough to test it with MATLAB and log the debug output, that would be helpful. |
Edit: Woops, looked at the wrong branch, sorry for the noise. |
The wlroots branch is 0.16.2 + one commit, not 0.17 though. |
Yep, just recognized. Disregard my comment :) |
To be honest i never even tried to use those panels in XWayland mode. I see
|
@jlindgren90 I get this error during build:
|
@kyak That's odd, I haven't seen that error before. You could also install that branch of wlroots separately. |
Menus/popups not closing automatically is an issue with XWayland views in general. They expect to be able to observe clicks elsewhere, which only works if you click on another XWayland view -- not a native Wayland view or the desktop. I have some ideas how to solve that, nothing definite yet though. |
The only xwayland app I have to use is element-desktop and menus from menu bars are closing fine here. Also falkon in xwayland mode closes fine its settings I see, so there is some other factor involved probably. |
I have seen both GTK and Qt apps affected. Haven't tested either of the ones you mentioned. |
At the moment, I run just about everything in XWayland due to basic features like window positioning not working under native Wayland (support is missing from xdg-shell protocol entirely and you have to use layer-shell, but many apps don't support layer-shell well or at all). |
That sounds like a setting / meson command arg from the PKGBUILD (or your distro's variant of a build script). |
Yep, that's from arch-meson, thanks! |
Regarding the PR relying on a change to wlroots 0.16: I don't think a API change like this (even if its just an addition) will be allowed into the 0.16 branch of wlroots. I think we could theoretically copy over |
I agree, the wlroots change would go into 0.17, not 0.16. The experimental wlroots branch was based on 0.16 just for the sake of testing (to avoid dealing with other 0.17 changes/issues). The actual change cherry-picks fine to 0.17 without conflicts. |
@jlindgren90 here is the log: labwc.log I'd say, it works somewhat better. For example, the popup menu doesn't disappear now. Although I can't click anything in the menu - it's like this popup never gets focus. |
Thanks for testing! An unfocusable popup might be an issue with how we handle "unmanaged" (override-redirect) XWayland windows. I'm not actually sure why this change would have helped at all with popups, but it's good to hear that it at least didn't make things worse. There are a couple of interesting things in the log. Not necessarily anything indicating an issue on the labwc/wlroots side, but merely things that caught my attention:
I'm not sure what this "DefaultOverlayManager.JWindow" is. It appears to have neither WM_HINTS.focus nor WM_TAKE_FOCUS set, making it truly a "No Input" window, thus the technically correct behavior is not to focus it. Hopefully this isn't the popup that never received focus.
This looks like we tried to focus MATLAB and it rejected the focus, passing it to Simulink instead. wlroots prevented this (as it was unexpected) and it looks like the terminal window (Wayland-native?) kept the focus.
This looks like we focused Simulink and then MATLAB tried to "steal" the focus back. wlroots prevented this, and Simulink kept the focus. I guess MATLAB/Simulink are making some attempts to automatically pass focus back and forth, but this isn't allowed in labwc (by wlroots policy). |
cf56662
to
57a195f
Compare
57a195f
to
bbe71e2
Compare
bbe71e2
to
492c526
Compare
@jlindgren90 i just tried this branch in its current state. Popups do show up (as opposed to current master), but they are not clickable. When i try to click an item in the popup menu, it behaves as if I've "clicked through" the popup and clicked the window behind the popup menu. But this is already a great progress! |
That's very interesting, and unexpected to me. Not sure what would be causing that. Thanks for testing, regardless! |
Now that I think about it, I have noticed some other popups (xfce4-notifyd notifications for example) being unclickable. Maybe related, maybe not. Clicks passing through sounds like maybe XWayland's idea of the window stacking order is out-of-sync with labwc's. |
@jlindgren90 seems that wlroots 0.17 has been released, but the MR (https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4384) wasn't merged. I've branched off your branch (https://github.com/kyak/labwc/tree/offer-focus) and been rebasing this on top of master for the last month (so that not to bother you with rebases), and it seems to work for me. However, I'm not very fond of doing this for indefinite time :) Do you have an idea what can we do? |
I guess we'll just have to wait for the next wlroots release. |
There were talks by the wlroots devs doing more releases, once a year at the current stage of development indeed seems a bit long. I also didn't manage to get the expose-window-manager-xcb-connection feature into the release (although that is completely on me because I didn't actually send a MR for that and then was surprised by the release). |
4b8ba87
to
8def7ca
Compare
Rebased onto master and switched over to a |
@jlindgren90 can you please rebase your branch on top of the latest labwc/master? There are rebase conflicts since maybe 1 week ago and it would be better if you looked into it. |
Yes, I'll try to get to it soon. I've been a bit busy lately, sorry this has gotten out of date. |
8def7ca
to
517c0ef
Compare
517c0ef
to
7f101bc
Compare
Updated to include all the fixes from #1533, plus one more fix (support for keyboard grabs). The wlroots branch also has some new changes. |
I've been running this branch for a couple of days now, all looks good! |
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused. labwc#1142
Use the new grab_focus signal as a more reliable way to tell when an unmanaged (override-redirect) surface wants focus. labwc#1142
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused. labwc#1142
Use the new grab_focus signal as a more reliable way to tell when an unmanaged (override-redirect) surface wants focus. labwc#1142
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused.
Use the new grab_focus signal as a more reliable way to tell when an unmanaged (override-redirect) surface wants focus.
7f101bc
to
be3ded6
Compare
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused. labwc#1142
Use the new grab_focus signal as a more reliable way to tell when an unmanaged (override-redirect) surface wants focus. labwc#1142
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused. labwc#1142
Use the new grab_focus signal as a more reliable way to tell when an unmanaged (override-redirect) surface wants focus. labwc#1142
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused. labwc#1142
Use the new grab_focus signal as a more reliable way to tell when an unmanaged (override-redirect) surface wants focus. labwc#1142
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused. labwc#1142
Use the new grab_focus signal as a more reliable way to tell when an unmanaged (override-redirect) surface wants focus. labwc#1142
@jlindgren90 as usual, I was rebasing your branch on top of labwc/master. This time there's a build error:
Can you please have a look? |
@kyak I am not sure as I am not using libliftoff, but it looks like a new version was released recently and broke backwards compatibility. You may need to cherry-pick https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/1bfd0613ca4865c73250488375310fdd6a4c1b5d. |
For testing/discussion. Depends on a wlroots change
that I haven't submitted yetsubmitted here:https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4384
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call
wlr_xwayland_surface_activate(surface, true)
.This is a more compatible method of giving focus to windows using the Globally Active input model (see
wlr_xwayland_icccm_input_model()
) than callingwlr_xwayland_surface_activate()
unconditionally, since there is no reliable way to know in advance whether these windows want to be focused.Previous experimental wlroots branch, with lots of extra debugging output for testing purposes:
jlindgren90/wlroots@offer-focus