fixes and suppressing useless warnings
This commit is contained in:
parent
ff27ec18d9
commit
ee1aa9cfae
|
@ -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(
|
||||
|
|
|
@ -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<xlib::Window>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Display(Rc<*mut x11::xlib::Display>);
|
||||
|
||||
|
@ -150,7 +152,7 @@ impl XLib {
|
|||
}
|
||||
}
|
||||
|
||||
impl TryFrom<XEvent> for WindowEvent<xlib::Window> {
|
||||
impl TryFrom<XEvent> for XLibWindowEvent {
|
||||
type Error = crate::error::Error;
|
||||
|
||||
fn try_from(event: XEvent) -> Result<Self, Self::Error> {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -346,8 +346,6 @@ impl WindowManager {
|
|||
}
|
||||
|
||||
fn quit(&self) -> ! {
|
||||
self.xlib.close_dpy();
|
||||
|
||||
info!("Goodbye.");
|
||||
|
||||
std::process::exit(0);
|
||||
|
|
11
src/xlib.rs
11
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());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue