Repository navigation
fix(linux): open the window manager's window menu on right-click of bare window_drag regions - #2271
Merged
Merged
Conversation
…are window_drag regions Refs #313
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.
Refs #313
Root cause
RuntimeCore::secondary_region_down(crates/rune/src/runtime/input/titlebar.rs) only treated a right-press on a bare.window_drag()region as a titlebar menu gesture whileself.host.titlebar.caption.is_some().caption(window/chrome.rs), so on Linux (both borderless windows andApp::titlebar)window_menuwas never requested and the Wayland/X11 code from Linux: open the window manager's window menu from custom titlebars (Wayland show_window_menu, X11 _GTK_SHOW_WINDOW_MENU) #2196 never ran.Protocol fixes found in #2196
flowchart LR A[Right press on bare .window_drag] --> B{WindowMenuTrigger} B -->|OnPress: Wayland| C[Request::Menu on Pressed -> xdg_toplevel.show_window_menu with press serial] B -->|OnRelease: Windows, X11| D[TitlebarPress::SecondaryOnRegion -> Request::Menu on Released] B -->|None: macOS, unsupported X11, Windows w/o caption| E[No menu]xdg_toplevel.show_window_menu):xdg-shellrequires the button-press serial, andwinit/smithay-client-toolkitoverwriteslatest_button_serial()on button release. Callingshow_window_menuonMouseInput::Releasedsent the release serial (ignored by Mutter < 50, cosmic-comp, and wlroots). Wayland now triggersWindowMenuTrigger::OnPressandwindow/host/events.rsdrainstake_window_menu()onMouseInput::Pressed, matching GTK4 (GtkWindowHandle), Chromium (WindowEventFilterLinux),sctk-adwaita, and GLFW._GTK_SHOW_WINDOW_MENU): Rune sends the client message on its separatex11rbquery connection (which cannotUngrabPointerwinit's connection), so X11 usesWindowMenuTrigger::OnReleaseafter the X server releases winit's implicit button grab.platform/x11/window_menu.rsalso short-circuitsmenu_atomwhen_GTK_SHOW_WINDOW_MENUis uninterned (atom == 0) and guardstranslate_coordinateswithsame_screen._NET_SUPPORTEDread via feat(window): expose reactive Cx decoration mode, tiled edges and window actions with X11 backend #2249:sync_wm_state_core(crates/rune/src/window/chrome.rs) sets the LinuxWindowMenuTriggerfromplatform::x11::wm_state::read'sactions.window_menuinstead of querying_NET_SUPPORTEDa second time, and honoursSome(false)once Waylandwm_capabilitieslands.Host::shell(crates/rune/src/window/host/lifecycle.rs) now passesrt.pointer()(scaled byrt.zoom()) forWindowMenu::Pointerinstead ofNone(which fell back to(0, 0)on Wayland).TitlebarPress::Holding):Event::SecondaryDown { trigger }preserves fix(titlebar): defer Linux mouse window drags past 8 pt so Wayland and X11 titlebar double-clicks work #2252's cancellation ofHoldingon secondary press (preventing deferred drags after a right-click) and is covered together with fix(titlebar): defer Linux mouse window drags past 8 pt so Wayland and X11 titlebar double-clicks work #2252 for right-press while left-press is held, right-press after left-click within double-click time, and stray/misplaced right-release while left-press is held.What was verified and what was not
titlebar_window_menu_tests.rs+window::chrome::tests), Windowscargo clippy -p rune --lib --bins --tests,cargo check -p rune --no-default-features --target wasm32-unknown-unknown, macOScheck.sh(clippy+ 327 tests inruntime::input::,window::chrome::,window::wm_state::,platform::x11::,runtime::tests::titlebar_press::), Linux aarch64 containercheck-linux.shclippy -p rune --lib --bins --tests, andscripts/file-size.sh.winit's Waylandshow_window_menuonly stores pointer/touch serials, not keyboard serials (soAlt+Spacethrough winit on a compositor that does not interceptAlt+Spaceitself has no keyboard serial).