From e588988254ed8dee4ac4f1ed4fd18afea73590cc Mon Sep 17 00:00:00 2001 From: "Brian J. Tarricone" Date: Fri, 13 May 2022 19:39:30 -0700 Subject: [PATCH] Fix pointer-to-monitor location code --- locker/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/locker/src/main.rs b/locker/src/main.rs index 2378581..237ae1a 100644 --- a/locker/src/main.rs +++ b/locker/src/main.rs @@ -673,7 +673,12 @@ fn start_unlock_dialog<'a>(conn: &'a xcb::Connection, state: &State<'a>, trigger window: monitor.root, }); let reply = conn.wait_for_reply(cookie)?; - if reply.same_screen() { + let px = reply.root_x() as i32; + let py = reply.root_y() as i32; + if reply.same_screen() + && px >= monitor.x as i32 && px < monitor.x as i32 + monitor.width as i32 + && py >= monitor.y as i32 && py < monitor.y as i32 + monitor.height as i32 + { pointer_monitor = Some(monitor); break; }