Skip to content

Commit c72f861

Browse files
hunterkLibretroAdmin
authored andcommitted
revert abcd427
since it appears to be involved with a variety of input issues: #15757
1 parent 37c9c17 commit c72f861

File tree

1 file changed

+5
-90
lines changed

1 file changed

+5
-90
lines changed

input/drivers/android_input.c

Lines changed: 5 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,16 @@ enum {
6060
AMOTION_EVENT_BUTTON_BACK = 1 << 3,
6161
AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
6262
AMOTION_EVENT_AXIS_VSCROLL = 9,
63-
AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
64-
AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER,
65-
AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
66-
AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6
67-
};
63+
AMOTION_EVENT_ACTION_HOVER_MOVE = 7
6864
#endif
6965
/* If using an NDK lower than 16b then add missing definition */
7066
#ifndef __ANDROID_API_O_MR1__
7167
enum {
7268
AINPUT_SOURCE_MOUSE_RELATIVE = 0x00020000 | AINPUT_SOURCE_CLASS_NAVIGATION
7369
};
70+
#endif
71+
AINPUT_SOURCE_STYLUS = 0x00004000
72+
};
7473
#endif
7574

7675
/* If using an SDK lower than 24 then add missing relative axis codes */
@@ -851,86 +850,6 @@ static INLINE void android_input_poll_event_type_motion(
851850
android->mouse_r = (android->pointer_count == 2);
852851
}
853852

854-
855-
static INLINE void android_input_poll_event_type_motion_stylus(
856-
android_input_t *android, AInputEvent *event,
857-
int port, int source)
858-
{
859-
int getaction = AMotionEvent_getAction(event);
860-
int action = getaction & AMOTION_EVENT_ACTION_MASK;
861-
size_t motion_ptr = getaction >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
862-
863-
if (ENABLE_TOUCH_SCREEN_MOUSE)
864-
{
865-
// mouse right button press on stylus primary button
866-
int btn = (int)AMotionEvent_getButtonState(event);
867-
android->mouse_r = (btn & AMOTION_EVENT_BUTTON_STYLUS_PRIMARY);
868-
}
869-
870-
bool hovered_or_moving = (
871-
action == AMOTION_EVENT_ACTION_HOVER_MOVE
872-
|| action == AMOTION_EVENT_ACTION_MOVE);
873-
874-
if (hovered_or_moving && motion_ptr < MAX_TOUCH)
875-
{
876-
if (ENABLE_TOUCH_SCREEN_MOUSE)
877-
{
878-
if (action == AMOTION_EVENT_ACTION_MOVE) {
879-
android->mouse_l = 1;
880-
} else {
881-
android->mouse_l = 0;
882-
}
883-
884-
android_mouse_calculate_deltas(android,event,motion_ptr,source);
885-
}
886-
887-
if (action == AMOTION_EVENT_ACTION_MOVE) {
888-
// move pointer
889-
890-
struct video_viewport vp;
891-
float x = AMotionEvent_getX(event, motion_ptr);
892-
float y = AMotionEvent_getY(event, motion_ptr);
893-
894-
vp.x = 0;
895-
vp.y = 0;
896-
vp.width = 0;
897-
vp.height = 0;
898-
vp.full_width = 0;
899-
vp.full_height = 0;
900-
901-
video_driver_translate_coord_viewport_wrap(
902-
&vp,
903-
x, y,
904-
&android->pointer[motion_ptr].x,
905-
&android->pointer[motion_ptr].y,
906-
&android->pointer[motion_ptr].full_x,
907-
&android->pointer[motion_ptr].full_y);
908-
909-
android->pointer_count = MAX(
910-
android->pointer_count,
911-
motion_ptr + 1);
912-
} else if (action == AMOTION_EVENT_ACTION_HOVER_MOVE) {
913-
// release the pointer
914-
915-
memmove(android->pointer + motion_ptr,
916-
android->pointer + motion_ptr + 1,
917-
(MAX_TOUCH - motion_ptr - 1) * sizeof(struct input_pointer));
918-
919-
if (android->pointer_count > 0)
920-
android->pointer_count--;
921-
}
922-
} else if ((action == AMOTION_EVENT_ACTION_HOVER_EXIT) && motion_ptr < MAX_TOUCH) {
923-
if (ENABLE_TOUCH_SCREEN_MOUSE)
924-
{
925-
android->mouse_l = 0;
926-
927-
android_mouse_calculate_deltas(android,event,motion_ptr,source);
928-
}
929-
930-
// pointer was already released during AMOTION_EVENT_ACTION_HOVER_MOVE
931-
}
932-
}
933-
934853
static bool android_is_keyboard_id(int id)
935854
{
936855
unsigned i;
@@ -1593,13 +1512,9 @@ static void android_input_poll_input_default(android_input_t *android)
15931512
case AINPUT_EVENT_TYPE_MOTION:
15941513
if ((source & AINPUT_SOURCE_TOUCHPAD))
15951514
engine_handle_touchpad(android_app, event, port);
1596-
else if ((source & AINPUT_SOURCE_STYLUS) == AINPUT_SOURCE_STYLUS)
1597-
android_input_poll_event_type_motion_stylus(android, event,
1598-
port, source);
15991515
/* Only handle events from a touchscreen or mouse */
16001516
else if ((source & (AINPUT_SOURCE_TOUCHSCREEN
1601-
| AINPUT_SOURCE_MOUSE
1602-
| AINPUT_SOURCE_MOUSE_RELATIVE)))
1517+
| AINPUT_SOURCE_STYLUS | AINPUT_SOURCE_MOUSE)))
16031518
android_input_poll_event_type_motion(android, event,
16041519
port, source);
16051520
else

0 commit comments

Comments
 (0)