fix: fix window drag/resize smoothness regression @ high refresh rates

This commit is contained in:
2026-03-27 15:58:45 +01:00
parent 994c32c09d
commit 78c0cabc77
+16
View File
@@ -373,6 +373,18 @@ static bool desktop_has_visible_dirty_window(const DesktopState* ds) {
return false; return false;
} }
static bool desktop_has_active_interaction(const DesktopState* ds) {
if (ds->vol_dragging) return true;
for (int i = 0; i < ds->window_count; i++) {
const Window& win = ds->windows[i];
if (win.state == WIN_CLOSED || win.state == WIN_MINIMIZED) continue;
if (win.dragging || win.resizing) return true;
}
return false;
}
static void desktop_clear_window_dirty(DesktopState* ds) { static void desktop_clear_window_dirty(DesktopState* ds) {
for (int i = 0; i < ds->window_count; i++) { for (int i = 0; i < ds->window_count; i++) {
ds->windows[i].dirty = false; ds->windows[i].dirty = false;
@@ -613,8 +625,12 @@ void gui::desktop_run(DesktopState* ds) {
firstFrame = false; firstFrame = false;
} }
if (desktop_has_active_interaction(ds)) {
montauk::sleep_ms(1);
} else {
montauk::sleep_ms(sceneChanged ? 4 : 16); montauk::sleep_ms(sceneChanged ? 4 : 16);
} }
}
} }
// ============================================================================ // ============================================================================