Skip to content

Commit

Permalink
fix: Make sure WM_NCCALCSIZE never tries to sleep a negative amount o…
Browse files Browse the repository at this point in the history
…f time

#1842
  • Loading branch information
WerWolv committed Dec 31, 2024
1 parent 3dec4cc commit ee555e0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main/gui/source/window/win_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,14 @@ namespace hex {
if (delta >= 0) {
sleepTicks = delta / period;
} else {

sleepTicks = -1 + delta / period;
}

sleepMilliSeconds = delta - (period * sleepTicks);
const double sleepTime = (1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
Sleep(DWORD(std::round(sleepTime)));
const double sleepTime = std::round(1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
if (sleepTime >= 0.0) {
Sleep(DWORD(sleepTime));
}
timeEndPeriod(granularity);

return WVR_REDRAW;
Expand Down

0 comments on commit ee555e0

Please sign in to comment.