summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-06-26 20:57:43 +0100
committertcmal <me@aria.rip>2024-06-26 20:57:43 +0100
commitf7f0df71657df790259f5358617901cf4142faf9 (patch)
tree3641ec42d049676086551bd8d4b9b8f224984f72 /src/main.rs
parentc4cf4336c823a1d5681523e6ef5cdfaa270f71ac (diff)
log events when compiled in debug mode
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs51
1 files changed, 31 insertions, 20 deletions
diff --git a/src/main.rs b/src/main.rs
index a5091ad..83cabd4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -78,26 +78,37 @@ impl<'a> WM<'a> {
pub fn event_loop(&mut self) -> Result<()> {
loop {
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),
- _ => {}
- },
+ Ok(x) => {
+ #[cfg(debug_assertions)]
+ {
+ eprintln!("received event: {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(Error::Xcb(xcb::Error::Protocol(e))) => {
eprintln!("protocol error in event loop: {e:#?}\ncontinuing anyway");
}