Added --non-exclusive parameter to skip requesting exclusive zone from compositor

This allows wvkbd to show on top of existing windows, not pushing them
out of the way.

Ref: https://github.com/jjsullivan5196/wvkbd/issues/102
Ref: https://github.com/jjsullivan5196/wvkbd/issues/93
This commit is contained in:
Maarten van Gompel
2025-08-09 21:41:19 +02:00
parent b3a7e95c69
commit 3a44beac1f
2 changed files with 10 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ struct kbd {
double preferred_scale, preferred_fractional_scale;
bool landscape;
bool shift_space_is_tab;
bool exclusive;
uint8_t mods;
uint8_t compose;
struct key *last_press;

10
main.c
View File

@@ -717,6 +717,9 @@ usage(char *argv0)
" -l - Comma separated list of layers\n");
fprintf(stderr, " --landscape-layers - Comma separated list of "
"landscape layers\n");
fprintf(stderr, " --non-exclusive - Allow the keyboard to overlap"
" windows. Do not request an exclusive zone from the"
"compositor\n");
}
void
@@ -783,7 +786,9 @@ show()
zwlr_layer_surface_v1_set_size(layer_surface, 0, height);
zwlr_layer_surface_v1_set_anchor(layer_surface, anchor);
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, height);
if (keyboard.exclusive) {
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, height);
}
zwlr_layer_surface_v1_set_keyboard_interactivity(layer_surface, false);
zwlr_layer_surface_v1_add_listener(layer_surface, &layer_surface_listener,
NULL);
@@ -852,6 +857,7 @@ main(int argc, char **argv)
keyboard.layer_index = 0;
keyboard.preferred_scale = 1;
keyboard.preferred_fractional_scale = 0;
keyboard.exclusive = true;
uint8_t alpha = 0;
bool alpha_defined = false;
@@ -987,6 +993,8 @@ main(int argc, char **argv)
(!strcmp(argv[i], "--list-layers"))) {
list_layers();
exit(0);
} else if ((!strcmp(argv[i], "-non-exclusive")) || (!strcmp(argv[i], "--non-exclusive"))) {
keyboard.exclusive = false;
} else {
fprintf(stderr, "Invalid argument: %s\n", argv[i]);
usage(argv[0]);