Final ZWLR support commit

This commit is contained in:
anon3989 2025-09-11 19:06:50 +00:00
parent b8b08ed2f9
commit dc88ebae20
2 changed files with 11 additions and 11 deletions

View File

@ -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);

View File

@ -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
{