WIP: Implement the keyboard shortcuts inhibitor protocol#5
WIP: Implement the keyboard shortcuts inhibitor protocol#5NDagestad wants to merge 1 commit intoany1:masterfrom
Conversation
| if (inhibitor == NULL){ | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
TBH I don't really like these conditions inside each other, but I didn't find a better logic to implement it... (EDIT: this was meant for the conditions above 🤦)
There was a problem hiding this comment.
If you create an "input inhibitor module", you may find that this turns out nicer. It's fine to create an abstraction for it even though it's small. You can look at how the keyboard, pointer and seat modules are structured.
9f9a79a to
f48a5ce
Compare
|
Here's a version where the inhibitor is put in a structure, the remaining things to do listed in my initial message are still not implemented yet, I'll see if I can get to do some of theme over the weekend |
include/inhibitor.h
Outdated
| #include "wlr-input-inhibitor-unstable-v1.h" | ||
|
|
||
|
|
||
| struct inhibitor { |
src/inhibitor.c
Outdated
| #include "inhibitor.h" | ||
| #include <stdio.h> | ||
|
|
||
|
|
src/inhibitor.c
Outdated
| return self->inhibitor != NULL; | ||
| } | ||
|
|
||
|
|
src/main.c
Outdated
| return; | ||
| } | ||
|
|
||
| if (!inhibitor_is_inhibited(inhibitor)){ |
There was a problem hiding this comment.
Why not pass keyboard events when the input isn't inhibited?
There was a problem hiding this comment.
In some cases it is not something we want. In my case, I have a shortcut that is triggered when is released, making it possible to launch rofi with a single key press, but if the client receives input when the inhibitor is not active it will receive the key press might trigger something on the client side (in this case, windows open the start menu)
The logic is still not really correct though, I fixed it in the update
src/main.c
Outdated
| } else if (strcmp(interface, "wl_shm") == 0) { | ||
| wl_shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); | ||
| } else if (strcmp(interface, zwlr_input_inhibit_manager_v1_interface.name) == 0) { | ||
| struct zwlr_input_inhibit_manager_v1* manager = wl_registry_bind(registry, id, &zwlr_input_inhibit_manager_v1_interface, 1); |
There was a problem hiding this comment.
The rest of the bindings here are assigned into global variables named after their respective interfaces. This should follow the same pattern.
This pattern breaks down if you want the wayland client to connect to multiple compositors, but that wouldn't really make any sense.
f48a5ce to
1ca2602
Compare
|
Sorry for the long delay I did not expect to have so little time to work on this. |
1ca2602 to
4fc5eb6
Compare
There are a few things still to do:
Also, keep in mind I have not implemented a wayland protocol before, so I did my best to follow what I thought the protocol said, and as it is quite a simple one, I hope I didn't screw it up to bad.