From bf85c86e281742e0734de500761394629bd9a106 Mon Sep 17 00:00:00 2001 From: David Truby Date: Fri, 14 Mar 2025 18:22:54 +0000 Subject: [PATCH 1/2] Remove error_generic_member_access feature gate When trying to build on stable rust, I get a complaint that the error_generic_member_access feature is only allowed on nightly. The library doesn't appear to use this feature anyway, so it seems safe to just remove the feature gate. I can then build and use the library on stable rust. --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 378d4ee..0bfb7b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ #![doc = include_str!("../README.md")] -#![feature(error_generic_member_access)] mod common; From b4cafc787ec2d07412c2d205a44c60e7e07970bc Mon Sep 17 00:00:00 2001 From: Sophie Date: Sun, 23 Mar 2025 18:20:50 +0100 Subject: [PATCH 2/2] Add MouseCursor::pos for linux --- src/linux/mod.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/linux/mod.rs b/src/linux/mod.rs index 0dafb50..d9e7a70 100644 --- a/src/linux/mod.rs +++ b/src/linux/mod.rs @@ -153,6 +153,27 @@ impl MouseButton { } impl MouseCursor { + pub fn pos() -> (i32, i32) { + let mut abs_x = 0; + let mut abs_y = 0; + + SEND_DISPLAY.with(|display| unsafe { + XQueryPointer( + display, + XRootWindow(display, XDefaultScreen(display)), + &mut 0, + &mut 0, + &mut abs_x, + &mut abs_y, + &mut 0, + &mut 0, + &mut 0, + ) + }); + + (abs_x, abs_y) + } + /// Moves the mouse relative to its current position by a given amount of pixels. pub fn move_rel(x: i32, y: i32) { let mut device = FAKE_DEVICE.lock().unwrap();