Wayland CSD: Double clicking on titlebar should toggle window maximize
This commit is contained in:
13
glfw/wl_init.c
vendored
13
glfw/wl_init.c
vendored
@@ -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
1
glfw/wl_platform.h
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user