mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 11:55:38 +00:00
wayland: Don't modify the mouse capture flag in relative mode
If relative mouse mode is explicitly enabled, don't modify the capture flag on button events or the window might report having lost mouse focus if a button is pressed while moving the cursor.
This commit is contained in:
parent
a66cb8cf21
commit
33a430056f
|
@ -590,6 +590,7 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial,
|
||||||
uint32_t time, uint32_t button, uint32_t state_w)
|
uint32_t time, uint32_t button, uint32_t state_w)
|
||||||
{
|
{
|
||||||
SDL_WindowData *window = input->pointer_focus;
|
SDL_WindowData *window = input->pointer_focus;
|
||||||
|
SDL_VideoData *viddata = window->waylandData;
|
||||||
enum wl_pointer_button_state state = state_w;
|
enum wl_pointer_button_state state = state_w;
|
||||||
uint32_t sdl_button;
|
uint32_t sdl_button;
|
||||||
|
|
||||||
|
@ -628,10 +629,13 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial,
|
||||||
input->buttons_pressed &= ~(SDL_BUTTON(sdl_button));
|
input->buttons_pressed &= ~(SDL_BUTTON(sdl_button));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input->buttons_pressed != 0) {
|
/* Don't modify the capture flag in relative mode. */
|
||||||
window->sdlwindow->flags |= SDL_WINDOW_MOUSE_CAPTURE;
|
if (!viddata->relative_mouse_mode) {
|
||||||
} else {
|
if (input->buttons_pressed != 0) {
|
||||||
window->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE;
|
window->sdlwindow->flags |= SDL_WINDOW_MOUSE_CAPTURE;
|
||||||
|
} else {
|
||||||
|
window->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Wayland_data_device_set_serial(input->data_device, serial);
|
Wayland_data_device_set_serial(input->data_device, serial);
|
||||||
|
|
Loading…
Reference in a new issue