Skip to content

Commit 07c3951

Browse files
committed
Merge pull request #96697 from devloglogan/long-press-fix
Disable some android editor settings by default on XR devices
2 parents a0823ce + 16e1d8a commit 07c3951

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

editor/editor_settings.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,18 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
527527

528528
// Touchscreen
529529
bool has_touchscreen_ui = DisplayServer::get_singleton()->is_touchscreen_available();
530-
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/increase_scrollbar_touch_area", has_touchscreen_ui, "")
531-
set_restart_if_changed("interface/touchscreen/increase_scrollbar_touch_area", true);
532-
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_long_press_as_right_click", has_touchscreen_ui, "")
533-
set_restart_if_changed("interface/touchscreen/enable_long_press_as_right_click", true);
534530
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_pan_and_scale_gestures", has_touchscreen_ui, "")
535531
set_restart_if_changed("interface/touchscreen/enable_pan_and_scale_gestures", true);
536532
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/touchscreen/scale_gizmo_handles", has_touchscreen_ui ? 3 : 1, "1,5,1")
537533
set_restart_if_changed("interface/touchscreen/scale_gizmo_handles", true);
538534

535+
// Disable some touchscreen settings by default for the XR Editor.
536+
bool is_native_touchscreen = has_touchscreen_ui && !OS::get_singleton()->has_feature("xr_editor");
537+
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_long_press_as_right_click", is_native_touchscreen, "")
538+
set_restart_if_changed("interface/touchscreen/enable_long_press_as_right_click", true);
539+
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/increase_scrollbar_touch_area", is_native_touchscreen, "")
540+
set_restart_if_changed("interface/touchscreen/increase_scrollbar_touch_area", true);
541+
539542
// Scene tabs
540543
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/scene_tabs/display_close_button", 1, "Never,If Tab Active,Always"); // TabBar::CloseButtonDisplayPolicy
541544
_initial_set("interface/scene_tabs/show_thumbnail_on_hover", true);

platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,4 +511,12 @@ abstract class BaseGodotEditor : GodotActivity() {
511511
val godot = godot ?: return Error.ERR_UNCONFIGURED
512512
return verifyApk(godot.fileAccessHandler, apkPath)
513513
}
514+
515+
override fun supportsFeature(featureTag: String): Boolean {
516+
if (featureTag == "xr_editor") {
517+
return isNativeXRDevice();
518+
}
519+
520+
return false
521+
}
514522
}

platform/android/java/lib/src/org/godotengine/godot/Godot.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,10 @@ class Godot(private val context: Context) {
992992
*/
993993
@Keep
994994
private fun hasFeature(feature: String): Boolean {
995+
if (primaryHost?.supportsFeature(feature) ?: false) {
996+
return true;
997+
}
998+
995999
for (plugin in pluginRegistry.allPlugins) {
9961000
if (plugin.supportsFeature(feature)) {
9971001
return true

platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,12 @@ public Error verifyApk(@NonNull String apkPath) {
501501
}
502502
return Error.ERR_UNAVAILABLE;
503503
}
504+
505+
@Override
506+
public boolean supportsFeature(String featureTag) {
507+
if (parentHost != null) {
508+
return parentHost.supportsFeature(featureTag);
509+
}
510+
return false;
511+
}
504512
}

platform/android/java/lib/src/org/godotengine/godot/GodotHost.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,13 @@ default Error signApk(@NonNull String inputPath, @NonNull String outputPath, @No
136136
default Error verifyApk(@NonNull String apkPath) {
137137
return Error.ERR_UNAVAILABLE;
138138
}
139+
140+
/**
141+
* Returns whether the given feature tag is supported.
142+
*
143+
* @see <a href="https://docs.godotengine.org/en/stable/tutorials/export/feature_tags.html">Feature tags</a>
144+
*/
145+
default boolean supportsFeature(String featureTag) {
146+
return false;
147+
}
139148
}

0 commit comments

Comments
 (0)