소스 검색

Cocoa: send a MOUSEMOTION event when warping cursor from outside the window.

Fixes Bugzilla #2984.
Ryan C. Gordon 10 년 전
부모
커밋
5b2ff76c12
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/video/cocoa/SDL_cocoamouse.m

+ 4 - 0
src/video/cocoa/SDL_cocoamouse.m

@@ -230,6 +230,10 @@ Cocoa_WarpMouseGlobal(int x, int y)
 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);
 }