aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldisplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llpaneldisplay.cpp')
-rw-r--r--linden/indra/newview/llpaneldisplay.cpp72
1 files changed, 11 insertions, 61 deletions
diff --git a/linden/indra/newview/llpaneldisplay.cpp b/linden/indra/newview/llpaneldisplay.cpp
index 3e60745..d510775 100644
--- a/linden/indra/newview/llpaneldisplay.cpp
+++ b/linden/indra/newview/llpaneldisplay.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2001-2008, Linden Research, Inc. 7 * Copyright (c) 2001-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -753,6 +753,8 @@ void LLPanelDisplay::onApplyResolution(LLUICtrl* src, void* user_data)
753 753
754void LLPanelDisplay::applyResolution() 754void LLPanelDisplay::applyResolution()
755{ 755{
756
757 gGL.flush();
756 char aspect_ratio_text[ASPECT_RATIO_STR_LEN]; /*Flawfinder: ignore*/ 758 char aspect_ratio_text[ASPECT_RATIO_STR_LEN]; /*Flawfinder: ignore*/
757 if (mCtrlAspectRatio->getCurrentIndex() == -1) 759 if (mCtrlAspectRatio->getCurrentIndex() == -1)
758 { 760 {
@@ -787,75 +789,23 @@ void LLPanelDisplay::applyResolution()
787 { 789 {
788 mAspectRatio = (F32)mCtrlAspectRatio->getValue().asReal(); 790 mAspectRatio = (F32)mCtrlAspectRatio->getValue().asReal();
789 } 791 }
790 792
791 // presumably, user entered a non-numeric value if aspect_ratio == 0.f 793 // presumably, user entered a non-numeric value if aspect_ratio == 0.f
792 if (mAspectRatio != 0.f) 794 if (mAspectRatio != 0.f)
793 { 795 {
794 mAspectRatio = llclamp(mAspectRatio, 0.2f, 5.f); 796 mAspectRatio = llclamp(mAspectRatio, 0.2f, 5.f);
795 gSavedSettings.setF32("FullScreenAspectRatio", mAspectRatio); 797 gSavedSettings.setF32("FullScreenAspectRatio", mAspectRatio);
796 if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
797 {
798 gViewerWindow->getWindow()->setNativeAspectRatio(0.f);
799 }
800 else
801 {
802 gViewerWindow->getWindow()->setNativeAspectRatio(mAspectRatio);
803 }
804 } 798 }
805 gViewerWindow->reshape(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); 799
806
807 // Screen resolution 800 // Screen resolution
808 S32 num_resolutions; 801 S32 num_resolutions;
809 LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions); 802 LLWindow::LLWindowResolution* supported_resolutions =
810 803 gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions);
811 // switching to windowed 804 U32 resIndex = mCtrlFullScreen->getCurrentIndex();
812 BOOL fullscreen = !mCtrlWindowed->get(); 805 gSavedSettings.setS32("FullScreenWidth", supported_resolutions[resIndex].mWidth);
813 806 gSavedSettings.setS32("FullScreenHeight", supported_resolutions[resIndex].mHeight);
814 // check if resolution has changed
815 BOOL targetFullscreen;
816 S32 targetWidth;
817 S32 targetHeight;
818
819 gViewerWindow->getTargetWindow(targetFullscreen, targetWidth, targetHeight);
820 807
821 if ((fullscreen != targetFullscreen) || 808 gViewerWindow->requestResolutionUpdate(!mCtrlWindowed->get());
822 (fullscreen &&
823 (supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mWidth != targetWidth ||
824 supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mHeight != targetHeight)
825 ))
826 {
827 // change fullscreen resolution or switch in/out of windowed mode
828 BOOL result;
829
830 BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED);
831 if (fullscreen)
832 {
833 result = gViewerWindow->changeDisplaySettings(TRUE,
834 LLCoordScreen( supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mWidth,
835 supported_resolutions[mCtrlFullScreen->getCurrentIndex()].mHeight),
836 gSavedSettings.getBOOL("DisableVerticalSync"),
837 logged_in);
838 }
839 else
840 {
841 result = gViewerWindow->changeDisplaySettings(FALSE,
842 LLCoordScreen(gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight")),
843 TRUE,
844 logged_in);
845 }
846 if (!result)
847 {
848
849 // GL is non-existent at this point, so we can't continue.
850 llerrs << "LLPanelDisplay::apply() failed" << llendl;
851 }
852 }
853
854 // force aspect ratio
855 if (fullscreen)
856 {
857 LLViewerCamera::getInstance()->setAspect( gViewerWindow->getDisplayAspectRatio() );
858 }
859 809
860 send_agent_update(TRUE); 810 send_agent_update(TRUE);
861 811