fix(kiosk): hide the mouse cursor on every window

Cage shows the pointer mid-screen by default — there's no input the
user should see on a kiosk. Set GDK's "none" cursor on the pairing
window and each per-display window.
This commit is contained in:
Mitchell R 2026-05-13 03:37:32 +02:00
parent bb67c26a1c
commit 70fd4ff7f6

View file

@ -93,6 +93,7 @@ fn activate(app: &Application) {
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
); );
hide_cursor_on(&pairing_window);
show_logo(&pairing_window); show_logo(&pairing_window);
pairing_window.present(); pairing_window.present();
@ -439,6 +440,7 @@ fn render_bundle(
&provider, &provider,
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
); );
hide_cursor_on(&w);
w.present(); w.present();
if let Some(monitor) = gdk_monitors.get(i) { if let Some(monitor) = gdk_monitors.get(i) {
w.fullscreen_on_monitor(monitor); w.fullscreen_on_monitor(monitor);
@ -878,6 +880,15 @@ fn ensure_warm(
Some((paintable, desired_badge)) Some((paintable, desired_badge))
} }
/// Hide the mouse pointer on a window. Kiosks have no input device the user
/// should see — the cursor is just visual noise sitting in the middle of the
/// content. GDK's "none" cursor name maps to a hidden cursor on Wayland.
fn hide_cursor_on(window: &ApplicationWindow) {
if let Some(cursor) = gtk::gdk::Cursor::from_name("none", None) {
window.set_cursor(Some(&cursor));
}
}
fn show_logo(window: &ApplicationWindow) { fn show_logo(window: &ApplicationWindow) {
let vbox = GtkBox::new(Orientation::Vertical, 0); let vbox = GtkBox::new(Orientation::Vertical, 0);
vbox.set_valign(gtk::Align::Center); vbox.set_valign(gtk::Align::Center);