Clean up comments

This commit is contained in:
Ottatop 2023-09-20 02:19:04 -05:00
parent 46cbf60887
commit bd0c88ba0a
5 changed files with 20 additions and 37 deletions

View file

@ -113,7 +113,6 @@ impl TryFrom<FocusTarget> for WlSurface {
impl PointerTarget<State> for FocusTarget {
fn enter(&self, seat: &Seat<State>, 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<State> 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) => {

View file

@ -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<Self>, 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<Output> = 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);
});
}
}

View file

@ -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
}

View file

@ -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

View file

@ -43,7 +43,6 @@ render_elements! {
Space=SpaceRenderElements<R, E>,
Window=Wrap<E>,
Custom=CustomRenderElements<R>,
// TODO: preview
}
impl<R> AsRenderElements<R> for WindowElement
@ -275,10 +274,6 @@ where
let mut output_render_elements =
Vec::<OutputRenderElements<R, WaylandSurfaceRenderElement<R>>>::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
}
};