mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-06 02:02:09 +08:00
Added support for extended buttons on Wayland
Fixes https://github.com/libsdl-org/SDL/issues/14681
This commit is contained in:
@@ -871,7 +871,12 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer,
|
||||
|
||||
SDL_WaylandSeat *seat = (SDL_WaylandSeat *)data;
|
||||
seat->pointer.focus = NULL;
|
||||
seat->pointer.buttons_pressed = 0;
|
||||
for (int i = 0; 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);
|
||||
}
|
||||
}
|
||||
SDL_SendMouseButton(0, window->sdlwindow, seat->pointer.sdl_id, SDL_BUTTON_LEFT, false);
|
||||
SDL_SendMouseButton(0, window->sdlwindow, seat->pointer.sdl_id, SDL_BUTTON_RIGHT, false);
|
||||
SDL_SendMouseButton(0, window->sdlwindow, seat->pointer.sdl_id, SDL_BUTTON_MIDDLE, false);
|
||||
@@ -992,14 +997,9 @@ static void pointer_handle_button_common(SDL_WaylandSeat *seat, uint32_t serial,
|
||||
case BTN_RIGHT:
|
||||
sdl_button = SDL_BUTTON_RIGHT;
|
||||
break;
|
||||
case BTN_SIDE:
|
||||
sdl_button = SDL_BUTTON_X1;
|
||||
break;
|
||||
case BTN_EXTRA:
|
||||
sdl_button = SDL_BUTTON_X2;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
sdl_button = SDL_BUTTON_X1 + (button - BTN_SIDE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (window) {
|
||||
|
||||
Reference in New Issue
Block a user