From 4bd98dbbe5db0012fbe00ea68d27e578b4302765 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Tue, 10 Nov 2020 21:41:34 -0500 Subject: [PATCH] Revert to alchemy non-deprecated actually-sane hidpi support for macos --- indra/llplugin/llpluginclassmedia.cpp | 6 -- indra/llui/llui.cpp | 5 - indra/llwindow/llopenglview-objc.h | 13 --- indra/llwindow/llopenglview-objc.mm | 150 ++++++++------------------ indra/llwindow/llwindowmacosx-objc.h | 8 +- indra/llwindow/llwindowmacosx-objc.mm | 60 ++++------- indra/llwindow/llwindowmacosx.cpp | 46 ++++---- indra/newview/llappviewer.cpp | 10 +- 8 files changed, 94 insertions(+), 204 deletions(-) diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index e180f3f272b..1baff71fbdc 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -34,9 +34,6 @@ #include "llcontrol.h" extern LLControlGroup gSavedSettings; -#if LL_DARWIN -extern BOOL gHiDPISupport; -#endif static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256; @@ -368,9 +365,6 @@ void LLPluginClassMedia::setSizeInternal(void) mRequestedMediaHeight = nextPowerOf2(mRequestedMediaHeight); } -#if LL_DARWIN - if (!gHiDPISupport) -#endif { if (mRequestedMediaWidth > 8192) mRequestedMediaWidth = 8192; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index b6c65889b48..840331b770c 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -222,13 +222,8 @@ void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& rem // static void LLUI::setMousePositionScreen(S32 x, S32 y) { -#if defined(LL_DARWIN) - S32 screen_x = ll_round(((F32)x * getScaleFactor().mV[VX]) / LLView::getWindow()->getSystemUISize()); - S32 screen_y = ll_round(((F32)y * getScaleFactor().mV[VY]) / LLView::getWindow()->getSystemUISize()); -#else S32 screen_x = ll_round((F32)x * getScaleFactor().mV[VX]); S32 screen_y = ll_round((F32)y * getScaleFactor().mV[VY]); -#endif getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); } diff --git a/indra/llwindow/llopenglview-objc.h b/indra/llwindow/llopenglview-objc.h index 076f5e96903..8664a5c105b 100644 --- a/indra/llwindow/llopenglview-objc.h +++ b/indra/llwindow/llopenglview-objc.h @@ -84,9 +84,6 @@ @interface LLNSWindow : NSWindow -- (NSPoint)convertToScreenFromLocalPoint:(NSPoint)point relativeToView:(NSView *)view; -- (NSPoint)flipPoint:(NSPoint)aPoint; - @end @interface NSScreen (PointConversion) @@ -96,16 +93,6 @@ */ + (NSScreen *)currentScreenForMouseLocation; -/* - Allows you to convert a point from global coordinates to the current screen coordinates. - */ -- (NSPoint)convertPointToScreenCoordinates:(NSPoint)aPoint; - -/* - Allows to flip the point coordinates, so y is 0 at the top instead of the bottom. x remains the same - */ -- (NSPoint)flipPoint:(NSPoint)aPoint; - @end #endif diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index fec3c0855bd..abddf8f7ceb 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -28,8 +28,6 @@ #import "llwindowmacosx-objc.h" #import "llappdelegate-objc.h" -extern BOOL gHiDPISupport; - #pragma mark local functions NativeKeyEventData extractKeyDataFromKeyEvent(NSEvent* theEvent) @@ -104,21 +102,6 @@ attributedStringInfo getSegments(NSAttributedString *str) return screen; } - - -- (NSPoint)convertPointToScreenCoordinates:(NSPoint)aPoint -{ - float normalizedX = fabs(fabs(self.frame.origin.x) - fabs(aPoint.x)); - float normalizedY = aPoint.y - self.frame.origin.y; - - return NSMakePoint(normalizedX, normalizedY); -} - -- (NSPoint)flipPoint:(NSPoint)aPoint -{ - return NSMakePoint(aPoint.x, self.frame.size.height - aPoint.y); -} - @end @implementation LLOpenGLView @@ -144,38 +127,38 @@ attributedStringInfo getSegments(NSAttributedString *str) - (void)viewDidMoveToWindow { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowResized:) name:NSWindowDidResizeNotification - object:[self window]]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(windowResized:) name:NSWindowDidResizeNotification + object:[self window]]; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowWillMiniaturize:) name:NSWindowWillMiniaturizeNotification - object:[self window]]; + selector:@selector(windowWillMiniaturize:) name:NSWindowWillMiniaturizeNotification + object:[self window]]; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification - object:[self window]]; + selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification + object:[self window]]; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification - object:[self window]]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification - object:[self window]]; - - - NSRect wnd_rect = [[self window] frame]; - NSRect dev_rect = [self convertRectToBacking:wnd_rect]; - if (!NSEqualSizes(wnd_rect.size,dev_rect.size)) + selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification + object:[self window]]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification + object:[self window]]; + + NSRect rect = [[self window] frame]; + NSRect scaled_rect = [self convertRectToBacking:rect]; + if (NSEqualSizes(rect.size, scaled_rect.size)) { - callResize(dev_rect.size.width, dev_rect.size.height); + callResize(scaled_rect.size.width, scaled_rect.size.height); } } - (void)windowResized:(NSNotification *)notification; { - NSSize dev_sz = gHiDPISupport ? [self convertSizeToBacking:[self frame].size] : [self frame].size; - callResize(dev_sz.width, dev_sz.height); + NSSize size = [self frame].size; + NSSize scaled_size = [self convertSizeToBacking:size]; + callResize(scaled_size.width, scaled_size.height); } - (void)windowWillMiniaturize:(NSNotification *)notification; @@ -256,11 +239,11 @@ attributedStringInfo getSegments(NSAttributedString *str) NSLog(@"Failed to create OpenGL context!", nil); return nil; } - - [self setPixelFormat:pixelFormat]; //for retina support - [self setWantsBestResolutionOpenGLSurface:gHiDPISupport]; + [self setWantsBestResolutionOpenGLSurface:YES]; + + [self setPixelFormat:pixelFormat]; [self setOpenGLContext:glContext]; @@ -268,16 +251,9 @@ attributedStringInfo getSegments(NSAttributedString *str) [glContext makeCurrentContext]; - if (vsync) - { - [glContext setValues:(const GLint*)1 forParameter:NSOpenGLCPSwapInterval]; - } else { - // supress this error after move to Xcode 7: - // error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull] - // Tried using ObjC 'nonnull' keyword as per SO article but didn't build - GLint swapInterval=0; - [glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; - } + GLint glVsync = vsync ? 1 : 0; + [glContext setValues:&glVsync forParameter:NSOpenGLCPSwapInterval]; + return self; } @@ -323,10 +299,6 @@ attributedStringInfo getSegments(NSAttributedString *str) - (void) mouseDown:(NSEvent *)theEvent { - NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; - mMousePos[0] = mPoint.x; - mMousePos[1] = mPoint.y; - // Apparently people still use this? if ([theEvent modifierFlags] & NSEventModifierFlagCommand && !([theEvent modifierFlags] & NSEventModifierFlagControl) && @@ -355,7 +327,7 @@ attributedStringInfo getSegments(NSAttributedString *str) callRightMouseUp(mMousePos, [theEvent modifierFlags]); mSimulatedRightClick = false; } else { - NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; + NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; callLeftMouseUp(mMousePos, [theEvent modifierFlags]); @@ -364,32 +336,28 @@ 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]); } - (void)mouseMoved:(NSEvent *)theEvent { - NSPoint dev_delta = gHiDPISupport ? [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])] : NSMakePoint([theEvent deltaX], [theEvent deltaY]); + // We need a point to be able to convert these. + NSPoint delta = NSMakePoint([theEvent deltaX], [theEvent deltaY]); + NSPoint scaled_delta = [self convertPointToBacking:delta]; float mouseDeltas[] = { - float(dev_delta.x), - float(dev_delta.y) + float(scaled_delta.x), + float(scaled_delta.y) }; - + callDeltaUpdate(mouseDeltas, 0); - - NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; + + NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; callMouseMoved(mMousePos, 0); @@ -403,35 +371,30 @@ attributedStringInfo getSegments(NSAttributedString *str) // Trust the deltas supplied by NSEvent. // 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 = gHiDPISupport ? [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])] : NSMakePoint([theEvent deltaX], [theEvent deltaY]); - + // We need a point to be able to convert these. + NSPoint delta = NSMakePoint([theEvent deltaX], [theEvent deltaY]); + NSPoint scaled_delta = [self convertPointToBacking:delta]; + float mouseDeltas[] = { - float(dev_delta.x), - float(dev_delta.y) + float(scaled_delta.x), + float(scaled_delta.y) }; callDeltaUpdate(mouseDeltas, 0); - NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; + NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; - callMouseDragged(mMousePos, 0); + callMouseMoved(mMousePos, 0); } - (void) otherMouseDown:(NSEvent *)theEvent { - NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; - mMousePos[0] = mPoint.x; - mMousePos[1] = mPoint.y; callOtherMouseDown(mMousePos, [theEvent modifierFlags], [theEvent buttonNumber]); } - (void) otherMouseUp:(NSEvent *)theEvent { - NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; - mMousePos[0] = mPoint.x; - mMousePos[1] = mPoint.y; callOtherMouseUp(mMousePos, [theEvent modifierFlags], [theEvent buttonNumber]); } @@ -534,7 +497,7 @@ attributedStringInfo getSegments(NSAttributedString *str) - (NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender { NSPasteboard *pboard; - NSDragOperation sourceDragMask; + NSDragOperation sourceDragMask; sourceDragMask = [sender draggingSourceOperationMask]; @@ -545,8 +508,8 @@ attributedStringInfo getSegments(NSAttributedString *str) if (sourceDragMask & NSDragOperationLink) { NSURL *fileUrl = [[pboard readObjectsForClasses:[NSArray arrayWithObject:[NSURL class]] options:[NSDictionary dictionary]] objectAtIndex:0]; mLastDraggedUrl = [[fileUrl absoluteString] UTF8String]; - return NSDragOperationLink; - } + return NSDragOperationLink; + } } return NSDragOperationNone; } @@ -833,27 +796,6 @@ attributedStringInfo getSegments(NSAttributedString *str) return self; } -- (NSPoint)convertToScreenFromLocalPoint:(NSPoint)point relativeToView:(NSView *)view -{ - NSScreen *currentScreen = [NSScreen currentScreenForMouseLocation]; - if(currentScreen) - { - NSPoint windowPoint = [view convertPoint:point toView:nil]; - NSPoint screenPoint = [[view window] convertBaseToScreen:windowPoint]; - NSPoint flippedScreenPoint = [currentScreen flipPoint:screenPoint]; - flippedScreenPoint.y += [currentScreen frame].origin.y; - - return flippedScreenPoint; - } - - return NSZeroPoint; -} - -- (NSPoint)flipPoint:(NSPoint)aPoint -{ - return NSMakePoint(aPoint.x, self.frame.size.height - aPoint.y); -} - - (BOOL) becomeFirstResponder { callFocus(); diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 9d06d9e6815..8fd45408889 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -31,7 +31,7 @@ #include <map> #include <vector> -//fir CGSize +//for CGSize #include <CoreGraphics/CGGeometry.h> typedef std::vector<std::pair<int, bool> > segment_t; @@ -108,16 +108,14 @@ void glSwapBuffers(void* context); CGLContextObj getCGLContextObj(GLViewRef view); unsigned long getVramSize(GLViewRef view); float getDeviceUnitSize(GLViewRef view); -CGPoint getContentViewBoundsPosition(NSWindowRef window); -CGSize getContentViewBoundsSize(NSWindowRef window); -CGSize getDeviceContentViewSize(NSWindowRef window, GLViewRef view); +void getContentViewBounds(NSWindowRef window, float* bounds); +void getScaledContentViewBounds(NSWindowRef window, GLViewRef view, float* bounds); void getWindowSize(NSWindowRef window, float* size); void setWindowSize(NSWindowRef window, int width, int height); void getCursorPos(NSWindowRef window, float* pos); void makeWindowOrderFront(NSWindowRef window); void convertScreenToWindow(NSWindowRef window, float *coord); void convertWindowToScreen(NSWindowRef window, float *coord); -void convertScreenToView(NSWindowRef window, float *coord); void convertRectToScreen(NSWindowRef window, float *coord); void convertRectFromScreen(NSWindowRef window, float *coord); void setWindowPos(NSWindowRef window, float* pos); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 995f42b2629..1cdf8800a6c 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -248,19 +248,21 @@ float getDeviceUnitSize(GLViewRef view) return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width; } -CGPoint getContentViewBoundsPosition(NSWindowRef window) +void getContentViewBounds(NSWindowRef window, float* bounds) { - return [[(LLNSWindow*)window contentView] bounds].origin; + 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; } -CGSize getContentViewBoundsSize(NSWindowRef window) +void getScaledContentViewBounds(NSWindowRef window, GLViewRef view, float* bounds) { - return [[(LLNSWindow*)window contentView] bounds].size; -} - -CGSize getDeviceContentViewSize(NSWindowRef window, GLViewRef view) -{ - return [(NSOpenGLView*)view convertRectToBacking:[[(LLNSWindow*)window contentView] bounds]].size; + NSRect b = [(NSOpenGLView*)view convertRectToBacking:[[(LLNSWindow*)window contentView] bounds]]; + bounds[0] = b.origin.x; + bounds[1] = b.origin.y; + bounds[2] = b.size.width; + bounds[3] = b.size.height; } void getWindowSize(NSWindowRef window, float* size) @@ -303,9 +305,7 @@ void makeWindowOrderFront(NSWindowRef window) void convertScreenToWindow(NSWindowRef window, float *coord) { - NSRect point; - point.origin.x = coord[0]; - point.origin.y = coord[1]; + NSRect point = NSMakeRect(coord[0], coord[1], 0, 0); point = [(LLNSWindow*)window convertRectFromScreen:point]; coord[0] = point.origin.x; coord[1] = point.origin.y; @@ -313,12 +313,7 @@ void convertScreenToWindow(NSWindowRef window, float *coord) void convertRectToScreen(NSWindowRef window, float *coord) { - NSRect point; - point.origin.x = coord[0]; - point.origin.y = coord[1]; - point.size.width = coord[2]; - point.size.height = coord[3]; - + NSRect point = NSMakeRect(coord[0], coord[1], coord[2], coord[3]); point = [(LLNSWindow*)window convertRectToScreen:point]; coord[0] = point.origin.x; @@ -329,12 +324,7 @@ void convertRectToScreen(NSWindowRef window, float *coord) void convertRectFromScreen(NSWindowRef window, float *coord) { - NSRect point; - point.origin.x = coord[0]; - point.origin.y = coord[1]; - point.size.width = coord[2]; - point.size.height = coord[3]; - + NSRect point = NSMakeRect(coord[0], coord[1], coord[2], coord[3]); point = [(LLNSWindow*)window convertRectFromScreen:point]; coord[0] = point.origin.x; @@ -343,23 +333,15 @@ void convertRectFromScreen(NSWindowRef window, float *coord) coord[3] = point.size.height; } -void convertScreenToView(NSWindowRef window, float *coord) -{ - NSRect point; - point.origin.x = coord[0]; - point.origin.y = coord[1]; - point.origin = [(LLNSWindow*)window convertScreenToBase:point.origin]; - point.origin = [[(LLNSWindow*)window contentView] convertPoint:point.origin fromView:nil]; -} - void convertWindowToScreen(NSWindowRef window, float *coord) { - NSPoint point; - point.x = coord[0]; - point.y = coord[1]; - point = [(LLNSWindow*)window convertToScreenFromLocalPoint:point relativeToView:[(LLNSWindow*)window contentView]]; - coord[0] = point.x; - coord[1] = point.y; + LLNSWindow *nsWindow = (LLNSWindow*)window; + NSRect rect = NSMakeRect(coord[0], coord[1], 0, 0); + rect = [nsWindow convertRectToScreen:rect]; + NSRect screenRect = [[nsWindow screen] frame]; + NSPoint retPoint = NSMakePoint(rect.origin.x, screenRect.origin.y + screenRect.size.height - rect.origin.y); + coord[0] = retPoint.x; + coord[1] = retPoint.y; } void closeWindow(NSWindowRef window) diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 79c67ffccdc..0d6884c3c6f 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -42,7 +42,6 @@ #include <CoreServices/CoreServices.h> extern BOOL gDebugWindowProc; -BOOL gHiDPISupport = TRUE; const S32 BITS_PER_PIXEL = 32; const S32 MAX_NUM_RESOLUTIONS = 32; @@ -641,7 +640,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits { - U32 err = CGLSetCurrentContext(mContext); + CGLError err = CGLSetCurrentContext(mContext); if (err != kCGLNoError) { setupFailure("Can't activate GL rendering context", "Error", OSMB_OK); @@ -808,7 +807,8 @@ BOOL LLWindowMacOSX::getVisible() if(mFullscreen) { result = TRUE; - }if (mWindow) + } + if (mWindow) { result = TRUE; } @@ -857,10 +857,11 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) } else if(mWindow) { - const CGPoint & pos = getContentViewBoundsPosition(mWindow); + float rect[4]; + getContentViewBounds(mWindow, rect); - position->mX = pos.x; - position->mY = pos.y; + position->mX = rect[0]; + position->mY = rect[1]; err = noErr; } @@ -884,10 +885,11 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) } else if(mWindow) { - const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow); + float rect[4]; + getScaledContentViewBounds(mWindow, mGLView, rect); - size->mX = sz.width; - size->mY = sz.height; + size->mX = rect[2]; + size->mY = rect[3]; err = noErr; } else @@ -900,6 +902,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) { + float rect[4]; S32 err = -1; if(mFullscreen) @@ -910,13 +913,11 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) } else if(mWindow) { - const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow); + getScaledContentViewBounds(mWindow, mGLView, rect); - size->mX = sz.width; - size->mY = sz.height; - err = noErr; - - + size->mX = rect[2]; + size->mY = rect[3]; + err = noErr; } else { @@ -1352,14 +1353,14 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) if(mWindow) { float mouse_point[2]; - + float scale_factor = getSystemUISize(); mouse_point[0] = from.mX; mouse_point[1] = from.mY; convertScreenToWindow(mWindow, mouse_point); - to->mX = mouse_point[0]; - to->mY = mouse_point[1]; + to->mX = mouse_point[0] * scale_factor; + to->mY = mouse_point[1] * scale_factor; return TRUE; } @@ -1371,10 +1372,9 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) if(mWindow) { float mouse_point[2]; - - mouse_point[0] = from.mX; - mouse_point[1] = from.mY; - + float scale_factor = getSystemUISize(); + mouse_point[0] = from.mX / scale_factor; + mouse_point[1] = from.mY / scale_factor; convertWindowToScreen(mWindow, mouse_point); to->mX = mouse_point[0]; @@ -1898,7 +1898,7 @@ MASK LLWindowMacOSX::modifiersToMask(S16 modifiers) F32 LLWindowMacOSX::getSystemUISize() { - return gHiDPISupport ? ::getDeviceUnitSize(mGLView) : LLWindow::getSystemUISize(); + return ::getDeviceUnitSize(mGLView); } #if LL_OS_DRAGDROP_ENABLED diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 026851fc417..f1b7e7b0216 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -286,10 +286,6 @@ extern BOOL gRandomizeFramerate; extern BOOL gPeriodicSlowFrame; extern BOOL gDebugGL; -#if LL_DARWIN -extern BOOL gHiDPISupport; -#endif - //////////////////////////////////////////////////////////// // All from the last globals push... @@ -611,10 +607,6 @@ static void settings_to_globals() gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates"); LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale"); - -#if LL_DARWIN - gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI"); -#endif } static void settings_modify() @@ -3205,7 +3197,7 @@ LLSD LLAppViewer::getViewerInfo() const info["VFS_TIME"] = LLTrans::getString("AboutTime", substitution); #if LL_DARWIN - info["HIDPI"] = gHiDPISupport; + info["HIDPI"] = TRUE; #endif // Libraries -- GitLab