diff options
| author | srdusr <[email protected]> | 2026-05-11 16:44:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2026-05-11 16:44:00 +0200 |
| commit | caec1e7c355bbe6437afe87cd3dab6b64fb91e0a (patch) | |
| tree | 5ecab25d2ebc36949ac4129b35e35334a575d563 /crates/wayland/src/state | |
| parent | baabd91411dacd179c690f724b6cbfe6270cb131 (diff) | |
| download | srdwm-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/state')
| -rw-r--r-- | crates/wayland/src/state/desktop_icons.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/crates/wayland/src/state/desktop_icons.rs b/crates/wayland/src/state/desktop_icons.rs index ad7796f..69b9b62 100644 --- a/crates/wayland/src/state/desktop_icons.rs +++ b/crates/wayland/src/state/desktop_icons.rs @@ -342,7 +342,8 @@ impl CompState { (i.id.clone(), (top_left.0 - primary_top_left.0, top_left.1 - primary_top_left.1)) }) .collect(); - self.desktop_icon_drag = Some(crate::desktop_icons::DesktopIconDrag { grab_offset, primary_pos: primary_top_left, members }); + self.desktop_icon_drag = + Some(crate::desktop_icons::DesktopIconDrag { grab_offset, primary_pos: primary_top_left, members, pressed: (id.to_string(), pointer), moved: false }); for id in changed { self.rebuild_icon_buffer(&id); } @@ -354,6 +355,14 @@ impl CompState { /// `WindowManager::update_resize`'s own per-motion-event update. pub(crate) fn update_desktop_icon_drag(&mut self, pointer: (i32, i32)) { if let Some(drag) = &mut self.desktop_icon_drag { + // Latched, never cleared: a gesture that once travelled far + // enough to be a drag stays one even if the pointer wanders + // back over the press point before release. + if (pointer.0 - drag.pressed.1 .0).abs() > crate::desktop_icons::DRAG_THRESHOLD + || (pointer.1 - drag.pressed.1 .1).abs() > crate::desktop_icons::DRAG_THRESHOLD + { + drag.moved = true; + } drag.primary_pos = (pointer.0 - drag.grab_offset.0, pointer.1 - drag.grab_offset.1); } } @@ -363,6 +372,18 @@ impl CompState { /// its own nearest free grid cell, independently but never colliding /// with each other - walking outward from each one's own raw target, /// closest first - and persists all of them. + /// The icon a still-open drag was pressed on, if the pointer never + /// travelled far enough for it to become a real drag - i.e. the + /// gesture was a click. `None` once it has moved, or with no drag + /// open at all. + /// + /// Read on release so the open happens there rather than on press, + /// which is what makes an icon draggable in single-click mode at all. + pub(crate) fn desktop_icon_click(&self) -> Option<String> { + let drag = self.desktop_icon_drag.as_ref()?; + (!drag.moved).then(|| drag.pressed.0.clone()) + } + pub(crate) fn end_desktop_icon_drag(&mut self) { let Some(drag) = self.desktop_icon_drag.take() else { return }; // The cell math below needs the origin of whichever monitor the |