Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Add project setting to disable raw input bulk processing.

Pāvels Nadtočajevse7c9894f22bd
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 4cf864f9bd4..2c73600b1fb 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -1874,6 +1874,7 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "input_devices/pointing/android/rotary_input_scroll_axis", PROPERTY_HINT_ENUM, "Horizontal,Vertical"), 1);
GLOBAL_DEF("input_devices/pointing/android/override_volume_buttons", false);
GLOBAL_DEF_BASIC("input_devices/pointing/android/disable_scroll_deadzone", false);
+ GLOBAL_DEF_BASIC("input_devices/compatibility/windows/disable_raw_event_bulk_processing", false);
// These properties will not show up in the dialog. If you want to exclude whole groups, use add_hidden_prefix().
GLOBAL_DEF_INTERNAL("application/config/features", PackedStringArray());
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 6975d25b07a..b9b1396589e 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1699,6 +1699,10 @@
If [code]false[/code], no input will be lost.
[b]Note:[/b] You should in nearly all cases prefer the [code]false[/code] setting. The legacy behavior is to enable supporting old projects that rely on the old logic, without changes to script.
</member>
+ <member name="input_devices/compatibility/windows/disable_raw_event_bulk_processing" type="bool" setter="" getter="" default="false">
+ If [code]true[/code], disables bulk processing of raw input, enable it if you want to process [code]WM_INPUT[/code] messages directly. Enabling this setting will significantly decrease performance with high polling rate devices.
+ [b]Note:[/b] This property is implemented only on Windows.
+ </member>
<member name="input_devices/joypads/ignore_joypad_on_unfocused_application" type="bool" setter="" getter="" default="false">
If [code]true[/code], joypad input (including motion sensors) and LED light changes will be ignored and joypad vibration will be stopped when the application is not focused.
</member>
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index b1bb4f41ffb..357abe4b26a 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -4555,7 +4555,10 @@ void DisplayServerWindows::process_events() {
_THREAD_SAFE_LOCK_
- bool has_touch_events = process_raw_input();
+ bool has_touch_events = true;
+ if (!disable_bulk_raw_input) {
+ has_touch_events = process_raw_input();
+ }
DisplayServerEnums::WindowID window_id = _get_focused_window_or_popup();
const WindowData &wd = windows[window_id];
@@ -8088,6 +8091,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Dis
return;
}
+ disable_bulk_raw_input = GLOBAL_GET("input_devices/compatibility/windows/disable_raw_event_bulk_processing");
_register_raw_input_devices(DisplayServerEnums::INVALID_WINDOW_ID);
String appname;
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index 1b2df8cf695..824db70df48 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -491,6 +491,7 @@ class DisplayServerWindows : public DisplayServer {
int restore_mouse_trails = 0;
bool use_raw_input = false;
+ bool disable_bulk_raw_input = false;
bool drop_events = false;
bool in_dispatch_input_event = false;