diff --git a/src/libs/tgfclient/guieventloop.cpp b/src/libs/tgfclient/guieventloop.cpp index b41ef6204..fe2aa20e9 100644 --- a/src/libs/tgfclient/guieventloop.cpp +++ b/src/libs/tgfclient/guieventloop.cpp @@ -19,9 +19,7 @@ #include #include "tgfclient.h" -#ifndef NoMaxRefreshRate #include "tgf.h" -#endif #ifdef WEBSERVER #include "webserver.h" @@ -51,18 +49,14 @@ class GfuiEventLoop::Private // Variables. bool bRedisplay; // Flag to say if a redisplay is necessary. -#ifndef NoMaxRefreshRate double max_refresh; // Max refresh rate. -#endif }; GfuiEventLoop::Private::Private() : cbMouseButton(0), cbMouseMotion(0), cbMousePassiveMotion(0), cbMouseWheel(0), cbJoystickAxis(0), cbJoystickButton(0), - cbDisplay(0), cbReshape(0), bRedisplay(false) -#ifndef NoMaxRefreshRate - , max_refresh(50.0) -#endif + cbDisplay(0), cbReshape(0), bRedisplay(false), + max_refresh(50.0) { } @@ -247,9 +241,7 @@ void GfuiEventLoop::operator()() if (!quitRequested()) { -#ifndef NoMaxRefreshRate double now = GfTimeClock(); -#endif // Recompute if anything to. recompute(); @@ -257,7 +249,6 @@ void GfuiEventLoop::operator()() // Redisplay if anything to. redisplay(); -#ifndef NoMaxRefreshRate double elapsed = GfTimeClock() - now; if (_pPrivate->max_refresh) @@ -266,7 +257,6 @@ void GfuiEventLoop::operator()() if (elapsed < rate) GfSleep(rate - elapsed); } -#endif } } @@ -318,12 +308,10 @@ void GfuiEventLoop::postRedisplay(void) _pPrivate->bRedisplay = true; } -#ifndef NoMaxRefreshRate void GfuiEventLoop::setMaxRefreshRate(double rate) { _pPrivate->max_refresh = rate; } -#endif void GfuiEventLoop::forceRedisplay() { diff --git a/src/libs/tgfclient/guiscreen.cpp b/src/libs/tgfclient/guiscreen.cpp index 681f32b2b..c7309b99a 100644 --- a/src/libs/tgfclient/guiscreen.cpp +++ b/src/libs/tgfclient/guiscreen.cpp @@ -207,9 +207,7 @@ ScreenSizeVector GfScrGetSupportedSizes(int nDisplayIndex) tScreenSize last; last.width = 0; last.height = 0; -#ifndef NoMaxRefreshRate last.refresh_rate = 0; -#endif bounds.w = 0; bounds.h = 0; @@ -243,9 +241,7 @@ ScreenSizeVector GfScrGetSupportedSizes(int nDisplayIndex) GfLogDebug(" %d x %d x %d @ %d hz\n",mode.w,mode.h,SDL_BITSPERPIXEL(mode.format),mode.refresh_rate); last.width = mode.w; last.height = mode.h; -#ifndef NoMaxRefreshRate last.refresh_rate = mode.refresh_rate; -#endif vecSizes.push_back(last); } } @@ -283,18 +279,14 @@ tScreenSize GfScrGetCurrentDisplaySize(int nDisplayIndex) size.width = 0; size.height = 0; -#ifndef NoMaxRefreshRate size.refresh_rate = 0; -#endif SDL_DisplayMode mode; if(SDL_GetCurrentDisplayMode(nDisplayIndex, &mode) == 0) { size.width = mode.w; size.height = mode.h; -#ifndef NoMaxRefreshRate size.refresh_rate = mode.refresh_rate; -#endif } return size; } @@ -503,11 +495,9 @@ bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen) GfScrStartDisplayId = 0; } -#ifndef NoMaxRefreshRate double maxRefreshRate = GfParmGetNum(hparmScreen, pszScrPropSec, GFSCR_ATT_MAXREFRESH, NULL, 50); GfuiApp().eventLoop().setMaxRefreshRate(maxRefreshRate); -#endif bool bFullScreen; if (nFullScreen < 0) @@ -742,9 +732,7 @@ bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen) GfLogInfo(" Full screen : %s\n", (bfVideoMode & SDL_WINDOW_FULLSCREEN) ? "Yes" : "No"); GfLogInfo(" Size : %dx%d\n", nWinWidth, nWinHeight); GfLogInfo(" Color depth : %d bits\n", nTotalDepth); -#ifndef NoMaxRefreshRate GfLogInfo(" Max. refresh rate : %f\n", maxRefreshRate); -#endif // Report about underlying hardware (needs a running frame buffer). GfglFeatures::self().dumpHardwareInfo(); @@ -826,10 +814,8 @@ void GfScrShutdown(void) GfParmGetNum(hparmScreen, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_STARTUPDISPLAY, 0, 0)); GfParmSetStr(hparmScreen, GFSCR_SECT_VALIDPROPS, GFSCR_ATT_VDETECT, GfParmGetStr(hparmScreen, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_VDETECT, GFSCR_VAL_VDETECT_AUTO)); -#ifndef NoMaxRefreshRate GfParmSetNum(hparmScreen, GFSCR_SECT_VALIDPROPS, GFSCR_ATT_MAXREFRESH, 0, GfParmGetNum(hparmScreen, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_MAXREFRESH, 0, 50)); -#endif const char* pszVInitMode = GfParmGetStr(hparmScreen, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_VINIT, GFSCR_VAL_VINIT_COMPATIBLE); @@ -1286,7 +1272,6 @@ bool GfScrInitSDL2() GfuiApp().eventLoop().setReshapeCB(gfScrReshapeViewport); GfuiApp().eventLoop().postRedisplay(); -#ifndef NoMaxRefreshRate double maxRefreshRate = 50; void* hparmScreen = GfParmReadFileLocal(GFSCR_CONF_FILE, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT); @@ -1299,7 +1284,6 @@ bool GfScrInitSDL2() } GfuiApp().eventLoop().setMaxRefreshRate(maxRefreshRate); -#endif return true; } diff --git a/src/libs/tgfclient/tgfclient.h b/src/libs/tgfclient/tgfclient.h index 07ea2e530..694cdee09 100644 --- a/src/libs/tgfclient/tgfclient.h +++ b/src/libs/tgfclient/tgfclient.h @@ -75,9 +75,7 @@ typedef struct ScreenSize { int width; // Width in pixels. int height; // Height in pixels. -#ifndef NoMaxRefreshRate double refresh_rate; // Refresh rate in Hz. -#endif } tScreenSize; typedef std::vector ScreenSizeVector; @@ -771,10 +769,8 @@ class TGFCLIENT_API GfuiEventLoop : public GfEventLoop //! Force a call to the "redisplay/refresh" callback function. void forceRedisplay(); -#ifndef NoMaxRefreshRate //! Sets maximum refresh rate to the event loop. void setMaxRefreshRate(double rate); -#endif protected: diff --git a/src/modules/userinterface/legacymenu/confscreens/displayconfig.cpp b/src/modules/userinterface/legacymenu/confscreens/displayconfig.cpp index 3353051f4..f9dfc5f3f 100644 --- a/src/modules/userinterface/legacymenu/confscreens/displayconfig.cpp +++ b/src/modules/userinterface/legacymenu/confscreens/displayconfig.cpp @@ -33,10 +33,8 @@ static const char* ADisplayModes[DisplayMenu::nDisplayModes] = { "Full-screen", static const char* MonitorTypes[DisplayMenu::nDisplayTypes] = { "none", "4:3", "16:9", "21:9" }; static const char* SpansplitValues[] = { GR_VAL_NO, GR_VAL_YES }; static const int NbSpansplitValues = sizeof(SpansplitValues) / sizeof(SpansplitValues[0]); -#ifndef NoMaxRefreshRate static const int AMaxRefreshRates[] = {30, 40, 50, 60, 75, 85, 100, 120, 150, 200 }; static const int NMaxRefreshRates = sizeof(AMaxRefreshRates) / sizeof(AMaxRefreshRates[0]); -#endif // The unique DisplayMenu instance. static DisplayMenu* PDisplayMenu = 0; @@ -155,7 +153,6 @@ void DisplayMenu::onChangeMenuDisplay(tComboBoxInfo *pInfo) pMenu->setMenuDisplay(pInfo->nPos); } -#ifndef NoMaxRefreshRate void DisplayMenu::onChangeMaxRefreshRate(tComboBoxInfo *pInfo) { // Get the DisplayMenu instance from call-back user data. @@ -163,7 +160,6 @@ void DisplayMenu::onChangeMaxRefreshRate(tComboBoxInfo *pInfo) pMenu->setMaxRefreshRateIndex(pInfo->nPos); } -#endif // Re-init screen to take new graphical settings into account (implies process restart). void DisplayMenu::onAccept(void *pDisplayMenu) @@ -203,10 +199,7 @@ bool DisplayMenu::restartNeeded() || (_nScreenWidth !=_nOriginalScreenWidth) || (_nScreenHeight != _nOriginalScreenHeight) || (_nOriginalMenuDisplay != _nMenuDisplay)) -#ifndef NoMaxRefreshRate - || (_nOriginalMaxRefreshRate != _nMaxRefreshRate) -#endif - ; + || (_nOriginalMaxRefreshRate != _nMaxRefreshRate); if(GfScrUsingResizableWindow() && (_eDisplayMode == eResizable)) needRestart = false; @@ -265,7 +258,6 @@ void DisplayMenu::updateControls() sprintf(buf, "%g", PDisplayMenu->_fArcRatio); GfuiEditboxSetString(getMenuHandle(), sArcRatioID, buf); -#ifndef NoMaxRefreshRate nControlId = getDynamicControlId("MaxRefreshRateCombo"); int nMaxRefRateIndex = 0; // Defaults to None. for (int nMaxRefRateInd = 0; nMaxRefRateInd < NMaxRefreshRates; nMaxRefRateInd++) @@ -275,7 +267,6 @@ void DisplayMenu::updateControls() break; } GfuiComboboxSetSelectedIndex(getMenuHandle(), nControlId, nMaxRefRateIndex); -#endif } void DisplayMenu::loadSettings() @@ -307,11 +298,9 @@ void DisplayMenu::loadSettings() } -#ifndef NoMaxRefreshRate // Max. refresh rate (Hz). _nMaxRefreshRate = _nOriginalMaxRefreshRate = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_MAXREFRESH, NULL, 50); -#endif // Release screen config params file. GfParmReleaseHandle(hScrConfParams); @@ -332,9 +321,7 @@ void DisplayMenu::storeSettings() const GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_WIN_X, (char*)NULL, _nScreenWidth); GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_WIN_Y, (char*)NULL, _nScreenHeight); GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_STARTUPDISPLAY, (char*)NULL, _nMenuDisplay); -#ifndef NoMaxRefreshRate GfParmSetNum(hScrConfParams, GFSCR_SECT_INTESTPROPS, GFSCR_ATT_MAXREFRESH, (char*)NULL, _nMaxRefreshRate); -#endif const char* pszDisplMode = (_eDisplayMode == eFullScreen) ? GFSCR_VAL_YES : GFSCR_VAL_NO; @@ -472,9 +459,7 @@ void DisplayMenu::resetScreenSizes() tScreenSize _currSize = GfScrGetCurrentDisplaySize( _nMenuDisplay); _nScreenWidth = _currSize.width; _nScreenHeight = _currSize.height; -#ifndef NoMaxRefreshRate _nMaxRefreshRate = _currSize.refresh_rate; -#endif } else { @@ -528,7 +513,6 @@ void DisplayMenu::resetScreenSizes() // Select the found one in the combo-box. GfuiComboboxSetSelectedIndex(getMenuHandle(), nComboId, nScreenSizeIndex); -#ifndef NoMaxRefreshRate { const int nComboId = getDynamicControlId("MaxRefreshRateCombo"); @@ -542,7 +526,6 @@ void DisplayMenu::resetScreenSizes() } } } -#endif } void DisplayMenu::setScreenSizeIndex(int nIndex) @@ -585,12 +568,10 @@ void DisplayMenu::setMenuDisplay(int nIndex) } } -#ifndef NoMaxRefreshRate void DisplayMenu::setMaxRefreshRateIndex(int nIndex) { _nMaxRefreshRate = AMaxRefreshRates[nIndex]; } -#endif DisplayMenu::DisplayMenu() : GfuiMenuScreen("displayconfigmenu.xml") @@ -608,9 +589,7 @@ DisplayMenu::DisplayMenu() _nOriginalScreenHeight = 600; _nOriginalMenuDisplay = 0; _eOriginalDisplayMode = eWindowed; -#ifndef NoMaxRefreshRate _nMaxRefreshRate = 50; -#endif } bool DisplayMenu::initialize(void *pPreviousMenu) @@ -658,10 +637,8 @@ bool DisplayMenu::initialize(void *pPreviousMenu) sArcRatioID = createEditControl("arcratioedit", this, NULL, onChangeArcRatio); -#ifndef NoMaxRefreshRate const int nMaxRefRateComboId = createComboboxControl("MaxRefreshRateCombo", this, onChangeMaxRefreshRate); -#endif createButtonControl("ApplyButton", this, onAccept); createButtonControl("CancelButton", this, onCancel); @@ -691,7 +668,6 @@ bool DisplayMenu::initialize(void *pPreviousMenu) GfuiComboboxAddText(getMenuHandle(), nSpanSplitsComboId, SpansplitValues[index]); -#ifndef NoMaxRefreshRate // 6) Max refresh rate combo. std::ostringstream ossMaxRefRate; for (int nRefRateInd = 0; nRefRateInd < NMaxRefreshRates; nRefRateInd++) @@ -703,7 +679,6 @@ bool DisplayMenu::initialize(void *pPreviousMenu) ossMaxRefRate << "None"; GfuiComboboxAddText(getMenuHandle(), nMaxRefRateComboId, ossMaxRefRate.str().c_str()); } -#endif return true; } diff --git a/src/modules/userinterface/legacymenu/confscreens/displayconfig.h b/src/modules/userinterface/legacymenu/confscreens/displayconfig.h index 06ac5b0c1..df70544d0 100644 --- a/src/modules/userinterface/legacymenu/confscreens/displayconfig.h +++ b/src/modules/userinterface/legacymenu/confscreens/displayconfig.h @@ -25,8 +25,6 @@ #include "confscreens.h" -// Comment-out to activate max. refresh rate settings. -#define NoMaxRefreshRate 1 class DisplayMenu : public GfuiMenuScreen @@ -46,9 +44,7 @@ public: void setMonitorType(EDisplayType eType); void setArcRatio(float ratio); void setMenuDisplay(int nIndex); -#ifndef NoMaxRefreshRate void setMaxRefreshRateIndex(int nIndex); -#endif void storeSettings() const; void loadSettings(); @@ -76,9 +72,7 @@ protected: static void onChangeScreenDist(void *pDisplayMenu); static void onChangeArcRatio(void *pDisplayMenu); static void onChangeMenuDisplay(tComboBoxInfo *pInfo); -#ifndef NoMaxRefreshRate static void onChangeMaxRefreshRate(tComboBoxInfo *pInfo); -#endif static void onAccept(void *pDisplayMenu); static void onCancel(void *pDisplayMenu); @@ -108,11 +102,9 @@ private: float _fScreenDist; -#ifndef NoMaxRefreshRate //! Currently selected max. refresh rate (Hz). int _nMaxRefreshRate; int _nOriginalMaxRefreshRate; -#endif }; extern void* DisplayMenuInit(void* pPreviousMenu);