From bd0c88ba0a63a8f4b2b3be6d9a2f7b61fa9ed444 Mon Sep 17 00:00:00 2001 From: Ottatop Date: Wed, 20 Sep 2023 02:19:04 -0500 Subject: [PATCH] Clean up comments --- src/focus.rs | 2 -- src/handlers.rs | 16 +--------------- src/handlers/xdg_shell.rs | 11 ++++++----- src/handlers/xwayland.rs | 17 +++++++++++++---- src/render.rs | 11 ----------- 5 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/focus.rs b/src/focus.rs index b8b8b2c..399b8f6 100644 --- a/src/focus.rs +++ b/src/focus.rs @@ -113,7 +113,6 @@ impl TryFrom for WlSurface { impl PointerTarget for FocusTarget { fn enter(&self, seat: &Seat, data: &mut State, event: &MotionEvent) { - // tracing::debug!("Pointer enter on {self:?}"); match self { FocusTarget::Window(window) => PointerTarget::enter(window, seat, data, event), FocusTarget::Popup(popup) => { @@ -187,7 +186,6 @@ impl PointerTarget for FocusTarget { serial: smithay::utils::Serial, time: u32, ) { - // tracing::debug!("Pointer leave on {self:?}"); match self { FocusTarget::Window(window) => PointerTarget::leave(window, seat, data, serial, time), FocusTarget::Popup(popup) => { diff --git a/src/handlers.rs b/src/handlers.rs index 736b0d9..b144a7c 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -127,10 +127,6 @@ impl CompositorHandler for State { } }); } - - // correct focus layering - // TODO: maybe do this at the end of every event loop cycle instead? - // self.focus_state.fix_up_focus(&mut self.space); } fn client_compositor_state<'a>(&self, client: &'a Client) -> &'a CompositorClientState { @@ -323,7 +319,6 @@ impl SeatHandler for State { } fn cursor_image(&mut self, _seat: &Seat, image: CursorImageStatus) { - // tracing::info!("new cursor image: {:?}", image); self.cursor_status = image; } @@ -360,8 +355,6 @@ delegate_viewporter!(State); impl FractionalScaleHandler for State { fn new_fractional_scale(&mut self, surface: WlSurface) { - // ripped straight from anvil - // Here we can set the initial fractional scale // // First we look if the surface already has a primary scan-out output, if not @@ -425,7 +418,7 @@ impl WlrLayerShellHandler for State { _layer: Layer, namespace: String, ) { - tracing::debug!("-------------NEW LAYER SURFACE"); + tracing::debug!("New layer surface"); let output = output .as_ref() .and_then(Output::from_resource) @@ -441,16 +434,12 @@ impl WlrLayerShellHandler for State { .expect("failed to map layer surface"); drop(map); // wow i really love refcells haha - // TODO: instead of deferring by 1 cycle, actually check if the surface has committed - // | before re-layouting self.loop_handle.insert_idle(move |data| { data.state.update_windows(&output); - // data.state.re_layout(&output); }); } fn layer_destroyed(&mut self, surface: wlr_layer::LayerSurface) { - // WOO love having to deal with the borrow checker haha let mut output: Option = None; if let Some((mut map, layer, op)) = self.space.outputs().find_map(|o| { let map = layer_map_for_output(o); @@ -464,12 +453,9 @@ impl WlrLayerShellHandler for State { output = Some(op.clone()); } - // TODO: instead of deferring by 1 cycle, actually check if the surface has committed - // | before re-layouting if let Some(output) = output { self.loop_handle.insert_idle(move |data| { data.state.update_windows(&output); - // data.state.re_layout(&output); }); } } diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index be3c71c..11bbf0f 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -857,11 +857,12 @@ impl XdgShellHandler for State { self.update_windows(&output); } - // fn minimize_request(&mut self, surface: ToplevelSurface) { - // if let Some(window) = self.window_for_surface(surface.wl_surface()) { - // self.space.unmap_elem(&window); - // } - // } + fn minimize_request(&mut self, _surface: ToplevelSurface) { + // TODO: + // if let Some(window) = self.window_for_surface(surface.wl_surface()) { + // self.space.unmap_elem(&window); + // } + } // TODO: impl the rest of the fns in XdgShellHandler } diff --git a/src/handlers/xwayland.rs b/src/handlers/xwayland.rs index 22760ec..8a5e4b9 100644 --- a/src/handlers/xwayland.rs +++ b/src/handlers/xwayland.rs @@ -81,7 +81,9 @@ impl XwmHandler for CalloopData { ) .into(); - let WindowElement::X11(surface) = &window else { unreachable!() }; + let WindowElement::X11(surface) = &window else { + unreachable!() + }; surface.set_mapped(true).expect("failed to map x11 window"); self.state.space.map_element(window.clone(), loc, true); @@ -117,7 +119,9 @@ impl XwmHandler for CalloopData { tracing::debug!("new window, tags are {:?}", state.tags); }); - let WindowElement::X11(surface) = &window else { unreachable!() }; + let WindowElement::X11(surface) = &window else { + unreachable!() + }; if should_float(surface) { window.with_state(|state| { @@ -179,6 +183,7 @@ impl XwmHandler for CalloopData { (None, None) => vec![], }; }); + self.state.focus_state.set_focus(window.clone()); // tracing::debug!("mapped_override_redirect_window to loc {loc:?}"); self.state.space.map_element(window.clone(), loc, true); @@ -485,8 +490,12 @@ fn should_float(surface: &X11Surface) -> bool { ) }); let is_popup_by_size = surface.size_hints().map_or(false, |size_hints| { - let Some((min_w, min_h)) = size_hints.min_size else { return false }; - let Some((max_w, max_h)) = size_hints.max_size else { return false }; + let Some((min_w, min_h)) = size_hints.min_size else { + return false; + }; + let Some((max_w, max_h)) = size_hints.max_size else { + return false; + }; min_w > 0 && min_h > 0 && (min_w == max_w || min_h == max_h) }); surface.is_popup() || is_popup_by_type || is_popup_by_size diff --git a/src/render.rs b/src/render.rs index 3dbc494..9ec4042 100644 --- a/src/render.rs +++ b/src/render.rs @@ -43,7 +43,6 @@ render_elements! { Space=SpaceRenderElements, Window=Wrap, Custom=CustomRenderElements, - // TODO: preview } impl AsRenderElements for WindowElement @@ -275,10 +274,6 @@ where let mut output_render_elements = Vec::>>::new(); - // let space_render_elements = - // smithay::desktop::space::space_render_elements(renderer, [space], output, 1.0) - // .expect("failed to get space_render_elements"); - // Elements render from top to bottom output_render_elements.extend( @@ -298,12 +293,6 @@ where .map(OutputRenderElements::from), ); - // output_render_elements.extend( - // space_render_elements - // .into_iter() - // .map(OutputRenderElements::from), - // ); - output_render_elements } };