summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowmacosx.cpp
diff options
context:
space:
mode:
authorruslantproductengine <ruslantproductengine@lindenlab.com>2018-09-03 17:22:15 +0300
committerruslantproductengine <ruslantproductengine@lindenlab.com>2018-09-03 17:22:15 +0300
commit20a2019e4b5a3456d9d5b1ce647b5f459e6e29b1 (patch)
tree21aaa5b3a21f15bbbe00c01e2257ef9f3812e9b5 /indra/llwindow/llwindowmacosx.cpp
parenta50e4c3aeed7bcf0f75e26bc4f0671f9d7ff48cf (diff)
MAINT-9076 Improved support for Retina Displays
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp35
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,