diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 7d9dee02..ac696cd8 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -1250,6 +1250,11 @@ extern "C" { * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). */ #define GLFW_COCOA_MENUBAR 0x00051002 +/*! @brief X11 specific init hint. + * + * X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint). + */ +#define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001 /*! @} */ #define GLFW_DONT_CARE -1 diff --git a/src/init.c b/src/init.c index a7b5af63..bca59baa 100644 --- a/src/init.c +++ b/src/init.c @@ -57,7 +57,10 @@ static _GLFWinitconfig _glfwInitHints = { GLFW_TRUE, // macOS menu bar GLFW_TRUE // macOS bundle chdir - } + }, + { + GLFW_TRUE, // X11 XCB Vulkan surface + }, }; // Terminate the library @@ -298,6 +301,9 @@ GLFWAPI void glfwInitHint(int hint, int value) case GLFW_COCOA_MENUBAR: _glfwInitHints.ns.menubar = value; return; + case GLFW_X11_XCB_VULKAN_SURFACE: + _glfwInitHints.x11.xcbVulkanSurface = value; + return; } _glfwInputError(GLFW_INVALID_ENUM, diff --git a/src/internal.h b/src/internal.h index f87c2f93..32761b1e 100644 --- a/src/internal.h +++ b/src/internal.h @@ -248,6 +248,9 @@ struct _GLFWinitconfig GLFWbool menubar; GLFWbool chdir; } ns; + struct { + GLFWbool xcbVulkanSurface; + } x11; }; // Window configuration diff --git a/src/x11_init.c b/src/x11_init.c index dd24f112..fc9ac427 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -813,11 +813,15 @@ static GLFWbool initExtensions(void) XkbGroupStateMask, XkbGroupStateMask); } + if (_glfw.hints.init.x11.xcbVulkanSurface) + { #if defined(__CYGWIN__) - _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so"); + _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so"); #else - _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1"); + _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1"); #endif + } + if (_glfw.x11.x11xcb.handle) { _glfw.x11.x11xcb.GetXCBConnection = (PFN_XGetXCBConnection)