From 824595637b43ccc4cadda3350d3090252c0b8ded Mon Sep 17 00:00:00 2001 From: Seaotatop Date: Tue, 4 Jul 2023 15:20:41 -0500 Subject: [PATCH] Fiddle with stuff --- api/lua/pinnacle.lua | 2 ++ src/focus.rs | 1 + src/handlers.rs | 14 +++++++++----- src/input.rs | 4 +--- src/layout/automatic.rs | 4 ++++ 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/api/lua/pinnacle.lua b/api/lua/pinnacle.lua index d2fbf0f..506a317 100644 --- a/api/lua/pinnacle.lua +++ b/api/lua/pinnacle.lua @@ -99,6 +99,8 @@ function pinnacle.setup(config_func) local msg_len_bytes, err_msg, err_num = read_exact(socket_fd, 4) assert(msg_len_bytes) + -- TODO: break here if error in read_exact + ---@type integer local msg_len = string.unpack("=I4", msg_len_bytes) diff --git a/src/focus.rs b/src/focus.rs index a536af9..5e802b0 100644 --- a/src/focus.rs +++ b/src/focus.rs @@ -17,6 +17,7 @@ impl FocusState { Default::default() } + // TODO: how does this work with unmapped windows? /// Get the currently focused window. If there is none, the previous focus is returned. pub fn current_focus(&mut self) -> Option { while let Some(window) = self.focus_stack.last() { diff --git a/src/handlers.rs b/src/handlers.rs index d4f71c0..e76939b 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -96,6 +96,8 @@ impl CompositorHandler for State { } fn commit(&mut self, surface: &WlSurface) { + tracing::debug!("commit"); + utils::on_commit_buffer_handler::(surface); if !compositor::is_sync_subsurface(surface) { @@ -147,7 +149,7 @@ fn ensure_initial_configure(surface: &WlSurface, state: &mut State XdgShellHandler for State { let windows: Vec = self.space.elements().cloned().collect(); self.loop_handle.insert_idle(|data| { - tracing::info!("Layout master_stack"); + tracing::debug!("Layout master_stack"); Layout::master_stack(&mut data.state, windows, crate::layout::Direction::Left); }); } @@ -389,11 +391,13 @@ impl XdgShellHandler for State { // | mapping the element in commit, this means that the window won't reappear on a tag // | change. The code below is a workaround until I can figure it out. if !self.space.elements().any(|win| win == &window) { - tracing::debug!("remapping window"); WindowState::with_state(&window, |state| { if let WindowResizeState::WaitingForCommit(new_loc) = state.resize_state { - self.space.map_element(window.clone(), new_loc, false); - state.resize_state = WindowResizeState::Idle; + tracing::debug!("remapping window"); + let win = window.clone(); + self.loop_handle.insert_idle(move |data| { + data.state.space.map_element(win, new_loc, false); + }); } }); } diff --git a/src/input.rs b/src/input.rs index 82b7e6e..2386018 100644 --- a/src/input.rs +++ b/src/input.rs @@ -263,10 +263,8 @@ impl State { move_mode = false; } } - FilterResult::Forward - } else { - FilterResult::Forward } + FilterResult::Forward }, ); diff --git a/src/layout/automatic.rs b/src/layout/automatic.rs index 57786c2..4d8b981 100644 --- a/src/layout/automatic.rs +++ b/src/layout/automatic.rs @@ -49,6 +49,7 @@ impl Layout { window.toplevel().with_pending_state(|tl_state| { tl_state.size = Some(state.space.output_geometry(output).unwrap().size); + tracing::debug!("only size is {:?}", tl_state.size); }); let initial_configure_sent = @@ -83,6 +84,7 @@ impl Layout { let mut size = state.space.output_geometry(output).unwrap().size; size.w /= 2; tl_state.size = Some(size); + tracing::debug!("first size is {:?}", tl_state.size); }); let initial_configure_sent = @@ -97,6 +99,7 @@ impl Layout { }); if initial_configure_sent { WindowState::with_state(first_window, |state| { + tracing::debug!("sending resize state"); state.resize_state = WindowResizeState::WaitingForAck( first_window.toplevel().send_configure(), output.current_location(), @@ -122,6 +125,7 @@ impl Layout { // | this is set too low. new_size.h = new_size.h.clamp(40, i32::MAX); state.size = Some(new_size); + tracing::debug!("size is {:?}", state.size); }); let mut new_loc = output.current_location();