mirror of https://github.com/encounter/SDL.git
Mac: Don't disassociate cursor if window is moving / doesn't have focus.
Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396
This commit is contained in:
parent
4850d25988
commit
dd94c5fa54
|
@ -244,8 +244,23 @@ Cocoa_WarpMouse(SDL_Window * window, int x, int y)
|
||||||
static int
|
static int
|
||||||
Cocoa_SetRelativeMouseMode(SDL_bool enabled)
|
Cocoa_SetRelativeMouseMode(SDL_bool enabled)
|
||||||
{
|
{
|
||||||
CGError result;
|
/* We will re-apply the relative mode when the window gets focus, if it
|
||||||
|
* doesn't have focus right now.
|
||||||
|
*/
|
||||||
|
SDL_Window *window = SDL_GetMouseFocus();
|
||||||
|
if (!window) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We will re-apply the relative mode when the window finishes being moved,
|
||||||
|
* if it is being moved right now.
|
||||||
|
*/
|
||||||
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
|
if ([data->listener isMoving]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGError result;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
DLog("Turning on.");
|
DLog("Turning on.");
|
||||||
result = CGAssociateMouseAndMouseCursorPosition(NO);
|
result = CGAssociateMouseAndMouseCursorPosition(NO);
|
||||||
|
|
Loading…
Reference in New Issue