Skip to content

Commit 50ea594

Browse files
authored
Merge pull request #57 from zao/fix/disable-glfw-joysticks
fix: disable glfw dinput8 joysticks
2 parents cac08f0 + 8255cf0 commit 50ea594

File tree

6 files changed

+129
-1
lines changed

6 files changed

+129
-1
lines changed

vcpkg-configuration.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"kind": "filesystem",
99
"path": "vcpkg-ports",
1010
"baseline": "2024-03-26",
11-
"packages": ["luajit"]
11+
"packages": ["glfw3", "luajit"]
1212
}
1313
]
1414
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From a6dd071b7cd9c3f592dbf5cf1f301df529773833 Mon Sep 17 00:00:00 2001
2+
From: Lars Viklund <[email protected]>
3+
Date: Sat, 30 Mar 2024 21:05:35 +0100
4+
Subject: [PATCH] fix: disable dinput8 to fix startup delay
5+
6+
Some HID devices block DirectInput8 device enumeration for many seconds
7+
which adversely affects software that uses GLFW without needing
8+
joysticks at all.
9+
10+
This change skips loading of the `dinput8` library and thus disables all
11+
functionality that checks for its availability.
12+
---
13+
src/win32_init.c | 1 -
14+
1 file changed, 1 deletion(-)
15+
16+
diff --git a/src/win32_init.c b/src/win32_init.c
17+
index 824e383c..a81da94e 100644
18+
--- a/src/win32_init.c
19+
+++ b/src/win32_init.c
20+
@@ -104,7 +104,6 @@ static GLFWbool loadLibraries(void)
21+
_glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi)
22+
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
23+
24+
- _glfw.win32.dinput8.instance = _glfwPlatformLoadModule("dinput8.dll");
25+
if (_glfw.win32.dinput8.instance)
26+
{
27+
_glfw.win32.dinput8.Create = (PFN_DirectInput8Create)
28+
--
29+
2.42.0.windows.2
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO glfw/glfw
4+
REF ${VERSION}
5+
SHA512 39ad7a4521267fbebc35d2ff0c389a56236ead5fa4bdff33db113bd302f70f5f2869ff4e6db1979512e1542813292dff5a482e94dfce231750f0746c301ae9ed
6+
HEAD_REF master
7+
PATCHES
8+
glfw-3.4_disable_dinput8.patch
9+
)
10+
11+
if(VCPKG_TARGET_IS_LINUX)
12+
message(
13+
"GLFW3 currently requires the following libraries from the system package manager:
14+
xinerama
15+
xcursor
16+
xorg
17+
libglu1-mesa
18+
pkg-config
19+
20+
These can be installed on Ubuntu systems via sudo apt install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config
21+
22+
Alternatively, when targeting the Wayland display server, use the packages listed in the GLFW documentation here:
23+
24+
https://www.glfw.org/docs/3.3/compile.html#compile_deps_wayland")
25+
else(VCPKG_TARGET_IS_OSX)
26+
message(
27+
"GLFW3 currently requires the following libraries from the system package manager:
28+
xinerama
29+
xcursor
30+
xorg
31+
libglu1-mesa
32+
pkg-config
33+
34+
These can be installed via brew install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config")
35+
endif()
36+
37+
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
38+
FEATURES
39+
wayland GLFW_BUILD_WAYLAND
40+
)
41+
42+
vcpkg_cmake_configure(
43+
SOURCE_PATH "${SOURCE_PATH}"
44+
OPTIONS
45+
-DGLFW_BUILD_EXAMPLES=OFF
46+
-DGLFW_BUILD_TESTS=OFF
47+
-DGLFW_BUILD_DOCS=OFF
48+
${FEATURE_OPTIONS}
49+
)
50+
51+
vcpkg_cmake_install()
52+
53+
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/glfw3)
54+
55+
vcpkg_fixup_pkgconfig()
56+
57+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
58+
59+
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
60+
61+
vcpkg_copy_pdbs()
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "glfw3",
3+
"version": "3.4",
4+
"port-version": 1,
5+
"description": "GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc.",
6+
"homepage": "https://github.com/glfw/glfw",
7+
"license": "Zlib",
8+
"dependencies": [
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
],
18+
"features": {
19+
"wayland": {
20+
"description": "Use Wayland display server",
21+
"supports": "linux",
22+
"dependencies": [
23+
"wayland"
24+
]
25+
}
26+
}
27+
}

vcpkg-ports/versions/baseline.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"luajit": { "baseline": "2022-08-11", "port-version": 1 }
44
},
55
"2024-03-26": {
6+
"glfw3": { "baseline": "3.4", "port-version": 1 },
67
"luajit": { "baseline": "2023-04-16", "port-version": 0 }
78
}
89
}

vcpkg-ports/versions/g-/glfw3.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"versions": [
3+
{
4+
"version": "3.4",
5+
"port-version": 1,
6+
"path": "$/ports/glfw3/3.4_1"
7+
}
8+
]
9+
}

0 commit comments

Comments
 (0)