mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
Android: remove SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH
java layer runs as if separate mouse and touch was 1, Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS for generating synthetic touch/mouse events
This commit is contained in:
@@ -73,10 +73,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
||||
public static boolean mBrokenLibraries;
|
||||
|
||||
// If we want to separate mouse and touch events.
|
||||
// This is only toggled in native code when a hint is set!
|
||||
public static boolean mSeparateMouseAndTouch;
|
||||
|
||||
// Main components
|
||||
protected static SDLActivity mSingleton;
|
||||
protected static SDLSurface mSurface;
|
||||
@@ -1772,8 +1768,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||
// 12290 = Samsung DeX mode desktop mouse
|
||||
// 12290 = 0x3002 = 0x2002 | 0x1002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN
|
||||
// 0x2 = SOURCE_CLASS_POINTER
|
||||
if ((event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == (InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHSCREEN))
|
||||
&& SDLActivity.mSeparateMouseAndTouch) {
|
||||
if (event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == (InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHSCREEN)) {
|
||||
try {
|
||||
mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event);
|
||||
} catch(Exception e) {
|
||||
|
||||
@@ -555,9 +555,6 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
|
||||
return SDLControllerManager.handleJoystickMotionEvent(event);
|
||||
|
||||
case InputDevice.SOURCE_MOUSE:
|
||||
if (!SDLActivity.mSeparateMouseAndTouch) {
|
||||
break;
|
||||
}
|
||||
action = event.getActionMasked();
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_SCROLL:
|
||||
@@ -624,14 +621,12 @@ class SDLGenericMotionListener_API24 extends SDLGenericMotionListener_API12 {
|
||||
// Handle relative mouse mode
|
||||
if (mRelativeModeEnabled) {
|
||||
if (event.getSource() == InputDevice.SOURCE_MOUSE) {
|
||||
if (SDLActivity.mSeparateMouseAndTouch) {
|
||||
int action = event.getActionMasked();
|
||||
if (action == MotionEvent.ACTION_HOVER_MOVE) {
|
||||
float x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X);
|
||||
float y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y);
|
||||
SDLActivity.onNativeMouse(0, action, x, y, true);
|
||||
return true;
|
||||
}
|
||||
int action = event.getActionMasked();
|
||||
if (action == MotionEvent.ACTION_HOVER_MOVE) {
|
||||
float x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X);
|
||||
float y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y);
|
||||
SDLActivity.onNativeMouse(0, action, x, y, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -696,10 +691,6 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
|
||||
case InputDevice.SOURCE_MOUSE:
|
||||
// DeX desktop mouse cursor is a separate non-standard input type.
|
||||
case InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHSCREEN:
|
||||
if (!SDLActivity.mSeparateMouseAndTouch) {
|
||||
break;
|
||||
}
|
||||
|
||||
action = event.getActionMasked();
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_SCROLL:
|
||||
@@ -720,9 +711,6 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
|
||||
break;
|
||||
|
||||
case InputDevice.SOURCE_MOUSE_RELATIVE:
|
||||
if (!SDLActivity.mSeparateMouseAndTouch) {
|
||||
break;
|
||||
}
|
||||
action = event.getActionMasked();
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_SCROLL:
|
||||
|
||||
Reference in New Issue
Block a user