diff options
-rw-r--r-- | indra/llui/llmenugl.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lltooltip.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 16 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 16 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.h | 3 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.mm | 12 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 19 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llworldmapview.cpp | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml | 12 |
13 files changed, 83 insertions, 37 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 752d4a27e6..0d42f726fa 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3260,8 +3260,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) menu->arrangeAndClear(); LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); - F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor(); - LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x/dev_scale_factor, mouse_y/dev_scale_factor); + LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y); const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect(); diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 7f2224870d..698b128d45 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -489,10 +489,6 @@ void LLToolTipMgr::show(const LLToolTip::Params& params) return; } - S32 mouse_x; - S32 mouse_y; - LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y); - // are we ready to show the tooltip? if (!mToolTipsBlocked // we haven't hit a key, moved the mouse, etc. && LLUI::getMouseIdleTime() > params_with_defaults.delay_time) // the mouse has been still long enough @@ -574,12 +570,12 @@ void LLToolTipMgr::updateToolTipVisibility() } // hide existing tooltips if they have timed out - S32 mouse_x, mouse_y; - LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y); - F32 tooltip_timeout = 0.f; if (toolTipVisible()) { + S32 mouse_x, mouse_y; + LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y); + // mouse far away from tooltip tooltip_timeout = mLastToolTipParams.visible_time_far; // mouse near rect will only include the tooltip if the diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 2e9188a6a8..e9f8ba020e 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -236,11 +236,14 @@ void LLUI::dirtyRect(LLRect rect) //static void LLUI::setMousePositionScreen(S32 x, S32 y) { - F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor(); S32 screen_x, screen_y; - screen_x = ll_round(((F32)x * getScaleFactor().mV[VX]) / dev_scale_factor); - screen_y = ll_round(((F32)y * getScaleFactor().mV[VY]) / dev_scale_factor); - +#if defined(LL_DARWIN) + screen_x = ll_round((F32)x); + screen_y = ll_round((F32)y); +#else + screen_x = ll_round((F32)x * getScaleFactor().mV[VX]); + screen_y = ll_round((F32)y * getScaleFactor().mV[VY]); +#endif LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); } @@ -248,11 +251,10 @@ void LLUI::setMousePositionScreen(S32 x, S32 y) void LLUI::getMousePositionScreen(S32 *x, S32 *y) { LLCoordWindow cursor_pos_window; - F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor(); getWindow()->getCursorPosition(&cursor_pos_window); LLCoordGL cursor_pos_gl(cursor_pos_window.convert()); - *x = ll_round(((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]) * dev_scale_factor); - *y = ll_round(((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]) * dev_scale_factor); + *x = ll_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]); + *y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VY]); } //static diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index ee05fd5cc9..54a4793b2d 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -28,6 +28,8 @@ #import "llwindowmacosx-objc.h" #import "llappdelegate-objc.h" +extern BOOL gHiDPISupport; + #pragma mark local functions NativeKeyEventData extractKeyDataFromKeyEvent(NSEvent* theEvent) @@ -189,7 +191,7 @@ attributedStringInfo getSegments(NSAttributedString *str) { if (!mOldResize) //Maint-3288 { - NSSize dev_sz = [self convertSizeToBacking:[self frame].size]; + NSSize dev_sz = gHiDPISupport ? [self convertSizeToBacking:[self frame].size] : [self frame].size; callResize(dev_sz.width, dev_sz.height); } } @@ -276,7 +278,7 @@ attributedStringInfo getSegments(NSAttributedString *str) [self setPixelFormat:pixelFormat]; //for retina support - [self setWantsBestResolutionOpenGLSurface:YES]; + [self setWantsBestResolutionOpenGLSurface:gHiDPISupport]; [self setOpenGLContext:glContext]; @@ -369,7 +371,7 @@ attributedStringInfo getSegments(NSAttributedString *str) callRightMouseUp(mMousePos, [theEvent modifierFlags]); mSimulatedRightClick = false; } else { - NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; + NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; callLeftMouseUp(mMousePos, [theEvent modifierFlags]); @@ -388,7 +390,7 @@ attributedStringInfo getSegments(NSAttributedString *str) - (void)mouseMoved:(NSEvent *)theEvent { - NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])]; + NSPoint dev_delta = gHiDPISupport ? [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])] : NSMakePoint([theEvent deltaX], [theEvent deltaY]); float mouseDeltas[] = { float(dev_delta.x), @@ -397,7 +399,7 @@ attributedStringInfo getSegments(NSAttributedString *str) callDeltaUpdate(mouseDeltas, 0); - NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; + NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; callMouseMoved(mMousePos, 0); @@ -412,7 +414,7 @@ attributedStringInfo getSegments(NSAttributedString *str) // The old CoreGraphics APIs we previously relied on are now flagged as obsolete. // NSEvent isn't obsolete, and provides us with the correct deltas. - NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])]; + NSPoint dev_delta = gHiDPISupport ? [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])] : NSMakePoint([theEvent deltaX], [theEvent deltaY]); float mouseDeltas[] = { float(dev_delta.x), @@ -421,7 +423,7 @@ attributedStringInfo getSegments(NSAttributedString *str) callDeltaUpdate(mouseDeltas, 0); - NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; + NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; callMouseDragged(mMousePos, 0); diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 743089be6b..34da99de19 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -110,7 +110,8 @@ void glSwapBuffers(void* context); CGLContextObj getCGLContextObj(GLViewRef view); unsigned long getVramSize(GLViewRef view); float getDeviceUnitSize(GLViewRef view); -void getContentViewBounds(NSWindowRef window, float* bounds); +const CGPoint & getContentViewBoundsPosition(NSWindowRef window); +const CGSize & getContentViewBoundsSize(NSWindowRef window); const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view); void getWindowSize(NSWindowRef window, float* size); void setWindowSize(NSWindowRef window, int width, int height); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 489f92fa14..156d7965cd 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -258,12 +258,14 @@ float getDeviceUnitSize(GLViewRef view) return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width; } -void getContentViewBounds(NSWindowRef window, float* bounds) +const CGPoint & getContentViewBoundsPosition(NSWindowRef window) { - bounds[0] = [[(LLNSWindow*)window contentView] bounds].origin.x; - bounds[1] = [[(LLNSWindow*)window contentView] bounds].origin.y; - bounds[2] = [[(LLNSWindow*)window contentView] bounds].size.width; - bounds[3] = [[(LLNSWindow*)window contentView] bounds].size.height; + return [[(LLNSWindow*)window contentView] bounds].origin; +} + +const CGSize & getContentViewBoundsSize(NSWindowRef window) +{ + return [[(LLNSWindow*)window contentView] bounds].size; } const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view) diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 376b8610b5..20853eebd9 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -43,6 +43,7 @@ #include <CoreServices/CoreServices.h> extern BOOL gDebugWindowProc; +BOOL gHiDPISupport = TRUE; const S32 BITS_PER_PIXEL = 32; const S32 MAX_NUM_RESOLUTIONS = 32; @@ -827,7 +828,6 @@ void LLWindowMacOSX::gatherInput() BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) { - float rect[4]; S32 err = -1; if(mFullscreen) @@ -838,10 +838,12 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) } else if(mWindow) { - getContentViewBounds(mWindow, rect); + const CGPoint & pos = getContentViewBoundsPosition(mWindow); - position->mX = rect[0]; - position->mY = rect[1]; + position->mX = pos.x; + position->mY = pos.y; + + err = noErr; } else { @@ -863,7 +865,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) } else if(mWindow) { - const CGSize & sz = getDeviceContentViewSize(mWindow, mGLView); + const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow); size->mX = sz.width; size->mY = sz.height; @@ -888,7 +890,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) } else if(mWindow) { - const CGSize & sz = getDeviceContentViewSize(mWindow, mGLView); + const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow); size->mX = sz.width; size->mY = sz.height; @@ -1100,6 +1102,9 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) // trigger mouse move callback LLCoordGL gl_pos; convertCoords(position, &gl_pos); + float scale = getDeviceScaleFactor(); + gl_pos.mX *= scale; + gl_pos.mY *= scale; mCallbacks->handleMouseMove(this, gl_pos, (MASK)0); return result; @@ -1901,7 +1906,7 @@ MASK LLWindowMacOSX::modifiersToMask(S16 modifiers) F32 LLWindowMacOSX::getDeviceScaleFactor() { - return ::getDeviceUnitSize(mGLView); + return gHiDPISupport ? ::getDeviceUnitSize(mGLView) : LLWindow::getDeviceScaleFactor(); } #if LL_OS_DRAGDROP_ENABLED diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3ad8b6cded..688bcb8298 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8716,6 +8716,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderHiDPI</key> + <map> + <key>Comment</key> + <string>Enable support for HiDPI displays, like Retina (MacOS X ONLY, requires restart)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>RenderPerformanceTest</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 78b8a6973c..c610037df9 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -276,6 +276,10 @@ extern BOOL gRandomizeFramerate; extern BOOL gPeriodicSlowFrame; extern BOOL gDebugGL; +#if LL_DARWIN +extern BOOL gHiDPISupport; +#endif + //////////////////////////////////////////////////////////// // All from the last globals push... @@ -589,6 +593,10 @@ static void settings_to_globals() gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates"); LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale"); + +#if LL_DARWIN + gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI"); +#endif } static void settings_modify() diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7aff9fb586..7f700b76cc 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2754,6 +2754,9 @@ BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() combo->remove("8x"); combo->remove("16x"); } + + LLCheckBoxCtrl *use_HiDPI = getChild<LLCheckBoxCtrl>("use HiDPI"); + use_HiDPI->setVisible(FALSE); #endif return TRUE; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7a8d4e11a6..413fa59879 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3038,7 +3038,7 @@ void LLViewerWindow::moveCursorToCenter() //on a forced move, all deltas get zeroed out to prevent jumping mCurrentMousePoint.set(x,y); mLastMousePoint.set(x,y); - mCurrentMouseDelta.set(0,0); + mCurrentMouseDelta.set(0,0); } } diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index ca57f4fb97..f2e139dcca 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -884,8 +884,13 @@ void LLWorldMapView::drawFrustum() // Compute the frustum coordinates. Take the UI scale into account. F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor"); +#if defined(LL_DARWIN) F32 ctr_x = ((getLocalRect().getWidth() * 0.5f + sPanX) * ui_scale_factor) * LLUI::getScaleFactor().mV[VX]; F32 ctr_y = ((getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor) * LLUI::getScaleFactor().mV[VY]; +#else + F32 ctr_x = ((getLocalRect().getWidth() * 0.5f + sPanX) * ui_scale_factor); + F32 ctr_y = ((getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor); +#endif gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index c2500951a6..bec484a5ea 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -357,6 +357,18 @@ tool_tip="Compresses textures in video memory, allowing for higher resolution textures to be loaded at the cost of some color quality." width="315" /> + <check_box + control_name="RenderHiDPI" + height="16" + initial_value="true" + label="Enable support for HiDPI displays (requires restart)" + layout="topleft" + left="30" + top_delta="16" + name="use HiDPI" + tool_tip="Enable OpenGL for High-Resolution Drawing." + width="315" /> + <text type="string" length="1" |