Implement grab keyboard for x11

This commit is contained in:
Kovid Goyal 2025-05-18 14:49:07 +05:30
parent d8b0edce43
commit 255dd2845e
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

9
glfw/x11_window.c vendored
View file

@ -3386,8 +3386,13 @@ _glfwPlatformSetWindowBlur(_GLFWwindow *window, int blur_radius) {
bool
_glfwPlatformGrabKeyboard(bool grab) {
if (grab) _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Grabbing of keyboard is not currently supported");
return false;
int result;
if (grab) {
result = XGrabKeyboard(_glfw.x11.display, _glfw.x11.root, True, GrabModeAsync, GrabModeAsync, CurrentTime);
} else {
result = XUngrabKeyboard(_glfw.x11.display, CurrentTime);
}
return result == GrabSuccess;
}
//////////////////////////////////////////////////////////////////////////