Move rqWindowAdjust.set() to EventThread

This commit is contained in:
Snowdream 2022-07-24 03:50:06 -04:00
parent 1424a19189
commit 58de823d41
2 changed files with 6 additions and 6 deletions

View file

@ -1353,8 +1353,6 @@ void Graphics::resizeScreen(int width, int height) {
glState.scissorBox.set(IntRect(0, 0, p->scRes.x, p->scRes.y));
p->threadData->rqWindowAdjust.set();
shState->eThread().requestWindowResize(width, height);
}
@ -1365,8 +1363,7 @@ void Graphics::resizeWindow(int width, int height, bool center) {
if (width == p->winSize.x / p->backingScaleFactor &&
height == p->winSize.y / p->backingScaleFactor)
return;
p->threadData->rqWindowAdjust.set();
shState->eThread().requestWindowResize(width, height);
if (center)
@ -1460,10 +1457,10 @@ void Graphics::reset() {
}
void Graphics::center() {
p->threadData->rqWindowAdjust.wait();
if (getFullscreen())
return;
p->threadData->rqWindowAdjust.reset();
p->threadData->ethread->requestWindowCenter();
}
@ -1554,7 +1551,7 @@ double Graphics::getScale() const {
}
void Graphics::setScale(double factor) {
p->threadData->rqWindowAdjust.reset();
p->threadData->rqWindowAdjust.wait();
factor = clamp(factor, 0.5, 4.0);
if (factor == getScale())

View file

@ -705,6 +705,7 @@ void EventThread::requestFullscreenMode(bool mode)
void EventThread::requestWindowResize(int width, int height)
{
shState->rtData().rqWindowAdjust.set();
SDL_Event event;
event.type = usrIdStart + REQUEST_WINRESIZE;
event.window.data1 = width;
@ -714,6 +715,7 @@ void EventThread::requestWindowResize(int width, int height)
void EventThread::requestWindowReposition(int x, int y)
{
shState->rtData().rqWindowAdjust.set();
SDL_Event event;
event.type = usrIdStart + REQUEST_WINREPOSITION;
event.window.data1 = x;
@ -723,6 +725,7 @@ void EventThread::requestWindowReposition(int x, int y)
void EventThread::requestWindowCenter()
{
shState->rtData().rqWindowAdjust.set();
SDL_Event event;
event.type = usrIdStart + REQUEST_WINCENTER;
SDL_PushEvent(&event);