X11: add GLFW_X11_XCB init hint

This commit is contained in:
Nicolas Caramelli 2020-11-11 00:02:44 +01:00
parent 0b12ddc061
commit 71eb156c6d
4 changed files with 12 additions and 2 deletions

View File

@ -1250,6 +1250,11 @@ extern "C" {
* macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
*/ */
#define GLFW_COCOA_MENUBAR 0x00051002 #define GLFW_COCOA_MENUBAR 0x00051002
/*! @brief X11 specific init hint.
*
* X11 specific [init hint](@ref GLFW_X11_XCB_hint).
*/
#define GLFW_X11_XCB 0x00051003
/*! @} */ /*! @} */
#define GLFW_DONT_CARE -1 #define GLFW_DONT_CARE -1

View File

@ -57,7 +57,8 @@ static _GLFWinitconfig _glfwInitHints =
{ {
GLFW_TRUE, // macOS menu bar GLFW_TRUE, // macOS menu bar
GLFW_TRUE // macOS bundle chdir GLFW_TRUE // macOS bundle chdir
} },
GLFW_TRUE, // X11 XCB
}; };
// Terminate the library // Terminate the library
@ -298,6 +299,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
case GLFW_COCOA_MENUBAR: case GLFW_COCOA_MENUBAR:
_glfwInitHints.ns.menubar = value; _glfwInitHints.ns.menubar = value;
return; return;
case GLFW_X11_XCB:
_glfwInitHints.x11_xcb = value;
return;
} }
_glfwInputError(GLFW_INVALID_ENUM, _glfwInputError(GLFW_INVALID_ENUM,

View File

@ -248,6 +248,7 @@ struct _GLFWinitconfig
GLFWbool menubar; GLFWbool menubar;
GLFWbool chdir; GLFWbool chdir;
} ns; } ns;
GLFWbool x11_xcb;
}; };
// Window configuration // Window configuration

View File

@ -813,7 +813,7 @@ static GLFWbool initExtensions(void)
XkbGroupStateMask, XkbGroupStateMask); XkbGroupStateMask, XkbGroupStateMask);
} }
if (!getenv("GLFW_NO_XCB")) if (_glfw.hints.init.x11_xcb)
{ {
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so"); _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so");