Wayland: Implement glfwRequestWindowAttention

This implements window attention requests via the xdg-activation-v1
protocol.

This was updated by @ elmindreda to work with recent Wayland related
 changes to the main branch:
 - Switched to current way of handling Wayland protocol files
 - Added the xdg-activation-v1.xml protocol file to deps/wayland
 - Added missing macros to rename protocol interface globals

The protocol file was copied from wayland-protocols 1.33.

Closes #2287
This commit is contained in:
Jan Schürkamp
2024-01-24 21:34:47 +01:00
committed by Camilla Löwy
parent 2590d4cdd4
commit 9317970243
8 changed files with 261 additions and 3 deletions

View File

@@ -46,6 +46,7 @@
#include "viewporter-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h"
#include "pointer-constraints-unstable-v1-client-protocol.h"
#include "xdg-activation-v1-client-protocol.h"
#include "idle-inhibit-unstable-v1-client-protocol.h"
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
@@ -77,6 +78,10 @@
#include "pointer-constraints-unstable-v1-client-protocol-code.h"
#undef types
#define types _glfw_xdg_activation_types
#include "xdg-activation-v1-client-protocol-code.h"
#undef types
#define types _glfw_idle_inhibit_types
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
#undef types
@@ -177,6 +182,13 @@ static void registryHandleGlobal(void* userData,
&zwp_idle_inhibit_manager_v1_interface,
1);
}
else if (strcmp(interface, "xdg_activation_v1") == 0)
{
_glfw.wl.activationManager =
wl_registry_bind(registry, name,
&xdg_activation_v1_interface,
1);
}
}
static void registryHandleGlobalRemove(void* userData,
@@ -929,6 +941,8 @@ void _glfwTerminateWayland(void)
zwp_pointer_constraints_v1_destroy(_glfw.wl.pointerConstraints);
if (_glfw.wl.idleInhibitManager)
zwp_idle_inhibit_manager_v1_destroy(_glfw.wl.idleInhibitManager);
if (_glfw.wl.activationManager)
xdg_activation_v1_destroy(_glfw.wl.activationManager);
if (_glfw.wl.registry)
wl_registry_destroy(_glfw.wl.registry);
if (_glfw.wl.display)