Wayland CSD: Double clicking on titlebar should toggle window maximize

This commit is contained in:
Kovid Goyal
2021-04-19 08:58:29 +05:30
parent 50f8aeeaf6
commit 9a2b0b6995
2 changed files with 14 additions and 0 deletions

13
glfw/wl_init.c vendored
View File

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

1
glfw/wl_platform.h vendored
View File

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