Closed Tamaranch closed 1 year ago
Thanks for provided a simple reproducer. I think the problem is probably that keybaord events are not sent to layer shell clients if the keyboard mode is none (default). gtk_layer_set_keyboard_mode (GTK_WINDOW (window), GTK_LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND);
should fix the problem you describe. See this for details.
I noticed another problem though. On Sway (version 1.7 at least) on-demand keyboard interactivity is silently treated as exclusive. The layer shell surface can get keyboard focus, but it can't loose it. this stops Sway claiming it's supported, but that doesn't get us much. I also tested with Mir, where on-demand keyboard interactivity is implemented and works.
TL;DR it may not be possible to fix this without changes to Sway (if that's the Wayland compositor you're using)
I think the problem is probably that keybaord events are not sent to layer shell clients if the keyboard mode is none (default).
Oops sorry, and thanks, I completely missed that one. So sure I had already gone through every aspect of the protocol that I didn't even look it up again :sweat_smile:
I use Labwc and Wayfire and it does solve the problem on both for the keyboard.
I had an idea to automatically switch to exclusive keyboard focus when a grabbing popup appears and automatically switch back when it's dismissed. This, again, works on Mir but seems to have problems on Sway. Though sounds like that might not be needed anymore.
I use Labwc and Wayfire and it does solve the problem on both for the keyboard.
Hmm it seems that for real life apps it is not so simple though. It's probably best to switch between exclusive and none to get a reliable result.
Within your app you might be able to hook up the right callbacks to turn exclusive interactivity on and off as needed. If that proves difficult then it may need to be done from within GTK Layer Shell. I'm not going to implement that right now. PRs welcome, though if it adds significant complexity or only works for/is needed on a single compositor I'm less likely to merge.
In fact it works quite well with Labwc >= 0.5.3, and for Wayfire it was necessary to use git-master >= d296170e
. It's not always perfect though and I'd probably have to tweak it a bit more and/or ask for improvements upstream, but it's fine for now.
Do you have any hints for the second point? (toggle effect broken)
It works quite well with Labwc >= 0.5.3
Labwc 0.6.0 / master branch differ substantially from 0.5.x. Suggest to always test with at least 0.6.0. Bug reports of us doing something wrong / non-spec-compliant are always welcome.
Not a bug, so closing. New feature proposal in #144.
The second point concerning pointer events is independent of the keyboard though, and has not been addressed (or I missed something...)
I don't fully understand the pointer event problem. I can run the code, but can you describe the expected behavior and actual behavior more clearly?
If you run ./p --layer --release
, after showing the menu once on button-release, it remains blocked, the button is no longer clickable. Clicking the button again should hide the menu, just like when it is shown on button-press.
Ok, yeah, that's weird.
Yes, the problem you describe sounds exactly like the one I report on that issue.
I can confirm it fixes the issue, thanks!
GtkLayerShell 0.8.0 and GTK 3.24.35 on Arch Linux
When a grab takes place from an application whose main window is a layer-shell window (for example when showing a GtkMenu), some events that are well received without layer-shell are not received anymore. I have identified at least two of them:
Here is a minimal reproducer, which works for "button-release-event" regarding the second point. My actual use case is more complex and in this case the problem may change from button-release to button-press, but I think it remains basically the same.
p.c
```c #includeTo build it:
To run it:
where
--layer
enables layer-shell and--release
shows the menu on button-release instead of button-press. Then press the button to show the menu and see if you can hide it by pressing Esc or by clicking the button again.NB: