Implement the keyboard shortcuts inhibitor protocol#42
Conversation
|
re-link of the tickets: |
|
I am already improving it, to support multiple seats better. edit: something like this:
https://git.sr.ht/~stacyharper/wlvncc/commit/6d5a26d03849b9f7a6e7a7c085fe212a9b1d107d I'll sit on this for a while |
|
LGTM. Seats can be improved in a later PR. There should probably be an option to enable/disable this though. |
|
Also, I haven't discussed it yet, but we should note that |
|
Maybe we can wait a bit. I think I almost finish the multi-seat patch. I should probably squash them directly here? |
3944c1b to
3b34fb2
Compare
I squashed both commits. Let's do the good job directly :) |
3b34fb2 to
f4a7b7f
Compare
|
I would very much prefer for this to be explicitly enabled via a command line argument. |
Or, well, actually, this is fine as long as it's off by default. |
src/inhibitor.c
Outdated
| bool inhibitor_init(struct shortcuts_inhibitor* self, struct wl_surface* surface, | ||
| struct wl_list* seats) | ||
| { | ||
| if ( self->surface != NULL ) |
src/inhibitor.c
Outdated
| } | ||
| } | ||
|
|
||
| assert(false); |
There was a problem hiding this comment.
Let's just say abort() instead of assert(false). Also, better return false to pacify the compiler or otherwise annotate this as being unreachable.
src/inhibitor.c
Outdated
| self->manager, self->surface, seat_inhibitor->seat->wl_seat); | ||
| return; | ||
| } | ||
| assert(false); |
src/inhibitor.c
Outdated
| seat_inhibitor->inhibitor = NULL; | ||
| return; | ||
| } | ||
| assert(false); |
src/inhibitor.c
Outdated
| struct shortcuts_seat_inhibitor* seat_inhibitor; | ||
| struct shortcuts_seat_inhibitor* tmp; | ||
|
|
||
| wl_list_for_each_safe(seat_inhibitor, tmp, &self->seat_inhibitors, link) { |
There was a problem hiding this comment.
I would write a function that finds the first matching inhibitor based on seat and returns it. Then use that here and in all the other places. That one would be fine to assert() on.
I am one of those people who believe in writing small functions. So, it makes me happy when I see PRs following the mantra of "write small functions".
f4a7b7f to
9a5fb19
Compare
|
I've done most of the requested changes. Only, about the recommandation to disable this feature by default: Atm there is no way to easily disable the feature. F12 disable it temporarily, but as soon as pointer leave, and enter back, the inhibitor is re-created. It looks okay to me, as an easy way to get out of a fullscreen wlvncc window by example. I think we can easily desactivate the feature completely, by skipping the global inhibitor bind. But then there is no way to enable it later, without restarting the program. Is it okay? It is for me, I'll always use wlvncc with the extra parameter then. |
|
Looks good now.
The problem with leaving this on by default is that it's maybe not so nice when you run an application for the first time and it does something rather intrusive like blocking your shortcuts. |
Right, but only when the pointer is on the surface. It doesn't look that intrusive to me. That is also what the virtualization program does, even if the behavior is more clarified, with focus/unfocus dedicated shortcuts. As I said, I'm also okay with adding a parameter to enable this. |
Well, it's settled then. :) |
To do so, we also have to store how seats are associated to keyboards and pointers.
9a5fb19 to
05afa6f
Compare
|
While doing so, I figured out we was poorly handling the case the compositor was not supporting the protocol. We have to check |
05afa6f to
1c50ee0
Compare
|
Thanks! |
This is a continuation of: #5
I got good Wayland knowledge, I should be able to tackle on remaining issues, if there are.
For now I just rebased this over master, fixed conflicts, and compiled. It works so far, and use the most recent protocol.I rebased this over master, and adapted it to handle multiple seat correctly. We inhibit shortcuts only for the seats with a pointer in the surface.