Added Fixes

- Removed tablet-unstable-v2 protocol
- Added dynamic theme loading
- Formatting fixes
This commit is contained in:
Prakarsh Panwar 2026-04-13 23:06:39 +05:30
parent e865b92d35
commit 52d7cbb856
4 changed files with 18 additions and 1202 deletions

File diff suppressed because it is too large Load diff

View file

@ -105,7 +105,6 @@ if (GLFW_BUILD_WAYLAND)
generate_wayland_protocol("fractional-scale-v1.xml")
generate_wayland_protocol("xdg-activation-v1.xml")
generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
generate_wayland_protocol("tablet-unstable-v2.xml")
generate_wayland_protocol("cursor-shape-v1.xml")
endif()

View file

@ -49,7 +49,6 @@
#include "fractional-scale-v1-client-protocol.h"
#include "xdg-activation-v1-client-protocol.h"
#include "idle-inhibit-unstable-v1-client-protocol.h"
#include "tablet-unstable-v2-client-protocol.h"
#include "cursor-shape-v1-client-protocol.h"
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
@ -93,10 +92,6 @@
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
#undef types
#define types _glfw_tablet_types
#include "tablet-unstable-v2-client-protocol-code.h"
#undef types
#define types _glfw_cursor_shape_types
#include "cursor-shape-v1-client-protocol-code.h"
#undef types
@ -211,7 +206,7 @@ static void registryHandleGlobal(void* userData,
&wp_fractional_scale_manager_v1_interface,
1);
}
else if (strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0)
else if (strcmp(interface, "wp_cursor_shape_manager_v1") == 0)
{
_glfw.wl.cursorShapeManager =
wl_registry_bind(registry, name,
@ -917,7 +912,7 @@ int _glfwInitWayland(void)
return GLFW_FALSE;
}
if (!loadCursorTheme())
if (!(_glfw.wl.cursorShapeDevice || loadCursorTheme()))
return GLFW_FALSE;
if (_glfw.wl.seat && _glfw.wl.dataDeviceManager)

View file

@ -1245,7 +1245,8 @@ static GLFWbool createNativeSurface(_GLFWwindow* window,
return GLFW_TRUE;
}
GLFWbool setCursorShape(int shape) {
static GLFWbool setCursorShape(int shape)
{
int xdgShape = -1;
switch (shape)
@ -1280,15 +1281,15 @@ GLFWbool setCursorShape(int shape) {
case GLFW_NOT_ALLOWED_CURSOR:
xdgShape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NOT_ALLOWED;
break;
default:
break;
}
if (xdgShape == -1)
{
return GLFW_FALSE;
}
wp_cursor_shape_device_v1_set_shape(_glfw.wl.cursorShapeDevice,
_glfw.wl.pointerEnterSerial,
_glfw.wl.pointerEnterSerial,
xdgShape);
return GLFW_TRUE;
@ -1299,11 +1300,8 @@ static void setCursorImage(_GLFWwindow* window,
{
if (_glfw.wl.cursorShapeDevice && cursorWayland->shape != 0)
{
GLFWbool ok = setCursorShape(cursorWayland->shape);
if (ok == GLFW_TRUE)
{
if (setCursorShape(cursorWayland->shape))
return;
}
}
struct itimerspec timer = {0};
@ -2135,10 +2133,9 @@ static void seatHandleCapabilities(void* userData,
{
_glfw.wl.pointer = wl_seat_get_pointer(seat);
wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL);
if (_glfw.wl.cursorShapeManager)
{
if (_glfw.wl.cursorShapeManager)
_glfw.wl.cursorShapeDevice = wp_cursor_shape_manager_v1_get_pointer(_glfw.wl.cursorShapeManager, _glfw.wl.pointer);
}
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
{
@ -3119,7 +3116,11 @@ GLFWbool _glfwCreateCursorWayland(_GLFWcursor* cursor,
GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape)
{
cursor->wl.shape = shape;
if (!_glfw.wl.cursorTheme)
{
cursor->wl.shape = shape;
return GLFW_TRUE;
}
const char* name = NULL;
@ -3260,6 +3261,9 @@ static void relativePointerHandleRelativeMotion(void* userData,
_glfwInputCursorPos(window, xpos, ypos);
}
// Dummy Tablet Tool Interface struct
const struct wl_interface zwp_tablet_tool_v2_interface = {};
static const struct zwp_relative_pointer_v1_listener relativePointerListener =
{
relativePointerHandleRelativeMotion