summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2019-04-15 20:26:13 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2019-04-15 20:26:13 +0300
commitdb6d4a3cb45e65d06f2e2dca54b5352694cd0a16 (patch)
tree5c4b5953ac4710feab055d3c9666ab2b90fdedcc /indra/llwindow
parent6b2a1762e101b591cb0da619c7dfb709661212b0 (diff)
SL-10888 Fixed OSX mouse issues in HiDPI mode
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llopenglview-objc.mm14
-rw-r--r--indra/llwindow/llwindowmacosx-objc.h6
-rw-r--r--indra/llwindow/llwindowmacosx-objc.mm6
-rw-r--r--indra/llwindow/llwindowmacosx.cpp8
4 files changed, 25 insertions, 9 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index 65c0a53a96..33eed7227a 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -343,7 +343,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) mouseDown:(NSEvent *)theEvent
{
- NSPoint mPoint = [theEvent locationInWindow];
+ NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y;
@@ -384,11 +384,17 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) rightMouseDown:(NSEvent *)theEvent
{
+ NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
+ mMousePos[0] = mPoint.x;
+ mMousePos[1] = mPoint.y;
callRightMouseDown(mMousePos, [theEvent modifierFlags]);
}
- (void) rightMouseUp:(NSEvent *)theEvent
{
+ NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
+ mMousePos[0] = mPoint.x;
+ mMousePos[1] = mPoint.y;
callRightMouseUp(mMousePos, [theEvent modifierFlags]);
}
@@ -435,11 +441,17 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) otherMouseDown:(NSEvent *)theEvent
{
+ NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
+ mMousePos[0] = mPoint.x;
+ mMousePos[1] = mPoint.y;
callMiddleMouseDown(mMousePos, [theEvent modifierFlags]);
}
- (void) otherMouseUp:(NSEvent *)theEvent
{
+ NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
+ mMousePos[0] = mPoint.x;
+ mMousePos[1] = mPoint.y;
callMiddleMouseUp(mMousePos, [theEvent modifierFlags]);
}
diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h
index 34da99de19..10bd3cbb91 100644
--- a/indra/llwindow/llwindowmacosx-objc.h
+++ b/indra/llwindow/llwindowmacosx-objc.h
@@ -110,9 +110,9 @@ void glSwapBuffers(void* context);
CGLContextObj getCGLContextObj(GLViewRef view);
unsigned long getVramSize(GLViewRef view);
float getDeviceUnitSize(GLViewRef view);
-const CGPoint & getContentViewBoundsPosition(NSWindowRef window);
-const CGSize & getContentViewBoundsSize(NSWindowRef window);
-const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view);
+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);
void getCursorPos(NSWindowRef window, float* pos);
diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm
index c3eb9b8c8a..8fece7c5c7 100644
--- a/indra/llwindow/llwindowmacosx-objc.mm
+++ b/indra/llwindow/llwindowmacosx-objc.mm
@@ -258,17 +258,17 @@ float getDeviceUnitSize(GLViewRef view)
return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width;
}
-const CGPoint & getContentViewBoundsPosition(NSWindowRef window)
+const CGPoint getContentViewBoundsPosition(NSWindowRef window)
{
return [[(LLNSWindow*)window contentView] bounds].origin;
}
-const CGSize & getContentViewBoundsSize(NSWindowRef window)
+const CGSize getContentViewBoundsSize(NSWindowRef window)
{
return [[(LLNSWindow*)window contentView] bounds].size;
}
-const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view)
+const CGSize getDeviceContentViewSize(NSWindowRef window, GLViewRef view)
{
return [(NSOpenGLView*)view convertRectToBacking:[[(LLNSWindow*)window contentView] bounds]].size;
}
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index fedea3de08..6dec131a34 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -869,10 +869,11 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size)
size->mX = sz.width;
size->mY = sz.height;
+ err = noErr;
}
else
{
- LL_ERRS() << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << LL_ENDL;
+ LL_ERRS() << "LLWindowMacOSX::getSize(): no window and not fullscreen!" << LL_ENDL;
}
return (err == noErr);
@@ -894,10 +895,13 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size)
size->mX = sz.width;
size->mY = sz.height;
+ err = noErr;
+
+
}
else
{
- LL_ERRS() << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << LL_ENDL;
+ LL_ERRS() << "LLWindowMacOSX::getSize(): no window and not fullscreen!" << LL_ENDL;
}
return (err == noErr);