@@ -1175,28 +1175,24 @@ static INLINE void android_input_poll_event_type_motion(
11751175 * and mouse deltas and don't process as touchscreen event.
11761176 * NOTE: AINPUT_SOURCE_* defines have multiple bits set so do full check
11771177 * Stylus events are now handled above in the toolType-first section */
1178- if ( (source & AINPUT_SOURCE_MOUSE ) == AINPUT_SOURCE_MOUSE
1178+ if (( (source & AINPUT_SOURCE_MOUSE ) == AINPUT_SOURCE_MOUSE
11791179 || (source & AINPUT_SOURCE_MOUSE_RELATIVE ) == AINPUT_SOURCE_MOUSE_RELATIVE )
1180+ && !is_stylus )
11801181 {
1181- /* Only handle regular mouse if not currently using stylus */
1182- if (!is_stylus )
1182+ if (!android -> mouse_activated )
11831183 {
1184- if (!android -> mouse_activated )
1185- {
1186- #ifdef DEBUG_ANDROID_INPUT
1187- RARCH_LOG ("[Android Input] Mouse activated.\n" );
1188- #endif
1189- android -> mouse_activated = true;
1190- }
1191- /* getButtonState requires API level 14 */
1192- if (p_AMotionEvent_getButtonState )
1193- {
1194- int btn = (int )AMotionEvent_getButtonState (event );
1184+ RARCH_LOG ("[Android Input] Mouse activated.\n" );
1185+ android -> mouse_activated = true;
1186+ }
1187+ /* getButtonState requires API level 14 */
1188+ if (p_AMotionEvent_getButtonState )
1189+ {
1190+ int btn = (int )AMotionEvent_getButtonState (event );
11951191
1196- /* Regular mouse button mapping (stylus events handled above) */
1197- android -> mouse_l = (btn & AMOTION_EVENT_BUTTON_PRIMARY );
1198- android -> mouse_r = (btn & AMOTION_EVENT_BUTTON_SECONDARY );
1199- android -> mouse_m = (btn & AMOTION_EVENT_BUTTON_TERTIARY );
1192+ /* Regular mouse button mapping (stylus events handled above) */
1193+ android -> mouse_l = (btn & AMOTION_EVENT_BUTTON_PRIMARY );
1194+ android -> mouse_r = (btn & AMOTION_EVENT_BUTTON_SECONDARY );
1195+ android -> mouse_m = (btn & AMOTION_EVENT_BUTTON_TERTIARY );
12001196
12011197 btn = (int )AMotionEvent_getAxisValue (event ,
12021198 AMOTION_EVENT_AXIS_VSCROLL , motion_ptr );
@@ -1205,19 +1201,18 @@ static INLINE void android_input_poll_event_type_motion(
12051201 android -> mouse_wu = btn ;
12061202 else if (btn < 0 )
12071203 android -> mouse_wd = btn ;
1208- }
1209- else
1210- {
1211- /* If getButtonState is not available
1212- * then treat all MotionEvent.ACTION_DOWN as left button presses */
1213- if (action == AMOTION_EVENT_ACTION_DOWN )
1214- android -> mouse_l = 1 ;
1215- if (action == AMOTION_EVENT_ACTION_UP )
1216- android -> mouse_l = 0 ;
1217- }
1218-
1219- android_mouse_calculate_deltas (android ,event ,motion_ptr ,source );
12201204 }
1205+ else
1206+ {
1207+ /* If getButtonState is not available
1208+ * then treat all MotionEvent.ACTION_DOWN as left button presses */
1209+ if (action == AMOTION_EVENT_ACTION_DOWN )
1210+ android -> mouse_l = 1 ;
1211+ if (action == AMOTION_EVENT_ACTION_UP )
1212+ android -> mouse_l = 0 ;
1213+ }
1214+
1215+ android_mouse_calculate_deltas (android ,event ,motion_ptr ,source );
12211216 /* If stylus is active, don't interfere with its mouse state */
12221217 return ;
12231218 }
0 commit comments