Repository navigation
fix(titlebar): defer Linux mouse window drags past 8 pt so Wayland and X11 titlebar double-clicks work - #2252
Merged
Merged
Conversation
…d X11 titlebar double-clicks work
This was referenced Nov 25, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2224
Root cause
.window_drag()region steppedTitlebarPress(crates/rune/src/runtime/input/titlebar.rs) directly intoTitlebarAction::Dragon mouse-down.WindowEvent::MouseInput(crates/rune/src/window/host/events.rs) immediately calledwindow.drag_window()(crates/rune/src/window/surface/win.rs), sendingxdg_toplevel.moveon Wayland (or_NET_WM_MOVERESIZEon X11) for stationary clicks.wl_pointer.leave(and can briefly trigger tiling overlays or focus flicker, clearing the armed pair), so a double-click either showed tiling UI or sent a secondxdg_toplevel.moveinstead ofTitlebarAction::DoubleClick(toggle_maximized).What changed
TitlebarPress(crates/rune/src/runtime/input/titlebar.rs) with aHolding(Pair)state andEvent::{Move, Release, Leave, OtherPress}:DEFER_MOUSE_DRAG), a primary mouse press on a bare.window_drag()region entersHolding(Pair)without emittingTitlebarAction::Drag.>= 8.0points on either axis (DRAG_THRESHOLD = 8.0, matching GTK'sgtk-dnd-drag-thresholdand Chromium'sWindowEventFilterLinux) transitionsHolding(pair) -> Armed(pair)and emitsTitlebarAction::Dragonce. Winit's Wayland backend preserveslatest_button_serialacrossMotionevents, soxdg_toplevel.movecarries the original press serial; X11'sdrag_window()queries pointer coordinates and sends_NET_WM_MOVERESIZEwhile button 1 is held.Event::LeavetransitionsHolding(pair) -> Armed(pair)with no drag, so stationary double-clicks (press -> release -> press,press -> small motion < 8 pt -> release -> press, andpress -> leave -> enter -> presswith no release in between) emitTitlebarAction::DoubleClickwhen the second press lands withindouble_click_intervalandCLICK_SLOP(4 pt). Following Chromium'sWindowEventFilterLinux, double-click pairing is judged by press time and distance even if a slight drag crossed the threshold on the first press.Event::Clear(focus loss /cancel_pointer) resets toRest.move_pointer,observe_pointer,pointer_up, andpointer_leave(crates/rune/src/runtime/input/pointer.rs) intoTitlebarPress, and drainedtake_titlebar_action()fromWindowEvent::CursorMoved(crates/rune/src/window/host/events.rs) andOverlayCore::cursor_moved(crates/rune/src/overlay/input.rs).Dragon press for AppKit'sperformWindowDragWithEvent:), Windows (keepsWM_NCHITTESTHTCAPTIONhit-testing and immediate fallback), touch (keepsMode::WindowDragPending/TOUCH_SLOP/ long-press intouch.rs),.window_drag()regions with their ownon_double_press, and interactive title bar children.stateDiagram-v2 [*] --> Rest Rest --> Holding: Region (defer=true) Holding --> Holding: Move (< 8 pt) Holding --> Armed: Move (>= 8 pt) / Drag Holding --> Armed: Release | Leave Armed --> Rest: Region (within interval & 4 pt) / DoubleClick Armed --> Holding: Region (outside interval or 4 pt, defer=true) Holding --> Rest: Clear | Resize | OtherPress Armed --> Rest: Clear | ResizeVerification
TitlebarPress::step,Runtime,cursor_moved_core,OverlayCore, touch, title bar buttons, customon_double_press, andrune-kitshells:cargo test -p rune --lib -- titlebar runtime::input overlay::input pointer_hit cursor_moved_core_wakes(298 passed),cargo clippy -p rune -p rune-kit --lib --bins --tests --features rune-kit/markdown,rune-kit/mermaid(pass),cargo check -p rune --no-default-features --target wasm32-unknown-unknown(pass).cargo test -p rune --lib -- titlebar runtime::input overlay::input pointer_hit cursor_moved_core_wakes(295 non-GPU tests passed),cargo test -p rune --test integration titlebar(1 passed),cargo test -p rune-kit --test integration --features rune-kit/markdown,rune-kit/mermaid shell(48 passed),cargo clippy -p rune --lib --bins(pass).cargo test -p rune --lib -- titlebar runtime::input overlay::input pointer_hit cursor_moved_core_wakes(298 passed),cargo test -p rune --test integration titlebar(1 passed),cargo test -p rune-kit --test integration --features rune-kit/markdown,rune-kit/mermaid shell(48 passed).scripts/file-size.sh(0 errors).