Repository navigation
Linux: open the window manager's window menu from custom titlebars (Wayland show_window_menu, X11 _GTK_SHOW_WINDOW_MENU) - #2196
Merged
Conversation
…ayland show_window_menu, X11 _GTK_SHOW_WINDOW_MENU)
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.
Part of #313: the window-menu half. Decoration mode, tiled edges and available actions are not in this PR.
What changed
platform/x11/window_menu.rs: when the window manager lists_GTK_SHOW_WINDOW_MENUin_NET_SUPPORTED, Rune sends that message to the root window as GTK does (data.l= pointer device 2, x and y on the root window, withSubstructureRedirect | SubstructureNotify), on the shared X11 connection (platform::x11::query). The position is the click converted to root coordinates, the current pointer, or the window's top-left corner for Alt+Space. winit's X11show_window_menudoes nothing, which is why Rune sends the message itself.window/chrome.rs:window_menucalls winit'sshow_window_menu(xdg_toplevel.show_window_menu) at the click, or at the window's top-left corner for the keyboard.has_window_menuis now true on Wayland, and on X11 when the window manager lists the message, so Alt+Space that no handler takes opens the menu on Linux as it does on Windows._NET_SUPPORTEDagain, which costs a few short round trips to the X server.runtime/input/titlebar.rs: thedead_codeattribute onWindowMenunow covers Linux too.Not in this PR
Reading the decoration mode, tiled edges and available window actions. These need a public API with an explicit "unknown" value. On Wayland, winit would also need to expose the compositor's tiled state and available actions.
Testing
Not compiled or run: the environment this was written in had no Rust toolchain. I checked the x11rb calls against how
platform/x11/activation.rsuses them, and the winit call against the vendored source. Added unit tests inplatform/x11/window_menu_tests.rsfor the message contents and the_NET_SUPPORTEDcheck. Before merging, please run on Linux:cargo check -p rune,cargo clippy -p rune --lib,cargo test -p rune --lib window_menu, and try a right-click on a.window_drag()region on GNOME and KDE, under both X11 and Wayland.Closes #313