Skip to content

Commit 3de4f3a

Browse files
committed
gameactivity: don't discard stylus touchscreen inputs
I noticed touch inputs weren't working on my Galaxy S9 tab device which includes a stylus. The value was 0xD002 for source, which seems to be: SOURCE_CLASS_POINTER 0b0000 0000 0000 0010 SOURCE_STYLUS 0b0100 0000 0000 0000 SOURCE_BLUETOOTH_STYLUS 0b1000 0000 0000 0000 SOURCE_TOUCHSCREEN 0b0001 0000 0000 0000 ---------------------------------------------- 0xD002 = 0b1101 0000 0000 0010 Let's modify default_motion_filter to use bitwise AND (&) instead of equality (==) when checking SOURCE_TOUCHSCREEN. This ensures stylus inputs (which combine touchscreen and stylus flags) are not discarded, while still filtering non-touch events. Changelog-Fixed: Fix touch inputs on tablets with a stylus Signed-off-by: William Casarin <[email protected]>
1 parent 8e80d8a commit 3de4f3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static bool default_key_filter(const GameActivityKeyEvent* event) {
264264

265265
static bool default_motion_filter(const GameActivityMotionEvent* event) {
266266
// Ignore any non-touch events.
267-
return event->source == SOURCE_TOUCHSCREEN;
267+
return event->source & SOURCE_TOUCHSCREEN;
268268
}
269269

270270
// --------------------------------------------------------------------

0 commit comments

Comments
 (0)