diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 80f2505a7..734a2d41b 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -239,6 +239,18 @@ static void pointerHandleButton(void* data UNUSED, case CENTRAL_WINDOW: break; case TOP_DECORATION: + if (state == WL_POINTER_BUTTON_STATE_PRESSED) { + monotonic_t last_click_at = window->wl.decorations.last_click_on_top_decoration_at; + window->wl.decorations.last_click_on_top_decoration_at = monotonic(); + if (window->wl.decorations.last_click_on_top_decoration_at - last_click_at <= _glfwPlatformGetDoubleClickInterval(window)) { + window->wl.decorations.last_click_on_top_decoration_at = 0; + if (window->wl.toplevel_states & TOPLEVEL_STATE_MAXIMIZED) + xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); + else + xdg_toplevel_set_maximized(window->wl.xdg.toplevel); + return; + } + } if (y < window->wl.decorations.metrics.width) edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP; else @@ -246,6 +258,7 @@ static void pointerHandleButton(void* data UNUSED, if (window->wl.xdg.toplevel) xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial); } + break; case LEFT_DECORATION: if (y < window->wl.decorations.metrics.width) diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 2018fac0b..8a8d2c4ab 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -194,6 +194,7 @@ typedef struct _GLFWwindowWayland uint32_t *data; size_t for_decoration_size, stride, segments, corner_size; } shadow_tile; + monotonic_t last_click_on_top_decoration_at; } decorations; struct {