fix: remove auto-exit timer and smooth cursor tracking

Remove the 10-second display timer so the overlay runs until toggled
off. Shrink the cursor input hole from 512px to 48px for near-pixel-
perfect tracking instead of chunky jumps.
This commit is contained in:
swaits committed 2026-04-07 13:10:24 -06:00
1 parent dac98835f8
commit f0fa2866f2
4 files changed
+14 -16

No files matched your search

+3 -12
View File
@@ -10,7 +10,6 @@ use lock::ToggleResult;
use render::GpuRenderer;
use wayland::{OverlayEvent, WaylandBackend};
const DISPLAY_DURATION: Duration = Duration::from_secs(10);
const FRAME_INTERVAL: Duration = Duration::from_millis(16);
fn main() -> Result<()> {
@@ -37,19 +36,16 @@ fn main() -> Result<()> {
color,
)?;
// Initial cursor offscreen — will update when pointer enters ring zone.
let mut cursor_x = -10000.0_f64;
let mut cursor_y = -10000.0_f64;
renderer.render(cursor_x, cursor_y)?;
let start = Instant::now();
let mut last_draw = Instant::now();
let mut dirty = false;
loop {
let elapsed = start.elapsed();
if elapsed >= DISPLAY_DURATION || lock::should_exit() {
if lock::should_exit() {
break;
}
@@ -59,13 +55,10 @@ fn main() -> Result<()> {
dirty = false;
}
let remaining = DISPLAY_DURATION - elapsed;
let poll_timeout = if dirty {
FRAME_INTERVAL
.saturating_sub(last_draw.elapsed())
.min(remaining)
FRAME_INTERVAL.saturating_sub(last_draw.elapsed())
} else {
remaining
Duration::from_secs(1)
};
let event = match wl.next_event(poll_timeout)? {
@@ -77,8 +70,6 @@ fn main() -> Result<()> {
OverlayEvent::CursorMoved(x, y) => {
cursor_x = x;
cursor_y = y;
// Punch a passthrough hole at the new cursor position so
// clicks go to the desktop, then re-render the shader.
wl.update_cursor_hole(cursor_x, cursor_y)?;
dirty = true;
}
+3 -3
View File
@@ -25,9 +25,9 @@ use raw_window_handle::{
RawDisplayHandle, RawWindowHandle, WaylandDisplayHandle, WaylandWindowHandle,
};
/// Size of the passthrough hole around the cursor. Should be large enough
/// that normal mouse movement stays within the hole between frames.
const CURSOR_HOLE_SIZE: i32 = 512;
/// Size of the passthrough hole around the cursor. Small = more frequent
/// pointer events = smoother tracking. Clicks land inside this hole.
const CURSOR_HOLE_SIZE: i32 = 48;
pub enum OverlayEvent {
Close,