From 25f54f0f4f015ab74117ca9438d24005b1179260 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 26 Nov 2016 10:26:26 -0800 Subject: [PATCH] tap should default to disabled, not enabled --- src/video/cocoa/SDL_cocoamousetap.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoamousetap.m b/src/video/cocoa/SDL_cocoamousetap.m index a36e42307..4f116de8d 100644 --- a/src/video/cocoa/SDL_cocoamousetap.m +++ b/src/video/cocoa/SDL_cocoamousetap.m @@ -203,6 +203,8 @@ Cocoa_InitMouseEventTap(SDL_MouseData* driverdata) kCGEventTapOptionDefault, allGrabbedEventsMask, &Cocoa_MouseTapCallback, tapdata); if (tapdata->tap) { + /* Tap starts disabled, until app requests mouse grab */ + CGEventTapEnable(tapdata->tap, false); tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata); if (tapdata->thread) { /* Success - early out. Ownership transferred to thread. */ @@ -222,7 +224,7 @@ Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled) SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata; if (tapdata && tapdata->tap) { - CGEventTapEnable(tapdata->tap, enabled); + CGEventTapEnable(tapdata->tap, !!enabled); } }