diff options
| author | srdusr <[email protected]> | 2026-01-28 14:20:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2026-01-28 14:20:00 +0200 |
| commit | d16f7dab25bd9508271017bc6dc15024c30cbf71 (patch) | |
| tree | 86162f301d361cea5aced086e644707a7366c261 /crates/wayland/src/input/pointer.rs | |
| parent | 393f886eb9e275c3b7a9e3ef396092ba71297dfb (diff) | |
| download | srdwm-d16f7dab25bd9508271017bc6dc15024c30cbf71.tar.gz srdwm-d16f7dab25bd9508271017bc6dc15024c30cbf71.zip | |
Redesign the titlebar right-click menu: real separators/headers, live customization
Reported live: "looks very ugly currently and some of it doesn't make
sense." Both were real. Every row, including a bare divider, took one
full TITLEBAR_HEIGHT slot, so a separator was a 1px hairline in the
middle of 32px of empty space; "Move to Workspace" faked a section
caption by embedding box-drawing characters directly in an ordinary
item's label, which rendered - and behaved, until the click-dispatch
site's own special case - exactly like a clickable row that did
nothing. Separately, "Floating" was always offered even though
Window::floating only affects the "tiling" layout: toggling it under
this project's own default "dynamic" layout visibly changes nothing,
reading as a broken control rather than an inapplicable one.
ContextMenu (crates/core/src/context_menu.rs) gained real Separator
(9px) and Header (22px, non-interactive, dimmed) row kinds with their
own small heights, replacing the label-hack outright. Both backends'
rendering now sum each row's own real height instead of assuming one
uniform value, so hit-testing and pixels can't disagree about where a
row is. Floating is omitted entirely outside the tiling layout.
New, in direct response to "allow customizing from there as well": a
Customize section with live Button Style / Button Side toggles. Each
flips the matching ThemeConfig field and immediately redraws every open
window's titlebar - not routed through srd set's own path, which is
scoped to windows created after the call for lack of a redraw hook it
can reach; a menu action that didn't visibly change the titlebar you
clicked would be its own "doesn't make sense" bug.
Full workspace build/test/clippy clean (242 core tests, +8; 152
wayland, net-even after rewriting the old label-hack tests).
Diffstat (limited to 'crates/wayland/src/input/pointer.rs')
| -rw-r--r-- | crates/wayland/src/input/pointer.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/wayland/src/input/pointer.rs b/crates/wayland/src/input/pointer.rs index 2ecc15c..c6ed5ba 100644 --- a/crates/wayland/src/input/pointer.rs +++ b/crates/wayland/src/input/pointer.rs @@ -514,14 +514,15 @@ pub(crate) fn handle_pointer_button(state: &mut CompState, pos: Point<f64, Logic if let Some(menu) = state.context_menu.take() { if let Some(row) = menu.row_at(pos.x as i32, pos.y as i32) { let (_, action) = menu.items[row]; - // A separator row occupies real space (`row_at` resolves a - // click on it same as any other) but isn't a real action -- - // same "click does nothing, menu stays open" convention any - // native menu's own divider follows, rather than either - // running a no-op action or dismissing the whole menu on - // what was very possibly a slightly-off click at a real - // item just above/below it. - if matches!(action, crate::context_menu::MenuAction::Separator) { + // A separator or section-header row occupies real space + // (`row_at` resolves a click on it same as any other) but + // isn't a real action - same "click does nothing, menu + // stays open" convention any native menu's own divider/ + // caption follows, rather than either running a no-op + // action or dismissing the whole menu on what was very + // possibly a slightly-off click at a real item just + // above/below it. + if !action.is_interactive() { state.context_menu = Some(menu); return; } |