aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewerwindow.cpp')
-rw-r--r--linden/indra/newview/llviewerwindow.cpp203
1 files changed, 83 insertions, 120 deletions
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp
index 2f49b67..1a9a208 100644
--- a/linden/indra/newview/llviewerwindow.cpp
+++ b/linden/indra/newview/llviewerwindow.cpp
@@ -918,7 +918,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
918 918
919 // *HACK: this should be rolled into the composite tool logic, not 919 // *HACK: this should be rolled into the composite tool logic, not
920 // hardcoded at the top level. 920 // hardcoded at the top level.
921 if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode()) 921 if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() && LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance())
922 { 922 {
923 // If the current tool didn't process the click, we should show 923 // If the current tool didn't process the click, we should show
924 // the pie menu. This can be done by passing the event to the pie 924 // the pie menu. This can be done by passing the event to the pie
@@ -2098,12 +2098,7 @@ void LLViewerWindow::reshape(S32 width, S32 height)
2098 gSavedSettings.setBOOL("FullScreen", mWantFullscreen); 2098 gSavedSettings.setBOOL("FullScreen", mWantFullscreen);
2099 2099
2100 // store new settings for the mode we are in, regardless 2100 // store new settings for the mode we are in, regardless
2101 if (mWindow->getFullscreen()) 2101 if (!mWindow->getFullscreen())
2102 {
2103 gSavedSettings.setS32("FullScreenWidth", width);
2104 gSavedSettings.setS32("FullScreenHeight", height);
2105 }
2106 else
2107 { 2102 {
2108 // Only save size if not maximized 2103 // Only save size if not maximized
2109 BOOL maximized = mWindow->getMaximized(); 2104 BOOL maximized = mWindow->getMaximized();
@@ -3586,6 +3581,16 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de
3586 // world coordinates of mouse 3581 // world coordinates of mouse
3587 LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y); 3582 LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y);
3588 LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin(); 3583 LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin();
3584
3585 //get near clip plane
3586 LLVector3 n = LLViewerCamera::getInstance()->getAtAxis();
3587 LLVector3 p = mouse_point_global + n * LLViewerCamera::getInstance()->getNear();
3588
3589 //project mouse point onto plane
3590 LLVector3 pos;
3591 line_plane(mouse_point_global, mouse_direction_global, p, n, pos);
3592 mouse_point_global = pos;
3593
3589 LLVector3 mouse_world_start = mouse_point_global; 3594 LLVector3 mouse_world_start = mouse_point_global;
3590 LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth; 3595 LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth;
3591 3596
@@ -4695,79 +4700,13 @@ void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height)
4695 } 4700 }
4696} 4701}
4697 4702
4698bool LLViewerWindow::updateResolution() 4703void LLViewerWindow::requestResolutionUpdate(bool fullscreen_checked)
4699{
4700 if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
4701 {
4702 getWindow()->setNativeAspectRatio(0.f);
4703 }
4704 else
4705 {
4706 getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio"));
4707 }
4708
4709 reshape(getWindowDisplayWidth(), getWindowDisplayHeight());
4710
4711 // Screen resolution
4712 S32 num_resolutions;
4713 LLWindow::LLWindowResolution* supported_resolutions = getWindow()->getSupportedResolutions(num_resolutions);
4714
4715 // check if resolution has changed
4716 BOOL targetFullscreen;
4717 S32 targetWidth;
4718 S32 targetHeight;
4719
4720 getTargetWindow(targetFullscreen, targetWidth, targetHeight);
4721
4722 if ((mIsFullscreenChecked != (bool) targetFullscreen) ||
4723 (mIsFullscreenChecked &&
4724 (supported_resolutions[mCurrResolutionIndex].mWidth != targetWidth ||
4725 supported_resolutions[mCurrResolutionIndex].mHeight != targetHeight)
4726 ))
4727 {
4728 // change fullscreen resolution or switch in/out of windowed mode
4729 BOOL result;
4730
4731 BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED);
4732 if (mIsFullscreenChecked)
4733 {
4734 result = changeDisplaySettings(TRUE,
4735 LLCoordScreen( supported_resolutions[mCurrResolutionIndex].mWidth,
4736 supported_resolutions[mCurrResolutionIndex].mHeight),
4737 gSavedSettings.getBOOL("DisableVerticalSync"),
4738 logged_in);
4739 }
4740 else
4741 {
4742 result = changeDisplaySettings(FALSE,
4743 LLCoordScreen(gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight")),
4744 TRUE,
4745 logged_in);
4746 }
4747 if (!result)
4748 {
4749
4750 // GL is non-existent at this point, so we can't continue.
4751 llerrs << "LLPanelDisplay::apply() failed" << llendl;
4752 }
4753 }
4754
4755 // force aspect ratio
4756 if (mIsFullscreenChecked)
4757 {
4758 LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() );
4759 }
4760 return true;
4761}
4762
4763void LLViewerWindow::requestResolutionUpdate(bool fullscreen_checked, U32 resolution_index)
4764{ 4704{
4765 mResDirty = true; 4705 mResDirty = true;
4706 mWantFullscreen = fullscreen_checked;
4766 mIsFullscreenChecked = fullscreen_checked; 4707 mIsFullscreenChecked = fullscreen_checked;
4767 mCurrResolutionIndex = resolution_index;
4768} 4708}
4769 4709
4770
4771BOOL LLViewerWindow::checkSettings() 4710BOOL LLViewerWindow::checkSettings()
4772{ 4711{
4773 if (mStatesDirty) 4712 if (mStatesDirty)
@@ -4780,42 +4719,70 @@ BOOL LLViewerWindow::checkSettings()
4780 // We want to update the resolution AFTER the states getting refreshed not before. 4719 // We want to update the resolution AFTER the states getting refreshed not before.
4781 if (mResDirty) 4720 if (mResDirty)
4782 { 4721 {
4783 updateResolution(); 4722 if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
4723 {
4724 getWindow()->setNativeAspectRatio(0.f);
4725 }
4726 else
4727 {
4728 getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio"));
4729 }
4730
4731 reshape(getWindowDisplayWidth(), getWindowDisplayHeight());
4732
4733 // force aspect ratio
4734 if (mIsFullscreenChecked)
4735 {
4736 LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() );
4737 }
4738
4784 mResDirty = false; 4739 mResDirty = false;
4785 // This will force a state update the next frame. 4740 // This will force a state update the next frame.
4786 mStatesDirty = true; 4741 mStatesDirty = true;
4787 } 4742 }
4788 4743
4789 BOOL is_fullscreen = mWindow->getFullscreen(); 4744 BOOL is_fullscreen = mWindow->getFullscreen();
4790 if (is_fullscreen && !mWantFullscreen) 4745 if(mWantFullscreen)
4791 { 4746 {
4792 changeDisplaySettings(FALSE, 4747 LLCoordScreen screen_size;
4793 LLCoordScreen(gSavedSettings.getS32("WindowWidth"), 4748 LLCoordScreen desired_screen_size(gSavedSettings.getS32("FullScreenWidth"),
4794 gSavedSettings.getS32("WindowHeight")), 4749 gSavedSettings.getS32("FullScreenHeight"));
4795 TRUE, 4750 getWindow()->getSize(&screen_size);
4796 mShowFullscreenProgress); 4751 if(!is_fullscreen ||
4797 mStatesDirty = true; 4752 screen_size.mX != desired_screen_size.mX
4798 return TRUE; 4753 || screen_size.mY != desired_screen_size.mY)
4754 {
4755 if (!LLStartUp::canGoFullscreen())
4756 {
4757 return FALSE;
4758 }
4759
4760 LLGLState::checkStates();
4761 LLGLState::checkTextureChannels();
4762 changeDisplaySettings(TRUE,
4763 desired_screen_size,
4764 gSavedSettings.getBOOL("DisableVerticalSync"),
4765 mShowFullscreenProgress);
4766
4767 LLGLState::checkStates();
4768 LLGLState::checkTextureChannels();
4769 mStatesDirty = true;
4770 return TRUE;
4771 }
4799 } 4772 }
4800 else if (!is_fullscreen && mWantFullscreen) 4773 else
4801 { 4774 {
4802 if (!LLStartUp::canGoFullscreen()) 4775 if(is_fullscreen)
4803 { 4776 {
4804 return FALSE; 4777 // Changing to windowed mode.
4778 changeDisplaySettings(FALSE,
4779 LLCoordScreen(gSavedSettings.getS32("WindowWidth"),
4780 gSavedSettings.getS32("WindowHeight")),
4781 TRUE,
4782 mShowFullscreenProgress);
4783 mStatesDirty = true;
4784 return TRUE;
4805 } 4785 }
4806
4807 LLGLState::checkStates();
4808 LLGLState::checkTextureChannels();
4809 changeDisplaySettings(TRUE,
4810 LLCoordScreen(gSavedSettings.getS32("FullScreenWidth"),
4811 gSavedSettings.getS32("FullScreenHeight")),
4812 gSavedSettings.getBOOL("DisableVerticalSync"),
4813 mShowFullscreenProgress);
4814
4815 LLGLState::checkStates();
4816 LLGLState::checkTextureChannels();
4817 mStatesDirty = true;
4818 return TRUE;
4819 } 4786 }
4820 return FALSE; 4787 return FALSE;
4821} 4788}
@@ -4846,13 +4813,9 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
4846 BOOL old_fullscreen = mWindow->getFullscreen(); 4813 BOOL old_fullscreen = mWindow->getFullscreen();
4847 if (!old_fullscreen && fullscreen && !LLStartUp::canGoFullscreen()) 4814 if (!old_fullscreen && fullscreen && !LLStartUp::canGoFullscreen())
4848 { 4815 {
4849 // we can't do this now, so do it later 4816 // Not allowed to switch to fullscreen now, so exit early.
4850 4817 // *NOTE: This case should never be reached, but just-in-case.
4851 gSavedSettings.setS32("FullScreenWidth", size.mX); 4818 return TRUE;
4852 gSavedSettings.setS32("FullScreenHeight", size.mY);
4853 //gSavedSettings.setBOOL("DisableVerticalSync", disable_vsync);
4854
4855 return TRUE; // a lie..., because we'll get to it later
4856 } 4819 }
4857 4820
4858 U32 fsaa = gSavedSettings.getU32("RenderFSAASamples"); 4821 U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
@@ -4939,7 +4902,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
4939#if LL_WINDOWS 4902#if LL_WINDOWS
4940 // Only trigger a reshape after switching to fullscreen; otherwise rely on the windows callback 4903 // Only trigger a reshape after switching to fullscreen; otherwise rely on the windows callback
4941 // (otherwise size is wrong; this is the entire window size, reshape wants the visible window size) 4904 // (otherwise size is wrong; this is the entire window size, reshape wants the visible window size)
4942 if (fullscreen) 4905 if (fullscreen && result_first_try)
4943#endif 4906#endif
4944 { 4907 {
4945 reshape(size.mX, size.mY); 4908 reshape(size.mX, size.mY);
@@ -5310,7 +5273,16 @@ void LLPickInfo::fetchResults()
5310 //{ 5273 //{
5311 // mPickType = PICK_PARCEL_WALL; 5274 // mPickType = PICK_PARCEL_WALL;
5312 //} 5275 //}
5313 if (objectp) 5276 if (hit_icon &&
5277 (!objectp ||
5278 icon_dist < (LLViewerCamera::getInstance()->getOrigin()-intersection).magVec()))
5279 {
5280 // was this name referring to a hud icon?
5281 mHUDIcon = hit_icon;
5282 mPickType = PICK_ICON;
5283 mPosGlobal = mHUDIcon->getPositionGlobal();
5284 }
5285 else if (objectp)
5314 { 5286 {
5315 if( objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH ) 5287 if( objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH )
5316 { 5288 {
@@ -5362,16 +5334,7 @@ void LLPickInfo::fetchResults()
5362 } 5334 }
5363 } 5335 }
5364 } 5336 }
5365 if (hit_icon && 5337
5366 (!objectp ||
5367 icon_dist < (LLViewerCamera::getInstance()->getOrigin()-intersection).magVec()))
5368 {
5369 // was this name referring to a hud icon?
5370 mHUDIcon = hit_icon;
5371 mPickType = PICK_ICON;
5372 mPosGlobal = mHUDIcon->getPositionGlobal();
5373 }
5374
5375 if (mPickCallback) 5338 if (mPickCallback)
5376 { 5339 {
5377 mPickCallback(*this); 5340 mPickCallback(*this);