summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-11-10 13:17:20 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2023-12-18 22:36:54 +0200
commite01b22a69d56f26ba084490c7648d4319caaa679 (patch)
tree21b2f539a9c968671d7a9933919697d1a0bdccf3
parentbf8dd73e9d88d6ab146506699f43230b12c6a2b0 (diff)
downloadredot-engine-e01b22a69d56f26ba084490c7648d4319caaa679.tar.gz
[Windows] Make Windows Ink tablet API default, add dummy driver to disable tablet input.
-rw-r--r--doc/classes/DisplayServer.xml4
-rw-r--r--main/main.cpp2
-rw-r--r--platform/windows/display_server_windows.cpp32
3 files changed, 22 insertions, 16 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index b8f82accfc..8436cbf6ee 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -1122,6 +1122,10 @@
<param index="0" name="name" type="String" />
<description>
Set active tablet driver name.
+ Supported drivers:
+ - [code]winink[/code]: Windows Ink API, default (Windows 8.1+ required).
+ - [code]wintab[/code]: Wacom Wintab API (compatible device driver required).
+ - [code]dummy[/code]: Dummy driver, tablet input is disabled.
[b]Note:[/b] This method is implemented only on Windows.
</description>
</method>
diff --git a/main/main.cpp b/main/main.cpp
index 350b8606b9..0570af3566 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2502,7 +2502,7 @@ Error Main::setup2() {
OS::get_singleton()->benchmark_begin_measure("Servers", "Tablet Driver");
GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver", "");
- GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.windows", PROPERTY_HINT_ENUM, "wintab,winink"), "");
+ GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.windows", PROPERTY_HINT_ENUM, "winink,wintab,dummy"), "");
if (tablet_driver.is_empty()) { // specified in project.godot
tablet_driver = GLOBAL_GET("input_devices/pen_tablet/driver");
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 77dfff2e5d..0f7003c303 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -4606,6 +4606,22 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
}
}
+ // Note: Windows Ink API for pen input, available on Windows 8+ only.
+ // Note: DPI conversion API, available on Windows 8.1+ only.
+ HMODULE user32_lib = LoadLibraryW(L"user32.dll");
+ if (user32_lib) {
+ win8p_GetPointerType = (GetPointerTypePtr)GetProcAddress(user32_lib, "GetPointerType");
+ win8p_GetPointerPenInfo = (GetPointerPenInfoPtr)GetProcAddress(user32_lib, "GetPointerPenInfo");
+ win81p_LogicalToPhysicalPointForPerMonitorDPI = (LogicalToPhysicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "LogicalToPhysicalPointForPerMonitorDPI");
+ win81p_PhysicalToLogicalPointForPerMonitorDPI = (PhysicalToLogicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "PhysicalToLogicalPointForPerMonitorDPI");
+
+ winink_available = win8p_GetPointerType && win8p_GetPointerPenInfo;
+ }
+
+ if (winink_available) {
+ tablet_drivers.push_back("winink");
+ }
+
// Note: Wacom WinTab driver API for pen input, for devices incompatible with Windows Ink.
HMODULE wintab_lib = LoadLibraryW(L"wintab32.dll");
if (wintab_lib) {
@@ -4622,21 +4638,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
tablet_drivers.push_back("wintab");
}
- // Note: Windows Ink API for pen input, available on Windows 8+ only.
- // Note: DPI conversion API, available on Windows 8.1+ only.
- HMODULE user32_lib = LoadLibraryW(L"user32.dll");
- if (user32_lib) {
- win8p_GetPointerType = (GetPointerTypePtr)GetProcAddress(user32_lib, "GetPointerType");
- win8p_GetPointerPenInfo = (GetPointerPenInfoPtr)GetProcAddress(user32_lib, "GetPointerPenInfo");
- win81p_LogicalToPhysicalPointForPerMonitorDPI = (LogicalToPhysicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "LogicalToPhysicalPointForPerMonitorDPI");
- win81p_PhysicalToLogicalPointForPerMonitorDPI = (PhysicalToLogicalPointForPerMonitorDPIPtr)GetProcAddress(user32_lib, "PhysicalToLogicalPointForPerMonitorDPI");
-
- winink_available = win8p_GetPointerType && win8p_GetPointerPenInfo;
- }
-
- if (winink_available) {
- tablet_drivers.push_back("winink");
- }
+ tablet_drivers.push_back("dummy");
if (OS::get_singleton()->is_hidpi_allowed()) {
HMODULE Shcore = LoadLibraryW(L"Shcore.dll");