Android: default SDL_HINT_MOUSE_TOUCH_EVENTS to 1 as previous behaviour
parent
6f732d4ee8
commit
b470cd9b09
|
@ -8,7 +8,8 @@ This is a list of major changes in SDL's version history.
|
||||||
|
|
||||||
Android:
|
Android:
|
||||||
* Removed SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH (replaced by SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS)
|
* Removed SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH (replaced by SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS)
|
||||||
(Changed old default behavior from hardware mouse triggering touch events to now not doing so (SDL_MOUSE_TOUCH_EVENTS=0) to match the default behavior of other platforms")
|
SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=1, should be replaced by setting both previous hints to 0.
|
||||||
|
SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=0, should be replaced by setting both previous hints to 1.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
|
@ -323,6 +323,7 @@ extern "C" {
|
||||||
* "1" - Mouse events will generate touch events
|
* "1" - Mouse events will generate touch events
|
||||||
*
|
*
|
||||||
* By default SDL will *not* generate touch events for mouse events
|
* By default SDL will *not* generate touch events for mouse events
|
||||||
|
* Except for Android, they are generated by default.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
|
#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
|
||||||
|
|
|
@ -112,14 +112,22 @@ SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldVal
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
|
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
|
||||||
|
|
||||||
if (hint && (*hint == '1' || SDL_strcasecmp(hint, "true") == 0)) {
|
if (hint == NULL || *hint == '\0') {
|
||||||
|
/* Default */
|
||||||
SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input");
|
#if defined(__ANDROID__)
|
||||||
|
mouse->mouse_touch_events = SDL_TRUE;
|
||||||
|
#else
|
||||||
|
mouse->mouse_touch_events = SDL_FALSE;
|
||||||
|
#endif
|
||||||
|
} else if (*hint == '1' || SDL_strcasecmp(hint, "true") == 0) {
|
||||||
mouse->mouse_touch_events = SDL_TRUE;
|
mouse->mouse_touch_events = SDL_TRUE;
|
||||||
} else {
|
} else {
|
||||||
mouse->mouse_touch_events = SDL_FALSE;
|
mouse->mouse_touch_events = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mouse->mouse_touch_events) {
|
||||||
|
SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Public functions */
|
/* Public functions */
|
||||||
|
|
Loading…
Reference in New Issue