diff --git a/examples/wayland-widget.c b/examples/wayland-widget.c index 9ad6e7698..7af039dae 100644 --- a/examples/wayland-widget.c +++ b/examples/wayland-widget.c @@ -48,7 +48,7 @@ int main(int argc, char** argv) if (!glfwInit()) return 1; - //glfwWindowHint(GLFW_WAYLAND_ZWLR_KEYBOARD_ON_FOCUS, GLFW_TRUE); // no need to call glfwWaylandSetKeyboardFocus manually + glfwWindowHint(GLFW_WAYLAND_ZWLR_KEYBOARD_ON_FOCUS, GLFW_TRUE); // no need to call glfwWaylandSetKeyboardFocus manually glfwWindowHint(GLFW_WAYLAND_USE_ZWLR, GLFW_WAYLAND_ZWLR_LAYER_TOP); GLFWwindow* window = glfwCreateWindow(600, 400, "Don't Care", NULL, NULL); @@ -113,7 +113,7 @@ void nk_process(GLFWwindow* window, struct nk_context* ctx, float width, float h nk_layout_row_dynamic(ctx, 30, 1); { static char inputBuff[64]; - sprintf(inputBuff, "Mouse focus: %b | Char received: %i", + sprintf(inputBuff, "Window focus: %b | Char received: %i", glfwGetWindowAttrib(window, GLFW_FOCUSED), LastCharPressed); nk_label(ctx, inputBuff, NK_TEXT_CENTERED); diff --git a/src/wl_window.c b/src/wl_window.c index 49ce93e93..c0947db2e 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1656,19 +1656,19 @@ static void pointerHandleLeave(void* userData, _glfw.wl.serial = serial; _glfw.wl.pointerFocus = NULL; - if (_glfw.hints.window.wl.zwlrKeyboardGrabOnFocus) - { - if (window->wl.zwlr.surface) // TODO: find out why wl.hovered not fired - { - zwlr_layer_surface_v1_set_keyboard_interactivity(window->wl.zwlr.surface, - ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE); - } - } - if (window->wl.hovered) { window->wl.hovered = GLFW_FALSE; _glfwInputCursorEnter(window, GLFW_FALSE); + + if (_glfw.hints.window.wl.zwlrKeyboardGrabOnFocus) + { + if (window->wl.zwlr.surface) + { + zwlr_layer_surface_v1_set_keyboard_interactivity(window->wl.zwlr.surface, + ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE); + } + } } else {