Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Mac: Fix SDL_WarpMouseInWindow in fullscreen.
Browse files Browse the repository at this point in the history
If you switched from a window to fullscreen, your SDL_WarpMouseInWindow
calls would be offset by the x and y coordinates of the original window.
  • Loading branch information
jorgenpt committed Jul 15, 2013
1 parent 9407a96 commit 9244c60
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -201,10 +201,13 @@ + (NSCursor *)invisibleCursor
Cocoa_WarpMouse(SDL_Window * window, int x, int y)
{
SDL_Mouse *mouse = SDL_GetMouse();
CGPoint point;
CGPoint point = CGMakePoint(x, y);

point.x = (float)window->x + x;
point.y = (float)window->y + y;
if (!(window->flags & SDL_WINDOW_FULLSCREEN))
{
point.x += window->x;
point.y += window->y;
}

{
/* This makes Cocoa_HandleMouseEvent ignore this delta in the next
Expand Down

0 comments on commit 9244c60

Please sign in to comment.