diff options
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index d4afbb15df..fedea3de08 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; @@ -400,6 +401,14 @@ void callWindowUnhide() } } +void callWindowDidChangeScreen() +{ + if ( gWindowImplementation && gWindowImplementation->getCallbacks() ) + { + gWindowImplementation->getCallbacks()->handleWindowDidChangeScreen(gWindowImplementation); + } +} + void callDeltaUpdate(float *delta, MASK mask) { gWindowImplementation->updateMouseDeltas(delta); @@ -819,7 +828,6 @@ void LLWindowMacOSX::gatherInput() BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) { - float rect[4]; S32 err = -1; if(mFullscreen) @@ -830,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 { @@ -845,7 +855,6 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) { - float rect[4]; S32 err = -1; if(mFullscreen) @@ -856,10 +865,10 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) } else if(mWindow) { - getContentViewBounds(mWindow, rect); + const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow); - size->mX = rect[2]; - size->mY = rect[3]; + size->mX = sz.width; + size->mY = sz.height; } else { @@ -871,7 +880,6 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) { - float rect[4]; S32 err = -1; if(mFullscreen) @@ -882,10 +890,10 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) } else if(mWindow) { - getContentViewBounds(mWindow, rect); + const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow); - size->mX = rect[2]; - size->mY = rect[3]; + size->mX = sz.width; + size->mY = sz.height; } else { @@ -1094,6 +1102,9 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) // trigger mouse move callback LLCoordGL gl_pos; convertCoords(position, &gl_pos); + float scale = getSystemUISize(); + gl_pos.mX *= scale; + gl_pos.mY *= scale; mCallbacks->handleMouseMove(this, gl_pos, (MASK)0); return result; @@ -1124,8 +1135,9 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) cursor_point[1] += mCursorLastEventDeltaY; } - position->mX = cursor_point[0]; - position->mY = cursor_point[1]; + float scale = getSystemUISize(); + position->mX = cursor_point[0] * scale; + position->mY = cursor_point[1] * scale; return TRUE; } @@ -1334,6 +1346,7 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) mouse_point[0] = from.mX; mouse_point[1] = from.mY; + convertWindowToScreen(mWindow, mouse_point); to->mX = mouse_point[0]; @@ -1889,6 +1902,11 @@ MASK LLWindowMacOSX::modifiersToMask(S16 modifiers) return mask; } +F32 LLWindowMacOSX::getSystemUISize() +{ + return gHiDPISupport ? ::getDeviceUnitSize(mGLView) : LLWindow::getSystemUISize(); +} + #if LL_OS_DRAGDROP_ENABLED /* S16 LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow, |