diff --git a/src/backends/xlib/keysym.rs b/src/backends/xlib/keysym.rs index c483443..bf1f9ac 100644 --- a/src/backends/xlib/keysym.rs +++ b/src/backends/xlib/keysym.rs @@ -1,7 +1,6 @@ +#![allow(unreachable_patterns)] use std::{borrow::Borrow, ops::Deref}; -use x11::xlib::XKeyReleasedEvent; - use crate::backends::keycodes::{MouseButton, VirtualKeyCode}; pub fn xev_to_mouse_button( diff --git a/src/backends/xlib/mod.rs b/src/backends/xlib/mod.rs index 67224c8..ab96df2 100644 --- a/src/backends/xlib/mod.rs +++ b/src/backends/xlib/mod.rs @@ -1,3 +1,4 @@ +#![allow(unused_variables, dead_code)] use log::{error, warn}; use std::{ convert::{TryFrom, TryInto}, @@ -11,7 +12,6 @@ use x11::xlib::{self, Atom, Window, XEvent, XInternAtom}; use self::keysym::xev_to_mouse_button; use super::{ - keycodes::{MouseButton, VirtualKeyCode}, window_event::{ ButtonEvent, ConfigureEvent, DestroyEvent, EnterEvent, KeyState, MapEvent, ModifierState, UnmapEvent, WindowEvent, @@ -21,6 +21,8 @@ use super::{ pub mod keysym; +pub type XLibWindowEvent = WindowEvent; + #[derive(Clone)] pub struct Display(Rc<*mut x11::xlib::Display>); @@ -150,7 +152,7 @@ impl XLib { } } -impl TryFrom for WindowEvent { +impl TryFrom for XLibWindowEvent { type Error = crate::error::Error; fn try_from(event: XEvent) -> Result { diff --git a/src/clients.rs b/src/clients.rs index cd65dc1..a728a79 100644 --- a/src/clients.rs +++ b/src/clients.rs @@ -207,6 +207,7 @@ impl ClientState { self.border_size } + #[allow(dead_code)] pub fn set_border_mut(&mut self, new: i32) { self.border_size = new; } diff --git a/src/state.rs b/src/state.rs index 04c49ee..626cf19 100644 --- a/src/state.rs +++ b/src/state.rs @@ -346,8 +346,6 @@ impl WindowManager { } fn quit(&self) -> ! { - self.xlib.close_dpy(); - info!("Goodbye."); std::process::exit(0); diff --git a/src/xlib.rs b/src/xlib.rs index a5c8f6f..aa1885d 100644 --- a/src/xlib.rs +++ b/src/xlib.rs @@ -53,6 +53,12 @@ impl KeyOrButton { #[derive(Clone)] pub struct Display(Rc<*mut xlib::Display>); +impl Drop for XLib { + fn drop(&mut self) { + self.close_dpy(); + } +} + impl XLib { pub fn new() -> Self { let (display, _screen, root) = unsafe { @@ -391,6 +397,7 @@ impl XLib { } } + #[allow(dead_code)] fn get_window_attributes( &self, window: Window, @@ -421,10 +428,12 @@ impl XLib { } } + #[allow(dead_code)] pub fn expose_client(&self, client: &Client) { self.expose_window(client.window); } + #[allow(dead_code)] fn expose_window(&self, window: Window) { if let Some(wa) = self.get_window_attributes(window) { unsafe { @@ -527,7 +536,7 @@ impl XLib { } } - pub fn close_dpy(&self) { + fn close_dpy(&self) { unsafe { XCloseDisplay(self.dpy()); }