summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-06-06 21:39:23 +0100
committertcmal <me@aria.rip>2024-06-06 21:39:23 +0100
commit66e3423828892a72e5e525f2dc8d5ad91e634445 (patch)
tree5dfd94005edbde91adc7a18e5b9a81a5c87816ec /src/main.rs
parent266d39668bcee886cc7fecdb0f2c7b0b3302b20e (diff)
track focus and draw borders
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 6559ad7..e5ec003 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,6 @@
use atoms::InternedAtoms;
use clients::ClientState;
+use colours::Colours;
use cursors::Cursors;
use error::*;
use keys::KeyboardInfo;
@@ -10,6 +11,7 @@ use xcb::{
mod atoms;
mod clients;
+mod colours;
mod cursors;
mod error;
mod focus;
@@ -42,6 +44,9 @@ struct WM<'a> {
/// WM client state
clients: ClientState,
+ /// Cached colours,
+ colours: Colours,
+
/// Cached cursors
cursors: Cursors,
@@ -74,6 +79,7 @@ impl WM<'_> {
.map_err(|_| Error::OtherWMRunning)?;
Ok(WM {
+ colours: Colours::new_with(conn, screen.default_colormap())?,
atoms: InternedAtoms::new_with(conn)?,
cursors: Cursors::new_with(conn)?,
keyboard_state: KeyboardInfo::new_with(conn)?,
@@ -95,9 +101,8 @@ impl WM<'_> {
x::EventMask::SUBSTRUCTURE_REDIRECT
| x::EventMask::SUBSTRUCTURE_NOTIFY
| x::EventMask::BUTTON_PRESS
- | x::EventMask::POINTER_MOTION
| x::EventMask::ENTER_WINDOW
- | x::EventMask::LEAVE_WINDOW
+ | x::EventMask::FOCUS_CHANGE
| x::EventMask::STRUCTURE_NOTIFY
| x::EventMask::PROPERTY_CHANGE,
),
@@ -133,7 +138,6 @@ impl WM<'_> {
// See focus.rs
Event::X(x::Event::EnterNotify(e)) => self.handle_enter_notify(e)?,
Event::X(x::Event::FocusIn(e)) => self.handle_focus_in(e)?,
- Event::X(x::Event::MotionNotify(e)) => self.handle_motion_notify(e)?,
// See below
Event::X(x::Event::PropertyNotify(e)) => self.handle_property_notify(e)?,
@@ -144,7 +148,8 @@ impl WM<'_> {
/// Handle a property notify event, by doing *todo*
fn handle_property_notify(&self, _e: PropertyNotifyEvent) -> Result<()> {
- todo!()
+ println!("TODO: handle_property_notify");
+ Ok(())
}
}