wayland: Define the magic values for stylus buttons

Use the Linux defines if available, and if not, define the buttons with the rest of the values, as is done for mouse buttons.
This commit is contained in:
Frank Praznik
2026-01-05 11:57:00 -05:00
parent 6c2f9bc41e
commit 8a2fbef5b2

View File

@@ -53,14 +53,18 @@
#include <libdecor.h>
#endif
// Per the spec, Wayland mouse and stylus buttons are defined as Linux event codes.
#ifdef SDL_INPUT_LINUXEV
#include <linux/input.h>
#else
#define BTN_LEFT (0x110)
#define BTN_RIGHT (0x111)
#define BTN_MIDDLE (0x112)
#define BTN_SIDE (0x113)
#define BTN_EXTRA (0x114)
#define BTN_LEFT (0x110)
#define BTN_RIGHT (0x111)
#define BTN_MIDDLE (0x112)
#define BTN_SIDE (0x113)
#define BTN_EXTRA (0x114)
#define BTN_STYLUS (0x14b)
#define BTN_STYLUS2 (0x14c)
#define BTN_STYLUS3 (0x149)
#endif
#include "../../events/SDL_keysym_to_scancode_c.h"
#include "../../events/imKStoUCS.h"
@@ -3381,14 +3385,13 @@ static void tablet_tool_handle_button(void *data, struct zwp_tablet_tool_v2 *too
int sdlbutton;
switch (button) {
// see %{_includedir}/linux/input-event-codes.h
case 0x14b: // BTN_STYLUS
case BTN_STYLUS:
sdlbutton = 1;
break;
case 0x14c: // BTN_STYLUS2
case BTN_STYLUS2:
sdlbutton = 2;
break;
case 0x149: // BTN_STYLUS3
case BTN_STYLUS3:
sdlbutton = 3;
break;
default: