fixed window borders
This commit is contained in:
parent
b47f245250
commit
91b5c91bd5
|
@ -28,6 +28,7 @@ pub trait WindowServerBackend {
|
||||||
window: Self::Window,
|
window: Self::Window,
|
||||||
new_size: Option<Point<i32>>,
|
new_size: Option<Point<i32>>,
|
||||||
new_pos: Option<Point<i32>>,
|
new_pos: Option<Point<i32>>,
|
||||||
|
new_border: Option<i32>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn screen_size(&self) -> Point<i32>;
|
fn screen_size(&self) -> Point<i32>;
|
||||||
|
@ -38,10 +39,10 @@ pub trait WindowServerBackend {
|
||||||
fn move_cursor(&self, window: Option<Self::Window>, position: Point<i32>);
|
fn move_cursor(&self, window: Option<Self::Window>, position: Point<i32>);
|
||||||
|
|
||||||
fn resize_window(&self, window: Self::Window, new_size: Point<i32>) {
|
fn resize_window(&self, window: Self::Window, new_size: Point<i32>) {
|
||||||
self.configure_window(window, Some(new_size), None);
|
self.configure_window(window, Some(new_size), None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_window(&self, window: Self::Window, new_pos: Point<i32>) {
|
fn move_window(&self, window: Self::Window, new_pos: Point<i32>) {
|
||||||
self.configure_window(window, None, Some(new_pos));
|
self.configure_window(window, None, Some(new_pos), None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![allow(unused_variables, dead_code)]
|
#![allow(unused_variables, dead_code)]
|
||||||
use log::{debug, error, warn};
|
use log::{error, warn};
|
||||||
use std::{ffi::CString, rc::Rc};
|
use std::{ffi::CString, rc::Rc};
|
||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -656,6 +656,7 @@ impl WindowServerBackend for XLib {
|
||||||
event.window,
|
event.window,
|
||||||
Some(event.size),
|
Some(event.size),
|
||||||
Some(event.position),
|
Some(event.position),
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -765,6 +766,7 @@ impl WindowServerBackend for XLib {
|
||||||
window: Self::Window,
|
window: Self::Window,
|
||||||
new_size: Option<super::window_event::Point<i32>>,
|
new_size: Option<super::window_event::Point<i32>>,
|
||||||
new_pos: Option<super::window_event::Point<i32>>,
|
new_pos: Option<super::window_event::Point<i32>>,
|
||||||
|
new_border: Option<i32>,
|
||||||
) {
|
) {
|
||||||
let position = new_pos.unwrap_or(Point::new(0, 0));
|
let position = new_pos.unwrap_or(Point::new(0, 0));
|
||||||
let size = new_size.unwrap_or(Point::new(0, 0));
|
let size = new_size.unwrap_or(Point::new(0, 0));
|
||||||
|
@ -773,7 +775,7 @@ impl WindowServerBackend for XLib {
|
||||||
y: position.y,
|
y: position.y,
|
||||||
width: size.x,
|
width: size.x,
|
||||||
height: size.y,
|
height: size.y,
|
||||||
border_width: 0,
|
border_width: new_border.unwrap_or(0),
|
||||||
sibling: 0,
|
sibling: 0,
|
||||||
stack_mode: 0,
|
stack_mode: 0,
|
||||||
};
|
};
|
||||||
|
@ -786,6 +788,9 @@ impl WindowServerBackend for XLib {
|
||||||
if new_size.is_some() {
|
if new_size.is_some() {
|
||||||
mask |= xlib::CWWidth | xlib::CWHeight;
|
mask |= xlib::CWWidth | xlib::CWHeight;
|
||||||
}
|
}
|
||||||
|
if new_border.is_some() {
|
||||||
|
mask |= xlib::CWBorderWidth;
|
||||||
|
}
|
||||||
|
|
||||||
u32::from(mask)
|
u32::from(mask)
|
||||||
};
|
};
|
||||||
|
|
16
src/state.rs
16
src/state.rs
|
@ -362,8 +362,10 @@ where
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::KeyEvent(event) => {
|
WindowEvent::KeyEvent(event) => {
|
||||||
|
if event.state == KeyState::Pressed {
|
||||||
self.handle_keybinds(&event);
|
self.handle_keybinds(&event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
WindowEvent::ButtonEvent(event) => {
|
WindowEvent::ButtonEvent(event) => {
|
||||||
self.button_event(&event);
|
self.button_event(&event);
|
||||||
}
|
}
|
||||||
|
@ -421,7 +423,6 @@ where
|
||||||
|
|
||||||
// TODO: change this somehow cuz I'm not a big fan of this "hardcoded" keybind stuff
|
// TODO: change this somehow cuz I'm not a big fan of this "hardcoded" keybind stuff
|
||||||
fn handle_keybinds(&mut self, event: &KeyEvent<B::Window>) {
|
fn handle_keybinds(&mut self, event: &KeyEvent<B::Window>) {
|
||||||
if event.state == KeyState::Released {
|
|
||||||
// I'm not sure if this has to be a Rc<RefCell>> or if it would be better as a Cell<>
|
// I'm not sure if this has to be a Rc<RefCell>> or if it would be better as a Cell<>
|
||||||
let keybinds = self.keybinds.clone();
|
let keybinds = self.keybinds.clone();
|
||||||
|
|
||||||
|
@ -433,7 +434,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_switch_stack(&mut self) {
|
fn handle_switch_stack(&mut self) {
|
||||||
if let Some(client) =
|
if let Some(client) =
|
||||||
|
@ -645,15 +645,15 @@ where
|
||||||
Client::new_default(window)
|
Client::new_default(window)
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO
|
self.backend.configure_window(
|
||||||
//self.xlib
|
window,
|
||||||
//.configure_client(&client, self.clients.get_border());
|
None,
|
||||||
|
None,
|
||||||
|
Some(self.clients.get_border()),
|
||||||
|
);
|
||||||
self.clients.insert(client).unwrap();
|
self.clients.insert(client).unwrap();
|
||||||
self.arrange_clients();
|
self.arrange_clients();
|
||||||
|
|
||||||
// TODO
|
|
||||||
//self.xlib.map_window(window);
|
|
||||||
|
|
||||||
self.focus_client(&window, true);
|
self.focus_client(&window, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue