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

+7
View File
@@ -1,5 +1,12 @@
# Changelog # Changelog
## 0.1.1 (2026-04-07)
### Bug Fixes
- Remove 10-second auto-exit timer; overlay now runs until toggled off
- Smooth cursor tracking by reducing input hole from 512px to 48px
## 0.1.0 (2026-04-07) ## 0.1.0 (2026-04-07)
Initial release. Initial release.
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ringa" name = "ringa"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
description = "GPU-rendered ring light overlay for Wayland" description = "GPU-rendered ring light overlay for Wayland"
+3 -12
View File
@@ -10,7 +10,6 @@ use lock::ToggleResult;
use render::GpuRenderer; use render::GpuRenderer;
use wayland::{OverlayEvent, WaylandBackend}; use wayland::{OverlayEvent, WaylandBackend};
const DISPLAY_DURATION: Duration = Duration::from_secs(10);
const FRAME_INTERVAL: Duration = Duration::from_millis(16); const FRAME_INTERVAL: Duration = Duration::from_millis(16);
fn main() -> Result<()> { fn main() -> Result<()> {
@@ -37,19 +36,16 @@ fn main() -> Result<()> {
color, color,
)?; )?;
// Initial cursor offscreen — will update when pointer enters ring zone.
let mut cursor_x = -10000.0_f64; let mut cursor_x = -10000.0_f64;
let mut cursor_y = -10000.0_f64; let mut cursor_y = -10000.0_f64;
renderer.render(cursor_x, cursor_y)?; renderer.render(cursor_x, cursor_y)?;
let start = Instant::now();
let mut last_draw = Instant::now(); let mut last_draw = Instant::now();
let mut dirty = false; let mut dirty = false;
loop { loop {
let elapsed = start.elapsed(); if lock::should_exit() {
if elapsed >= DISPLAY_DURATION || lock::should_exit() {
break; break;
} }
@@ -59,13 +55,10 @@ fn main() -> Result<()> {
dirty = false; dirty = false;
} }
let remaining = DISPLAY_DURATION - elapsed;
let poll_timeout = if dirty { let poll_timeout = if dirty {
FRAME_INTERVAL FRAME_INTERVAL.saturating_sub(last_draw.elapsed())
.saturating_sub(last_draw.elapsed())
.min(remaining)
} else { } else {
remaining Duration::from_secs(1)
}; };
let event = match wl.next_event(poll_timeout)? { let event = match wl.next_event(poll_timeout)? {
@@ -77,8 +70,6 @@ fn main() -> Result<()> {
OverlayEvent::CursorMoved(x, y) => { OverlayEvent::CursorMoved(x, y) => {
cursor_x = x; cursor_x = x;
cursor_y = y; 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)?; wl.update_cursor_hole(cursor_x, cursor_y)?;
dirty = true; dirty = true;
} }
+3 -3
View File
@@ -25,9 +25,9 @@ use raw_window_handle::{
RawDisplayHandle, RawWindowHandle, WaylandDisplayHandle, WaylandWindowHandle, RawDisplayHandle, RawWindowHandle, WaylandDisplayHandle, WaylandWindowHandle,
}; };
/// Size of the passthrough hole around the cursor. Should be large enough /// Size of the passthrough hole around the cursor. Small = more frequent
/// that normal mouse movement stays within the hole between frames. /// pointer events = smoother tracking. Clicks land inside this hole.
const CURSOR_HOLE_SIZE: i32 = 512; const CURSOR_HOLE_SIZE: i32 = 48;
pub enum OverlayEvent { pub enum OverlayEvent {
Close, Close,