From 5b2ff76c12af3663367996019c436ee116b221b8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 31 May 2015 13:58:36 -0400 Subject: [PATCH] Cocoa: send a MOUSEMOTION event when warping cursor from outside the window. Fixes Bugzilla #2984. --- src/video/cocoa/SDL_cocoamouse.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 4f15373e6e04c..9c37c472892cc 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -230,6 +230,10 @@ + (NSCursor *)invisibleCursor static void Cocoa_WarpMouse(SDL_Window * window, int x, int y) { + /* pretend we have the mouse focus, even if we don't, so + Cocoa_WarpMouseGlobal() will properly fake a mouse motion event. */ + SDL_Mouse *mouse = SDL_GetMouse(); + mouse->focus = window; Cocoa_WarpMouseGlobal(x + window->x, y + window->y); }