From c9baf208bd36ce9a7f2df330e8b398fe96be18ed Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Mon, 5 Jan 2026 21:44:48 +0100
Subject: [PATCH] Fix Mouse button index
---
src/video/wayland/SDL_waylandevents.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index afef96cad1962..3c42c02f544c8 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -875,7 +875,7 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer,
SDL_WaylandSeat *seat = (SDL_WaylandSeat *)data;
seat->pointer.focus = NULL;
- for (int i = 0; seat->pointer.buttons_pressed; ++i) {
+ for (int i = 1; seat->pointer.buttons_pressed; ++i) {
if (seat->pointer.buttons_pressed & SDL_BUTTON_MASK(i)) {
SDL_SendMouseButton(0, window->sdlwindow, seat->pointer.sdl_id, i, false);
seat->pointer.buttons_pressed &= ~SDL_BUTTON_MASK(i);