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