|
@@ -597,6 +597,7 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer,
|
|
|
// Clear the capture flag and raise all buttons
|
|
|
wind->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE;
|
|
|
|
|
|
+ input->buttons_pressed = 0;
|
|
|
SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_LEFT, false);
|
|
|
SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_RIGHT, false);
|
|
|
SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_MIDDLE, false);
|
|
@@ -604,7 +605,6 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer,
|
|
|
SDL_SendMouseButton(Wayland_GetPointerTimestamp(input, 0), wind->sdlwindow, input->pointer_id, SDL_BUTTON_X2, false);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/* A pointer leave event may be emitted if the compositor hides the pointer in response to receiving a touch event.
|
|
|
* Don't relinquish focus if the surface has active touches, as the compositor is just transitioning from mouse to touch mode.
|
|
|
*/
|
|
@@ -728,6 +728,13 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_
|
|
|
SDL_VideoData *viddata = window->waylandData;
|
|
|
bool ignore_click = false;
|
|
|
|
|
|
+ if (state) {
|
|
|
+ Wayland_UpdateImplicitGrabSerial(input, serial);
|
|
|
+ input->buttons_pressed |= SDL_BUTTON_MASK(sdl_button);
|
|
|
+ } else {
|
|
|
+ input->buttons_pressed &= ~(SDL_BUTTON_MASK(sdl_button));
|
|
|
+ }
|
|
|
+
|
|
|
if (sdl_button == SDL_BUTTON_LEFT &&
|
|
|
ProcessHitTest(input->pointer_focus, input->seat, input->sx_w, input->sy_w, serial)) {
|
|
|
return; // don't pass this event on to app.
|
|
@@ -747,14 +754,9 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_
|
|
|
* the mouse outside the window if you drag outside of it, until you let go
|
|
|
* of all buttons (even if you add or remove presses outside the window, as
|
|
|
* long as any button is still down, the capture remains).
|
|
|
+ *
|
|
|
+ * The mouse is not captured in relative mode.
|
|
|
*/
|
|
|
- if (state) { // update our mask of currently-pressed buttons
|
|
|
- input->buttons_pressed |= SDL_BUTTON_MASK(sdl_button);
|
|
|
- } else {
|
|
|
- input->buttons_pressed &= ~(SDL_BUTTON_MASK(sdl_button));
|
|
|
- }
|
|
|
-
|
|
|
- // Don't modify the capture flag in relative mode.
|
|
|
if (!viddata->relative_mouse_mode) {
|
|
|
if (input->buttons_pressed != 0) {
|
|
|
window->sdlwindow->flags |= SDL_WINDOW_MOUSE_CAPTURE;
|
|
@@ -763,10 +765,6 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (state) {
|
|
|
- Wayland_UpdateImplicitGrabSerial(input, serial);
|
|
|
- }
|
|
|
-
|
|
|
if (!ignore_click) {
|
|
|
SDL_SendMouseButton(timestamp, window->sdlwindow, input->pointer_id, sdl_button, down);
|
|
|
}
|