git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit09507464e32d6786f761d045cab024fc194e0d8d
parent65fb094ef0
authorLucas Galante <[email protected]>
date2026-06-26 17:23
fix: immediately retry get_current_texture on surface configure to avoid skipped frames during resize

 src/backend/window_runner.rs | 16 ++++++++++++++--
 src/main.rs                  |  8 +++++++-
 src/widget/input/slider.rs   |  2 +-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/backend/window_runner.rs b/src/backend/window_runner.rs
index c85dfce..8697bde 100644
--- a/src/backend/window_runner.rs
+++ b/src/backend/window_runner.rs
@@ -1292,7 +1292,13 @@ impl<A: Application> EngineState<A> {
             Ok(t) => t,
             Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
                 adapter.surface.configure(&adapter.device, &adapter.config);
-                return;
+                match adapter.surface.get_current_texture() {
+                    Ok(t) => t,
+                    Err(e) => {
+                        log::error!("Surface error after configure: {e:?}");
+                        return;
+                    }
+                }
             }
             Err(wgpu::SurfaceError::Timeout) => return,
             Err(e) => {
@@ -1438,7 +1444,13 @@ impl<A: Application> EngineState<A> {
                     Ok(t) => t,
                     Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
                         popup.wgpu_surface.configure(&adapter.device, &popup.config);
-                        return;
+                        match popup.wgpu_surface.get_current_texture() {
+                            Ok(t) => t,
+                            Err(e) => {
+                                log::error!("Popup surface error after configure: {e:?}");
+                                return;
+                            }
+                        }
                     }
                     Err(wgpu::SurfaceError::Timeout) => return,
                     Err(e) => {
diff --git a/src/main.rs b/src/main.rs
index 00011a4..bb29ec5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -933,7 +933,13 @@ impl State {
             Ok(t) => t,
             Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
                 self.surface.configure(&self.device, &self.config);
-                return;
+                match self.surface.get_current_texture() {
+                    Ok(t) => t,
+                    Err(e) => {
+                        log::error!("Surface error after configure: {e:?}");
+                        return;
+                    }
+                }
             }
             Err(wgpu::SurfaceError::Timeout) => return,
             Err(e) => {
diff --git a/src/widget/input/slider.rs b/src/widget/input/slider.rs
index 40a71fe..71665ad 100644
--- a/src/widget/input/slider.rs
+++ b/src/widget/input/slider.rs
@@ -24,7 +24,7 @@ impl Slider {
             dragging: false,
             value: 0.5,
             drag_offset: 0.0,
-            scroll_enabled: false,
+            scroll_enabled: true,
             show_readout: false,
             editing: false,
             edit_buffer: String::new(),