From 8de4b24252347a2cca1449cc05ae94f404b1794a Mon Sep 17 00:00:00 2001 From: Nathan Fulton Date: Mon, 5 Sep 2016 12:31:47 -0400 Subject: [PATCH] Remove SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OTG mouse events don’t get processed correctly. With this hint removed, SDL mouse events will be handled as touch events and touch will raise fake mouse events. --- game/sdl/display.cpp | 5 ----- game/sdl/host.cpp | 18 +----------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/game/sdl/display.cpp b/game/sdl/display.cpp index fbba3e9..5fff45e 100644 --- a/game/sdl/display.cpp +++ b/game/sdl/display.cpp @@ -87,11 +87,6 @@ bool Display::Init() SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeRight LandscapeLeft"); #endif - // Android wants to process mouse and touch events separately - #if defined(__ANDROID__) - SDL_SetHint(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, "1"); - #endif - // Get surface properties SurfaceProperties props; HostHelpers::GetSurfaceProperties(&props); diff --git a/game/sdl/host.cpp b/game/sdl/host.cpp index 8019f2f..8def587 100644 --- a/game/sdl/host.cpp +++ b/game/sdl/host.cpp @@ -205,22 +205,6 @@ bool ProcessSdlEvent(base::Message *pmsg, Event *pevt) switch (event.type) { - /* - Note: SDL sees all mouse/touch input as "coursor input". Mouse events are - processed as touch events and real touch events raise fake mosue events. - Because WI supports multitouch, mouse events and finger events need to be - processed separately. Until a better way is found, use macros to only - process the input events appropriate for the given platform: - - - OS X doesn't support touch input. Thus, only process SDL_MOUSE events. - - iOS doesn't support mouse input. Thus, only process SDL_FINGER events. - - Android supports both mouse and touch input. Fortunately, - SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH can be used to process mouse events - separately from touch events (it's a shame a similar hint doesn't exist for - other platforms). Thus, Android can process both input event types. - - Linux... We'll try only processing SDL_MOUSE events for now. - */ - #if defined(__IPHONEOS__) || defined(__ANDROID__) case SDL_FINGERDOWN: { for (int i = 0; i < 2; i++) { @@ -293,7 +277,7 @@ bool ProcessSdlEvent(base::Message *pmsg, Event *pevt) break; #endif -#if defined(__MACOSX__) || defined(__ANDROID__) || defined(__LINUX__) +#if defined(__MACOSX__) || defined(__LINUX__) case SDL_MOUSEBUTTONDOWN: pevt->eType = penDownEvent; pevt->x = event.button.x;