diff options
author | Graham Linden <graham@lindenlab.com> | 2018-09-12 18:41:58 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-09-12 18:41:58 +0100 |
commit | 32a147369e0f4979136b8d2a3fc57154a01c6935 (patch) | |
tree | 248126bf90198125fa8db6f820ad868642f2991e /indra/llwindow/llwindowmacosx.cpp | |
parent | 1d2cbc2baad178bc896fd35d9ce2496574e988d9 (diff) | |
parent | 20a2019e4b5a3456d9d5b1ce647b5f459e6e29b1 (diff) |
Merge
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 843294c239..7f6b30bd37 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -845,7 +845,6 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) { - float rect[4]; S32 err = -1; if(mFullscreen) @@ -856,10 +855,10 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) } else if(mWindow) { - getContentViewBounds(mWindow, rect); + const CGSize & sz = getDeviceContentViewSize(mWindow, mGLView); - size->mX = rect[2]; - size->mY = rect[3]; + size->mX = sz.width; + size->mY = sz.height; } else { @@ -871,7 +870,6 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) { - float rect[4]; S32 err = -1; if(mFullscreen) @@ -882,10 +880,10 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) } else if(mWindow) { - getContentViewBounds(mWindow, rect); + const CGSize & sz = getDeviceContentViewSize(mWindow, mGLView); - size->mX = rect[2]; - size->mY = rect[3]; + size->mX = sz.width; + size->mY = sz.height; } else { @@ -1124,8 +1122,9 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) cursor_point[1] += mCursorLastEventDeltaY; } - position->mX = cursor_point[0]; - position->mY = cursor_point[1]; + float scale = getDeviceScaleFactor(); + position->mX = cursor_point[0] * scale; + position->mY = cursor_point[1] * scale; return TRUE; } @@ -1318,8 +1317,9 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) convertScreenToWindow(mWindow, mouse_point); - to->mX = mouse_point[0]; - to->mY = mouse_point[1]; + float scale_factor = getDeviceScaleFactor(); + to->mX = mouse_point[0] * scale_factor; + to->mY = mouse_point[1] * scale_factor; return TRUE; } @@ -1334,10 +1334,12 @@ 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]; - to->mY = mouse_point[1]; + float scale_factor = getDeviceScaleFactor(); + to->mX = mouse_point[0] / scale_factor; + to->mY = mouse_point[1] / scale_factor; return TRUE; } @@ -1891,6 +1893,11 @@ MASK LLWindowMacOSX::modifiersToMask(S16 modifiers) return mask; } +F32 LLWindowMacOSX::getDeviceScaleFactor() +{ + return ::getDeviceUnitSize(mGLView); +} + #if LL_OS_DRAGDROP_ENABLED /* S16 LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow, |