srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/input
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2026-05-11 16:44:00 +0200
committersrdusr <[email protected]>2026-05-11 16:44:00 +0200
commitcaec1e7c355bbe6437afe87cd3dab6b64fb91e0a (patch)
tree5ecab25d2ebc36949ac4129b35e35334a575d563 /crates/wayland/src/input
parentbaabd91411dacd179c690f724b6cbfe6270cb131 (diff)
downloadsrdwm-caec1e7c355bbe6437afe87cd3dab6b64fb91e0a.tar.gz
srdwm-caec1e7c355bbe6437afe87cd3dab6b64fb91e0a.zip
Three live bug reports after a restart: icon drag, lock cursor, lock box
All three reported directly after the owner restarted into today's build. Desktop icons could not be dragged at all in single-click mode. The press handler opened the icon immediately when general.desktop_icon_single_click was on, so the branch that starts a drag was unreachable and an icon could never be moved. Deciding activation on press cannot distinguish a click from the first instant of a drag. Every press on an icon now starts a potential drag and release decides which it was, using a 4px movement threshold that latches once exceeded. Double-click mode goes through the same path, so both modes now drag identically. The lock screen drew no cursor. The cursor push in the udev render loop sits inside `if !locked`, and a locked head renders only the lock element list, so nothing drew a pointer - and on a bare TTY nothing else does. The on-screen keyboard's clicks were being handled correctly the whole time (native_lock_click); they simply could not be aimed. The pointer is now prepended to the lock element list, above the UI it is used to click. The password field's opaque panel is gone. New LockConfig::box_opacity, default 0.0: no fill, no border, no rounded rectangle, just the dots and status text over the blurred background. Raising it restores the panel at that opacity for anyone who wants a solid field. Drawing text on a transparent surface needed a new blit_glyph_over: the existing blit_glyph blends against one flat opaque colour and writes alpha 255, which would have turned every glyph into a block of the assumed background - the same box with its middle removed. VERIFICATION STATUS, stated plainly: all three are code-complete and the suite passes, but none is confirmed on screen. The nested backend's capture pass does not draw the desktop icon grid (a gap already recorded in winit/capture.rs), so the icon drag cannot be checked by screenshot there, and aiming blind is what this project's own rules forbid. The two lock changes were not visually checked either. 515 tests pass, clippy clean.
Diffstat (limited to 'crates/wayland/src/input')
-rw-r--r--crates/wayland/src/input/pointer.rs52
1 files changed, 33 insertions, 19 deletions
diff --git a/crates/wayland/src/input/pointer.rs b/crates/wayland/src/input/pointer.rs
index e82b25f..85d1eff 100644
--- a/crates/wayland/src/input/pointer.rs
+++ b/crates/wayland/src/input/pointer.rs
@@ -729,27 +729,30 @@ pub(crate) fn handle_pointer_button(state: &mut CompState, pos: Point<f64, Logic
.and_then(|icons| icons.icon_at(pos.x as i32, pos.y as i32).map(|(i, origin)| (icons.icons[i].id.clone(), origin)));
match icon_hit {
Some((id, origin)) => {
- let single_click_opens = state.wm.borrow().desktop_icon_single_click;
- if single_click_opens || state.is_double_click_icon(&id, time) {
+ // Always a *potential* drag, whichever activation
+ // mode is configured. Opening is decided on
+ // release instead (see the release handler's own
+ // `desktop_icon_click` branch), because deciding
+ // it here cannot distinguish a click from the
+ // first instant of a drag - which is exactly what
+ // made single-click mode unable to move an icon at
+ // all.
+ //
+ // Don't collapse an existing multi-selection just
+ // because the drag grabbed one of its own members
+ // - `start_desktop_icon_drag` itself carries every
+ // currently-selected icon along when the one
+ // grabbed is already selected (see its own doc
+ // comment), the same "drag one of several selected
+ // files, they all move" convention every real
+ // desktop uses. Grabbing an icon *outside* the
+ // current selection still replaces it, same as
+ // before.
+ let already_selected = state.desktop_icons.as_ref().is_some_and(|icons| icons.icons.iter().any(|i| i.id == id && i.selected));
+ if !already_selected {
state.select_desktop_icon(Some(&id));
- state.open_desktop_icon(&id);
- } else {
- // Don't collapse an existing multi-selection
- // just because the drag grabbed one of its own
- // members - `start_desktop_icon_drag` itself
- // carries every currently-selected icon along
- // when the one grabbed is already selected
- // (see its own doc comment), the same "drag one
- // of several selected files, they all move"
- // convention every real desktop uses. Grabbing
- // an icon *outside* the current selection still
- // replaces it, same as before.
- let already_selected = state.desktop_icons.as_ref().is_some_and(|icons| icons.icons.iter().any(|i| i.id == id && i.selected));
- if !already_selected {
- state.select_desktop_icon(Some(&id));
- }
- state.start_desktop_icon_drag(&id, origin, (pos.x as i32, pos.y as i32));
}
+ state.start_desktop_icon_drag(&id, origin, (pos.x as i32, pos.y as i32));
}
// Genuinely bare desktop, not just "no icon under the
// pointer" - starts a rubber-band selection instead of
@@ -806,6 +809,17 @@ pub(crate) fn handle_pointer_button(state: &mut CompState, pos: Point<f64, Logic
// A no-op via `Option::take()` when no icon drag was active --
// always checked on release, same as `was_dragging`/`was_resizing`
// below, just for a desktop icon instead of a window.
+ // A press that never travelled far enough to be a drag is a click:
+ // decide activation here, not on press, so an icon stays draggable
+ // in single-click mode. `time` is the release's, used consistently
+ // for both clicks of a double so the interval stays comparable.
+ if let Some(id) = state.desktop_icon_click() {
+ let single_click_opens = state.wm.borrow().desktop_icon_single_click;
+ if single_click_opens || state.is_double_click_icon(&id, time) {
+ state.select_desktop_icon(Some(&id));
+ state.open_desktop_icon(&id);
+ }
+ }
state.end_desktop_icon_drag();
state.end_desktop_marquee();
// Releasing a drag over a cell of the drag-triggered Snap-Layouts