diff options
| author | mobserveur <mobserveur@gmail.com> | 2026-08-16 11:11:58 +0200 |
|---|---|---|
| committer | mobserveur <mobserveur@gmail.com> | 2026-08-16 11:11:58 +0200 |
| commit | 214fa765986b4c1e1de1b917581f8508278abd8e (patch) | |
| tree | 62342c49b4c9927b72773f443c6e5270bd663ce0 | |
| parent | c711e99809d01f0e509f4ea0b4fbb3e5456e7536 (diff) | |
fix for the view scaling issue on mac
this commit is a fix for the scaling issue happening randomly on macs with a retina display.
| -rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 18 | ||||
| -rw-r--r-- | indra/llwindow/llwindowmacosx-objc.mm | 6 | ||||
| -rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 9 | ||||
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 9 |
4 files changed, 24 insertions, 18 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index bdb5d8def0..3030169d58 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -226,12 +226,12 @@ attributedStringInfo getSegments(NSAttributedString *str) - (id) init { - return [self initWithFrame:[self bounds] withSamples:2 andVsync:TRUE]; + return [self initWithFrame:[self bounds] withSamples:0 andVsync:FALSE]; } - (id) initWithSamples:(NSUInteger)samples { - return [self initWithFrame:[self bounds] withSamples:samples andVsync:TRUE]; + return [self initWithFrame:[self bounds] withSamples:samples andVsync:FALSE]; } - (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync @@ -247,8 +247,9 @@ attributedStringInfo getSegments(NSAttributedString *str) - (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync { - [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeURL]]; - [self initWithFrame:frame]; + NSRect fixedFrame = NSMakeRect(0, 0, NSWidth(frame), NSHeight(frame)); + [self initWithFrame:fixedFrame]; + [self setWantsBestResolutionOpenGLSurface:gHiDPISupport]; // Initialize with a default "safe" pixel format that will work with versions dating back to OS X 10.6. // Any specialized pixel formats, i.e. a core profile pixel format, should be initialized through rebuildContextWithFormat. @@ -260,7 +261,7 @@ attributedStringInfo getSegments(NSAttributedString *str) NSOpenGLPFAClosestPolicy, NSOpenGLPFAAccelerated, NSOpenGLPFADepthSize, 24, - NSOpenGLPFAColorSize, 32, + NSOpenGLPFAColorSize, 24, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core, 0 }; @@ -271,8 +272,8 @@ attributedStringInfo getSegments(NSAttributedString *str) NSOpenGLPFAClosestPolicy, NSOpenGLPFAAccelerated, NSOpenGLPFAColorFloat, - NSOpenGLPFAColorSize, 64, NSOpenGLPFADepthSize, 24, + NSOpenGLPFAColorSize, 48, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core, 0 }; @@ -327,9 +328,6 @@ attributedStringInfo getSegments(NSAttributedString *str) NSLog(@"Extended color space applied for HDR Display", nil); } - //for retina support - [self setWantsBestResolutionOpenGLSurface:gHiDPISupport]; - [self setOpenGLContext:glContext]; [glContext setView:self]; @@ -351,6 +349,8 @@ attributedStringInfo getSegments(NSAttributedString *str) GLint opacity = 1; [glContext setValues:&opacity forParameter:NSOpenGLCPSurfaceOpacity]; + [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeURL]]; + return self; } diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index d902a82a3c..85208a5ac3 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -223,8 +223,8 @@ OSErr setImageCursor(CursorRef ref) NSWindowRef createNSWindow(int x, int y, int width, int height) { LLNSWindow *window = [[LLNSWindow alloc]initWithContentRect:NSMakeRect(x, y, width, height) - styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable - backing:NSBackingStoreBuffered defer:NO]; + styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskFullSizeContentView + backing:NSBackingStoreBuffered defer:YES]; [window makeKeyAndOrderFront:nil]; [window setAcceptsMouseMovedEvents:TRUE]; [window setRestorable:FALSE]; // Viewer manages state from own settings @@ -347,7 +347,7 @@ void convertWindowToScreen(NSWindowRef window, float *coord) NSRect rect = NSMakeRect(coord[0], coord[1], 0, 0); rect = [(LLNSWindow*)window convertRectToScreen:rect]; - coord[0] = rect.origin.x; + coord[0] = rect.origin.x; coord[1] = [[NSScreen screens][0] frame].size.height - rect.origin.y; } diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 42250535f0..5a85887143 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -51,7 +51,7 @@ #include <IOKit/usb/IOUSBLib.h> extern bool gDebugWindowProc; -bool gHiDPISupport = true; +bool gHiDPISupport = false; bool gHDRDisplaySupport = false; const S32 BITS_PER_PIXEL = 32; @@ -761,7 +761,7 @@ bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits kCGLPFAMultisample, kCGLPFASampleBuffers, static_cast<CGLPixelFormatAttribute>((mFSAASamples > 0 ? 1 : 0)), kCGLPFASamples, static_cast<CGLPixelFormatAttribute>(mFSAASamples), - kCGLPFAStencilSize, static_cast<CGLPixelFormatAttribute>(8), + //kCGLPFAStencilSize, static_cast<CGLPixelFormatAttribute>(8), kCGLPFADepthSize, static_cast<CGLPixelFormatAttribute>(24), kCGLPFAAlphaSize, static_cast<CGLPixelFormatAttribute>(8), kCGLPFAColorSize, static_cast<CGLPixelFormatAttribute>(24), @@ -939,9 +939,10 @@ bool LLWindowMacOSX::getVisible() if(mFullscreen) { result = true; - }if (mWindow) + } + if (mWindow) { - result = true; + result = true; } return(result); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1d54ddcdae..1183cc70ef 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1881,8 +1881,8 @@ LLViewerWindow::LLViewerWindow(const Params& p) mToolStored( NULL ), mHideCursorPermanent( false ), mCursorHidden(false), - mResDirty(false), - mStatesDirty(false), + mResDirty(true), + mStatesDirty(true), mProgressView(NULL) { // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to @@ -6023,6 +6023,11 @@ void LLViewerWindow::checkSettings() // We want to update the resolution AFTER the states getting refreshed not before. if (mResDirty) { + LLCoordWindow size; + mWindow->getSize(&size); + mWindowRectRaw.set(0, size.mY, size.mX, 0); + mWindowRectScaled.set(0, ll_round((F32)size.mY / mDisplayScale.mV[VY]), ll_round((F32)size.mX / mDisplayScale.mV[VX]), 0); + reshape(getWindowWidthRaw(), getWindowHeightRaw()); mResDirty = false; } |
