AltF02 / x11-rs

Rust bindings for X11 libraries
https://docs.rs/x11
MIT License
207 stars 66 forks source link

problem in ubuntu19.10 #105

Closed geeksesi closed 2 years ago

geeksesi commented 4 years ago

hi, i have a issue in other lib : https://github.com/UnwrittenFun/hotkey-rs/issues/1 and i think problem is this lib. i just try to test example of this lib. and on x11-dl just will open a window and will not detect my input. and with a little test. i think this method will break loop (don't let to run.)

(xlib.XNextEvent)(display, &mut event);

just test this.

fn main() {
    let xlib = xlib::Xlib::open().unwrap();
    unsafe {
        let display = (xlib.XOpenDisplay)(ptr::null());
        (xlib.XSelectInput)(
            display,
            (xlib.XDefaultRootWindow)(display),
            xlib::KeyReleaseMask,
        );
        let mut event: xlib::XEvent = mem::MaybeUninit::uninit().assume_init();
        loop {
            print!("Hello");
            (xlib.XNextEvent)(display, &mut event);
            match event.get_type() {
                xlib::KeyPress => {}
                _ => {
                    print!("{:?}", event.key.keycode);
                    // break;
                }
            }
        }
    }
}

hello and print!("{:?}", event.key.keycode); will not appear. just i don't know what happen here.

AltF02 commented 2 years ago

Hello, are you still having this issue? If so, could you re open with an maintained version of Ubuntu?