@@ -60,17 +60,16 @@ enum {
60
60
AMOTION_EVENT_BUTTON_BACK = 1 << 3 ,
61
61
AMOTION_EVENT_BUTTON_FORWARD = 1 << 4 ,
62
62
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
68
64
#endif
69
65
/* If using an NDK lower than 16b then add missing definition */
70
66
#ifndef __ANDROID_API_O_MR1__
71
67
enum {
72
68
AINPUT_SOURCE_MOUSE_RELATIVE = 0x00020000 | AINPUT_SOURCE_CLASS_NAVIGATION
73
69
};
70
+ #endif
71
+ AINPUT_SOURCE_STYLUS = 0x00004000
72
+ };
74
73
#endif
75
74
76
75
/* 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(
851
850
android -> mouse_r = (android -> pointer_count == 2 );
852
851
}
853
852
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
-
934
853
static bool android_is_keyboard_id (int id )
935
854
{
936
855
unsigned i ;
@@ -1593,13 +1512,9 @@ static void android_input_poll_input_default(android_input_t *android)
1593
1512
case AINPUT_EVENT_TYPE_MOTION :
1594
1513
if ((source & AINPUT_SOURCE_TOUCHPAD ))
1595
1514
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 );
1599
1515
/* Only handle events from a touchscreen or mouse */
1600
1516
else if ((source & (AINPUT_SOURCE_TOUCHSCREEN
1601
- | AINPUT_SOURCE_MOUSE
1602
- | AINPUT_SOURCE_MOUSE_RELATIVE )))
1517
+ | AINPUT_SOURCE_STYLUS | AINPUT_SOURCE_MOUSE )))
1603
1518
android_input_poll_event_type_motion (android , event ,
1604
1519
port , source );
1605
1520
else
0 commit comments