Skip to content

Commit 33e5f48

Browse files
committed
x11: Don't update grab on enter when the mouse is captured
The xserver will still send EnterNotify events while the pointer is captured, and the grab shouldn't be updated in these cases, as it will cause the capture to be lost.
1 parent 1abac3c commit 33e5f48

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/video/x11/SDL_x11events.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
13381338
SDL_SendMouseMotion(0, data->window, SDL_GLOBAL_MOUSE_ID, false, (float)xevent->xcrossing.x, (float)xevent->xcrossing.y);
13391339
}
13401340

1341-
// We ungrab in LeaveNotify, so we may need to grab again here
1342-
SDL_UpdateWindowGrab(data->window);
1341+
// We ungrab in LeaveNotify, so we may need to grab again here, but not if captured, as the capture can be lost.
1342+
if (!(data->window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
1343+
SDL_UpdateWindowGrab(data->window);
1344+
}
13431345

13441346
X11_ProcessHitTest(_this, data, mouse->last_x, mouse->last_y, true);
13451347
} break;

0 commit comments

Comments
 (0)