wayland: Check focus when dispatching relative motion
In rare cases, a leave event can be grouped with relative motion in a frame. Ensure a valid focus window when dispatching relative motion.
This commit is contained in:
@@ -1191,8 +1191,9 @@ static void pointer_handle_axis_relative_direction(void *data, struct wl_pointer
|
|||||||
static void pointer_dispatch_relative_motion(SDL_WaylandSeat *seat)
|
static void pointer_dispatch_relative_motion(SDL_WaylandSeat *seat)
|
||||||
{
|
{
|
||||||
SDL_WindowData *window = seat->pointer.focus;
|
SDL_WindowData *window = seat->pointer.focus;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
|
||||||
|
|
||||||
|
if (window) {
|
||||||
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
if (mouse->InputTransform || !mouse->enable_relative_system_scale) {
|
if (mouse->InputTransform || !mouse->enable_relative_system_scale) {
|
||||||
@@ -1204,6 +1205,7 @@ static void pointer_dispatch_relative_motion(SDL_WaylandSeat *seat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendMouseMotion(seat->pointer.pending_frame.timestamp_ns, window->sdlwindow, seat->pointer.sdl_id, true, (float)dx, (float)dy);
|
SDL_SendMouseMotion(seat->pointer.pending_frame.timestamp_ns, window->sdlwindow, seat->pointer.sdl_id, true, (float)dx, (float)dy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointer_dispatch_axis(SDL_WaylandSeat *seat)
|
static void pointer_dispatch_axis(SDL_WaylandSeat *seat)
|
||||||
|
|||||||
Reference in New Issue
Block a user