summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-06-21 21:37:11 +0100
committertcmal <me@aria.rip>2024-06-21 21:37:11 +0100
commit1c893ed1ff1dc26f4dcc425e756d56f752142ebd (patch)
tree3802b2c1ee8b07f41509728372a3461ecb78c433 /src/main.rs
parent28d1cbca91c35175137ec8f9a9f816f3448467b6 (diff)
remove incorrect flushing of xcb buffer
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/main.rs b/src/main.rs
index 7758cac..54d893c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -47,42 +47,42 @@ impl<'a> WM<'a> {
pub fn event_loop(&mut self) -> Result<()> {
loop {
- match self.conn.wait_for_event()? {
- // See keys.rs
- Event::X(x::Event::KeyPress(e)) => self.handle_key_press(&e),
- Event::X(x::Event::MappingNotify(e)) => self.handle_mapping_notify(&e)?,
-
- // See clients/mod.rs
- Event::X(x::Event::ConfigureRequest(e)) => self.handle_configure_request(&e)?,
- Event::X(x::Event::ConfigureNotify(e)) => self.handle_configure_notify(&e)?,
- Event::X(x::Event::DestroyNotify(e)) => self.handle_destroy_notify(&e)?,
- Event::X(x::Event::MapRequest(e)) => self.handle_map_request(&e)?,
- Event::X(x::Event::UnmapNotify(e)) => self.handle_unmap_notify(&e)?,
-
- // // 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)?,
-
- // // See below
- Event::X(x::Event::PropertyNotify(e)) => self.handle_property_notify(&e)?,
- _ => {}
+ match self.conn.wait_for_event() {
+ Ok(x) => match x {
+ // See keys.rs
+ Event::X(x::Event::KeyPress(e)) => self.handle_key_press(&e),
+ Event::X(x::Event::MappingNotify(e)) => self.handle_mapping_notify(&e)?,
+
+ // See clients/mod.rs
+ Event::X(x::Event::ConfigureRequest(e)) => self.handle_configure_request(&e)?,
+ Event::X(x::Event::ConfigureNotify(e)) => self.handle_configure_notify(&e)?,
+ Event::X(x::Event::DestroyNotify(e)) => self.handle_destroy_notify(&e),
+ Event::X(x::Event::MapRequest(e)) => self.handle_map_request(&e)?,
+ Event::X(x::Event::UnmapNotify(e)) => self.handle_unmap_notify(&e),
+
+ // // 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),
+
+ // // See below
+ Event::X(x::Event::PropertyNotify(e)) => self.handle_property_notify(&e),
+ _ => {}
+ },
+ Err(e) => {
+ eprintln!("error in event loop: {e:#?}\ncontinuing anyway");
+ }
};
+ self.conn.flush()?;
}
}
/// Handle a property notify event, by doing *todo*
- fn handle_property_notify(&mut self, e: &PropertyNotifyEvent) -> Result<()> {
- match e.atom() {
- x::ATOM_WM_HINTS => {
- let focused = self.clients.is_focused(e.window());
- if let Some(c) = self.clients.find_client_mut(e.window()) {
- c.sync_properties(&self.conn, focused);
- self.conn.flush()?;
- }
-
- Ok(())
+ fn handle_property_notify(&mut self, e: &PropertyNotifyEvent) {
+ if x::ATOM_WM_HINTS == e.atom() {
+ let focused = self.clients.is_focused(e.window());
+ if let Some(c) = self.clients.find_client_mut(e.window()) {
+ c.sync_properties(&self.conn, focused);
}
- _ => Ok(()),
}
}
}