From 8f7dc862238235d7df26958ddfb2450e68984af1 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 17 Jul 2024 02:30:30 -0700 Subject: [PATCH 1/2] Enable `restart_if_changed` for the touchscreen editor settings The alternative was to regenerate the theme which caused the Android Editor to freeze while the regeneration was ongoing. --- editor/editor_settings.cpp | 2 ++ editor/plugins/curve_editor_plugin.cpp | 6 ------ editor/themes/editor_theme_manager.cpp | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 5d3cc80da9a..4b0d07b8c91 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -526,11 +526,13 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { // Touchscreen bool has_touchscreen_ui = DisplayServer::get_singleton()->is_touchscreen_available(); EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/increase_scrollbar_touch_area", has_touchscreen_ui, "") + set_restart_if_changed("interface/touchscreen/increase_scrollbar_touch_area", true); EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_long_press_as_right_click", has_touchscreen_ui, "") set_restart_if_changed("interface/touchscreen/enable_long_press_as_right_click", true); EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_pan_and_scale_gestures", has_touchscreen_ui, "") set_restart_if_changed("interface/touchscreen/enable_pan_and_scale_gestures", true); EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/touchscreen/scale_gizmo_handles", has_touchscreen_ui ? 3 : 1, "1,5,1") + set_restart_if_changed("interface/touchscreen/scale_gizmo_handles", true); // Scene tabs EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/scene_tabs/display_close_button", 1, "Never,If Tab Active,Always"); // TabBar::CloseButtonDisplayPolicy diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index e37619aa20d..041778d6343 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -118,12 +118,6 @@ void CurveEdit::_notification(int p_what) { queue_redraw(); } } break; - case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (!EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen")) { - break; - } - [[fallthrough]]; - } case NOTIFICATION_THEME_CHANGED: { float gizmo_scale = EDITOR_GET("interface/touchscreen/scale_gizmo_handles"); point_radius = Math::round(BASE_POINT_RADIUS * get_theme_default_base_scale() * gizmo_scale); diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index 03752656c00..a63b6d4e140 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -2652,8 +2652,6 @@ bool EditorThemeManager::is_generated_theme_outdated() { EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") || EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") || EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/increase_scrollbar_touch_area") || - EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/scale_gizmo_handles") || EditorSettings::get_singleton()->check_changed_settings_in_group("editors/visual_editors") || EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") || From 53a752f2d62c97ca020741db23ee1ed9f9b7760b Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 17 Jul 2024 02:44:17 -0700 Subject: [PATCH 2/2] Disable long press for mouse events Long press is used to simulate right-click events for finger touch and stylus. The previous logic also caused it to trigger for mouse input, which is not needed since the user can instead use the mouse right click button. This update disables long press as right click events for mouse input. --- .../src/org/godotengine/godot/input/GodotGestureHandler.kt | 5 ++++- .../src/org/godotengine/godot/input/GodotInputHandler.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt index 4cd3bd8db9c..2929a0a0b0f 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt @@ -76,7 +76,10 @@ internal class GodotGestureHandler(private val inputHandler: GodotInputHandler) } override fun onLongPress(event: MotionEvent) { - contextClickRouter(event) + val toolType = GodotInputHandler.getEventToolType(event) + if (toolType != MotionEvent.TOOL_TYPE_MOUSE) { + contextClickRouter(event) + } } private fun contextClickRouter(event: MotionEvent) { diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java index 889618914d6..96f291c46e7 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java @@ -472,7 +472,7 @@ public class GodotInputHandler implements InputManager.InputDeviceListener { return button; } - private static int getEventToolType(MotionEvent event) { + static int getEventToolType(MotionEvent event) { return event.getPointerCount() > 0 ? event.getToolType(0) : MotionEvent.TOOL_TYPE_UNKNOWN; }