From 8e80d8a3b3ab5ca56d4bae884c4a2364c77f3fa9 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 10 Mar 2025 17:02:50 -0700 Subject: [PATCH 1/2] logs: rename threaded_app log identifier to android_activity This makes parsing logging a bit nicer for debugging stuff Changelog-Changed: Change threaded_app logs to android_activity Signed-off-by: William Casarin --- .../native_app_glue/android_native_app_glue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c b/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c index a7bcb85..9f92e46 100644 --- a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c +++ b/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c @@ -29,11 +29,11 @@ #define NATIVE_APP_GLUE_KEY_EVENTS_DEFAULT_BUF_SIZE 4 #define LOGI(...) \ - ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__)) + ((void)__android_log_print(ANDROID_LOG_INFO, "android_activity", __VA_ARGS__)) #define LOGE(...) \ - ((void)__android_log_print(ANDROID_LOG_ERROR, "threaded_app", __VA_ARGS__)) + ((void)__android_log_print(ANDROID_LOG_ERROR, "android_activity", __VA_ARGS__)) #define LOGW(...) \ - ((void)__android_log_print(ANDROID_LOG_WARN, "threaded_app", __VA_ARGS__)) + ((void)__android_log_print(ANDROID_LOG_WARN, "android_activity", __VA_ARGS__)) #define LOGW_ONCE(...) \ do { \ static bool alogw_once##__FILE__##__LINE__##__ = true; \ @@ -46,7 +46,7 @@ /* For debug builds, always enable the debug traces in this library */ #ifndef NDEBUG #define LOGV(...) \ - ((void)__android_log_print(ANDROID_LOG_VERBOSE, "threaded_app", \ + ((void)__android_log_print(ANDROID_LOG_VERBOSE, "android_activity", \ __VA_ARGS__)) #else #define LOGV(...) ((void)0) From 3de4f3af9d86976321a5e3f3304000e83fdf0d06 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 10 Mar 2025 17:28:49 -0700 Subject: [PATCH 2/2] 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 --- .../game-activity/native_app_glue/android_native_app_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c b/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c index 9f92e46..6b70cfe 100644 --- a/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c +++ b/android-activity/game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c @@ -264,7 +264,7 @@ static bool default_key_filter(const GameActivityKeyEvent* event) { static bool default_motion_filter(const GameActivityMotionEvent* event) { // Ignore any non-touch events. - return event->source == SOURCE_TOUCHSCREEN; + return event->source & SOURCE_TOUCHSCREEN; } // --------------------------------------------------------------------