godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.66k stars 20.78k forks source link

Godot's "Emulate Mouse from Touch" setting is done on a per-project basis, but should be an editor setting. #97594

Closed migueldeicaza closed 1 day ago

migueldeicaza commented 3 days ago

Tested versions

Godot 4.4/b2b13d46c2fcd75502eec12c768caa23ee952900 (master as of Sep 28th).

System information

MacOS Sequoia, iOS

Issue description

Currently whether the emulate-mouse-input-from-touch setting (input_devices/pointing/emulate_mouse_from_touch) that is set for the Godot editor is derived from the project itself. The setting should govern the project itself, but should not govern the editor.

I believe that for the editor, it should always be set to true as there is little reason to not map touches to mouse events, and this setting should only be honored when running the user's game.

Steps to reproduce

Disable input_devices/pointing/emulate_mouse_from_touch on the project, restart Godot, and notice that the touch input no longer works.

Minimal reproduction project (MRP)

migueldeicaza commented 3 days ago

Something like this, happy to send a PR:

diff --git a/main/main.cpp b/main/main.cpp
index 9014bfad29..9f03d8faea 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -3189,8 +3189,11 @@ Error Main::setup2(bool p_show_boot_logo) {
                                        id->set_emulate_touch_from_mouse(true);
                                }
                        }
-
-                       id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF_BASIC("input_devices/pointing/emulate_mouse_from_touch", true)));
+                       if (editor){
+                               id->set_emulate_mouse_from_touch(true);
+                       } else {
+                               id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF_BASIC("input_devices/pointing/emulate_mouse_from_touch", true)));
+                       }
                }

                OS::get_singleton()->benchmark_end_measure("Startup", "Setup Window and Boot");
dustdfg commented 1 day ago

Should be consolidated to #96784.

Hello @AThousandShips you are one of those who can do it

AThousandShips commented 1 day ago

Thank you that's true! Consolidating