layer-shell: allow new values for keyboard-interactivity

Value is now an enum with a new value ("on-demand") that compositors can use to allow "normal" keyboard focus semantics regardless of the layer the client surface is on. An error is sent for invalid keyboard interactivity values. The old behavior is retained for clients using the previous version of the protocol.

Also adjusted the layer-shell example program to use the new keyboard interactivity options.
This commit is contained in:
Daniel Kondor 2020-11-26 20:18:22 +08:00 committed by Simon Ser
parent 5d054258af
commit b7dc4f2990
4 changed files with 129 additions and 18 deletions

View file

@ -11,7 +11,7 @@
#include "util/signal.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
#define LAYER_SHELL_VERSION 3
#define LAYER_SHELL_VERSION 4
static void resource_handle_destroy(struct wl_client *client,
struct wl_resource *resource) {
@ -158,7 +158,18 @@ static void layer_surface_handle_set_keyboard_interactivity(
if (!surface) {
return;
}
surface->client_pending.keyboard_interactive = !!interactive;
if (wl_resource_get_version(resource) < ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION) {
surface->client_pending.keyboard_interactive = !!interactive;
} else {
if (interactive > ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
wl_resource_post_error(resource,
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY,
"wrong keyboard interactivity value: %" PRIu32, interactive);
} else {
surface->client_pending.keyboard_interactive = interactive;
}
}
}
static void layer_surface_handle_get_popup(struct wl_client *client,