blitz-shell: CursorMoved doesn't request_redraw, so DOM-driven drags lag behind the cursor
- Dominant language
- Rust
- Stars
- 4.1k
- Forks
- 203
- Avg merge
- 8h 58m
- Merged PRs (30d)
- 112
Description
In `blitz-shell/src/window.rs`, the `WindowEvent::CursorMoved` handler forwards the move to the DOM but — unlike every other event handler in the file — never calls `self.request_redraw()`:
```rust
WindowEvent::CursorMoved { position, .. } => {
let LogicalPosition:: { x, y } = position.to_logical(self.window.scale_factor());
self.mouse_pos = (x, y);
let event = UiEvent::MouseMove(BlitzMouseButtonEvent { x, y, /* … */ });
self.doc.handle_ui_event(event);
// no request_redraw() here
}
```
(observed in `blitz-shell` 0.2.3)
## Impact
Any app that implements dragging purely in the DOM — `onmousedown` starts a drag, `onmousemove` updates a signal, the element re-renders at the new position — sees the dragged element **trail behind the cursor**. Because the move doesn't request a repaint, the new frame only shows up on the next event that *does* request one (mouse-up, wheel, etc.), so the element catches up only when you pause or release. Same effect for DOM-driven panning.
## Expectation
A mouse-move that changes the DOM should repaint promptly, like in a browser.
## Suggested fix
Keeps idle hover cheap by only repainting while a button is held (`self.buttons` is already in scope):
```rust
self.doc.handle_ui_event(event);
if !self.buttons.is_empty() {
self.request_redraw();
}
```
Alternatively, unconditionally `request_redraw()` on `CursorMoved` if the idle-hover cost is acceptable. Happy to open a PR.
Contributor guide
Research direction
In blitz-shell/src/window.rs, start at the WindowEvent::CursorMoved handler and compare its redraw behavior with the other event handlers. Reproduce a DOM-driven drag, then verify that movement while a button is held repaints promptly without changing idle-hover behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100