diff --git a/src/drawer.rs b/src/drawer.rs index 2151470..131886a 100644 --- a/src/drawer.rs +++ b/src/drawer.rs @@ -242,7 +242,7 @@ impl Drawer { /// Check if the panel owns this surface. pub fn owns_surface(&self, surface: &WlSurface) -> bool { - self.window.as_ref().map_or(false, |window| window.wl_surface() == surface) + self.window.as_ref().is_some_and(|window| window.wl_surface() == surface) } /// Update the DPI scale factor. @@ -387,6 +387,8 @@ impl Drawer { // Resize if the surface exists already. if self.renderer.has_surface() { let _ = self.renderer.resize(size, self.scale_factor); + self.closing_icon = None; + self.opening_icon = None; return; } diff --git a/src/main.rs b/src/main.rs index b4d5a0f..933bc0b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -468,7 +468,7 @@ impl TouchHandler for State { // Handle short taps. if !drawer.offsetting { - if last_tap.map_or(false, |tap| tap.elapsed() <= MAX_DOUBLE_TAP_DURATION) { + if last_tap.is_some_and(|tap| tap.elapsed() <= MAX_DOUBLE_TAP_DURATION) { // Remove delayed single-tap callback. if let Some(source) = self.tap_timeout.take() { self.event_loop.remove(source); @@ -488,7 +488,7 @@ impl TouchHandler for State { TimeoutAction::Drop }); self.tap_timeout = source.ok(); - } else if self.panel_height.map_or(false, |panel_height| { + } else if self.panel_height.is_some_and(|panel_height| { self.touch_start.1 >= panel_height as f64 - HANDLE_HEIGHT as f64 }) { // Immediately close drawer, since handle has no double-tap.