diff options
author | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2018-11-26 18:02:44 +0200 |
---|---|---|
committer | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2018-11-26 18:02:44 +0200 |
commit | acc86a9139872e182fbeb5b9fc7daa12c5d2c029 (patch) | |
tree | 140e401c78b6c279b699e3e859f7b9d4bfe75873 /indra/llwindow | |
parent | 62085f9f7904aa20406aa4f0122065aec3a786ee (diff) |
SL-9766 [Render] [Mac] Alt + left mouse click has severely impaired functions
SL-10019 - [Mac] [Render] Right-click context menu immediately disappears when clicking any place in the ‘Inventory’ floater
SL-9984 - [Retina] Camera frustum, do not display correctly on "WORLD MAP" window.
SL-10027 - [Mac] [Render] Add toggle for Retina support to mitigate FPS loss
Re-FIX for Retina support.
Diffstat (limited to 'indra/llwindow')
-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 |
4 files changed, 30 insertions, 20 deletions
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 |