Hide mouse pointer when blanked
This commit is contained in:
parent
cab7d4bfe5
commit
992f32330c
@ -680,8 +680,9 @@ fn handle_unlock_dialog_quit(conn: &xcb::Connection, state: &mut State) -> anyho
|
||||
if let Some(signum) = status.signal() {
|
||||
warn!("Unlock dialog crashed with signal {}", signum);
|
||||
}
|
||||
hide_cursor(conn, state);
|
||||
},
|
||||
Ok(Some(_)) => (), // auth failed, dialog has quit, do nothing
|
||||
Ok(Some(_)) => hide_cursor(conn, state), // auth failed, dialog has quit, do nothing
|
||||
Ok(None) => state.unlock_dialog = Some(unlock_dialog), // dialog still running
|
||||
}
|
||||
}
|
||||
@ -710,6 +711,8 @@ fn start_unlock_dialog<'a>(conn: &'a xcb::Connection, state: &State<'a>, trigger
|
||||
state.monitors.iter().nth(0).unwrap()
|
||||
});
|
||||
|
||||
show_cursor(conn, state);
|
||||
|
||||
let mut command = Command::new(format!("{}/{}", env!("HELPER_DIR"), state.config.dialog_backend.binary_name()));
|
||||
#[cfg(feature = "use-nightly")]
|
||||
command.create_pidfd(true);
|
||||
@ -759,6 +762,24 @@ fn start_unlock_dialog<'a>(conn: &'a xcb::Connection, state: &State<'a>, trigger
|
||||
})
|
||||
}
|
||||
|
||||
fn show_cursor(conn: &xcb::Connection, state: &State) {
|
||||
for monitor in &state.monitors {
|
||||
conn.send_request(&xfixes::ShowCursor {
|
||||
window: monitor.blanker_window,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn hide_cursor(conn: &xcb::Connection, state: &State) {
|
||||
for monitor in &state.monitors {
|
||||
if let Err(err) = conn.send_and_check_request(&xfixes::HideCursor {
|
||||
window: monitor.blanker_window,
|
||||
}) {
|
||||
warn!("Failed to hide cursor: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn blank_screen(conn: &xcb::Connection, state: &mut State) -> anyhow::Result<()> {
|
||||
if state.blanker_state >= BlankerState::Blanked {
|
||||
return Ok(())
|
||||
@ -784,6 +805,8 @@ fn blank_screen(conn: &xcb::Connection, state: &mut State) -> anyhow::Result<()>
|
||||
}
|
||||
}
|
||||
|
||||
hide_cursor(conn, state);
|
||||
|
||||
state.blanker_state = BlankerState::Blanked;
|
||||
|
||||
Ok(())
|
||||
@ -796,6 +819,8 @@ fn unblank_screen(conn: &xcb::Connection, state: &mut State) -> anyhow::Result<(
|
||||
|
||||
info!("Unblanking");
|
||||
|
||||
show_cursor(conn, state);
|
||||
|
||||
let mut cookies = Vec::new();
|
||||
for monitor in &state.monitors {
|
||||
cookies.push(conn.send_request_checked(&x::UnmapWindow {
|
||||
|
Loading…
x
Reference in New Issue
Block a user