GUI: re-apply UI settings when displays are connec

This commit is contained in:
tildearrow 2023-08-27 03:58:01 -05:00
parent 0e19716dcd
commit 64e6cf12c2
2 changed files with 12 additions and 0 deletions

View file

@ -3520,10 +3520,12 @@ bool FurnaceGUI::loop() {
case SDL_DISPLAYEVENT_CONNECTED:
logD("display %d connected!",ev.display.display);
updateWindow=true;
shallDetectScale=16;
break;
case SDL_DISPLAYEVENT_DISCONNECTED:
logD("display %d disconnected!",ev.display.display);
updateWindow=true;
shallDetectScale=16;
break;
case SDL_DISPLAYEVENT_ORIENTATION:
logD("display oriented to %d",ev.display.data1);
@ -6115,6 +6117,14 @@ bool FurnaceGUI::loop() {
willCommit=false;
}
if (shallDetectScale) {
if (--shallDetectScale<1) {
if (settings.dpiScale<0.5f) {
applyUISettings();
}
}
}
if (fontsFailed) {
showError("it appears I couldn't load these fonts. any setting you can check?");
logE("couldn't load fonts");
@ -6889,6 +6899,7 @@ FurnaceGUI::FurnaceGUI():
displayInsTypeListMakeInsSample(-1),
mobileEditPage(0),
wheelCalmDown(0),
shallDetectScale(0),
mobileMenuPos(0.0f),
autoButtonSize(0.0f),
mobileEditAnim(0.0f),

View file

@ -1343,6 +1343,7 @@ class FurnaceGUI {
int displayInsTypeListMakeInsSample;
int mobileEditPage;
int wheelCalmDown;
int shallDetectScale;
float mobileMenuPos, autoButtonSize, mobileEditAnim;
ImVec2 mobileEditButtonPos, mobileEditButtonSize;
const int* curSysSection;