fix: Make sure WM_NCCALCSIZE never tries to sleep a negative amount of time
#1842
This commit is contained in:
parent
3dec4cc698
commit
ee555e0da9
@ -206,13 +206,14 @@ namespace hex {
|
|||||||
if (delta >= 0) {
|
if (delta >= 0) {
|
||||||
sleepTicks = delta / period;
|
sleepTicks = delta / period;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
sleepTicks = -1 + delta / period;
|
sleepTicks = -1 + delta / period;
|
||||||
}
|
}
|
||||||
|
|
||||||
sleepMilliSeconds = delta - (period * sleepTicks);
|
sleepMilliSeconds = delta - (period * sleepTicks);
|
||||||
const double sleepTime = (1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
|
const double sleepTime = std::round(1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
|
||||||
Sleep(DWORD(std::round(sleepTime)));
|
if (sleepTime >= 0.0) {
|
||||||
|
Sleep(DWORD(sleepTime));
|
||||||
|
}
|
||||||
timeEndPeriod(granularity);
|
timeEndPeriod(granularity);
|
||||||
|
|
||||||
return WVR_REDRAW;
|
return WVR_REDRAW;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user