From 21a349343b9f2cbd85765397fe233b0cc8e2c1aa Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 6 Feb 2022 16:17:58 -0500 Subject: [PATCH] [client] wayland: implement activation request --- client/displayservers/Wayland/activation.c | 28 ++++++++++++++++++++++ client/displayservers/Wayland/wayland.h | 1 + 2 files changed, 29 insertions(+) diff --git a/client/displayservers/Wayland/activation.c b/client/displayservers/Wayland/activation.c index bd9a39c9..7fae840d 100644 --- a/client/displayservers/Wayland/activation.c +++ b/client/displayservers/Wayland/activation.c @@ -40,3 +40,31 @@ void waylandActivationFree(void) xdg_activation_v1_destroy(wlWm.xdgActivation); } } + +static void activationTokenDone(void * data, + struct xdg_activation_token_v1 * xdgToken, const char * token) +{ + xdg_activation_token_v1_destroy(xdgToken); +} + +static const struct xdg_activation_token_v1_listener activationTokenListener = { + .done = &activationTokenDone, +}; + +void waylandActivationRequest(void) +{ + if (!wlWm.xdgActivation) return; + + struct xdg_activation_token_v1 * token = + xdg_activation_v1_get_activation_token(wlWm.xdgActivation); + + if (!token) + { + DEBUG_ERROR("failed to retrieve XDG activation token"); + return; + } + + xdg_activation_token_v1_add_listener(token, &activationTokenListener, NULL); + xdg_activation_token_v1_set_surface(token, wlWm.surface); + xdg_activation_token_v1_commit(token); +} diff --git a/client/displayservers/Wayland/wayland.h b/client/displayservers/Wayland/wayland.h index ac7774b2..d75275ea 100644 --- a/client/displayservers/Wayland/wayland.h +++ b/client/displayservers/Wayland/wayland.h @@ -237,6 +237,7 @@ extern struct WCBState wlCb; // activation module bool waylandActivationInit(void); void waylandActivationFree(void); +void waylandActivationRequest(void); // clipboard module bool waylandCBInit(void);