From cd3608e661c3e2cab0fab25e11647ae8ee8285bd Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 16 Nov 2018 15:53:52 +0200 Subject: SL-10023 FIXED Dragging mouse on World map sometimes causes cursor jump to the center of the screen --- indra/llwindow/llopenglview-objc.mm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index c8c086d705..8923ea6458 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -322,6 +322,10 @@ attributedStringInfo getSegments(NSAttributedString *str) - (void) mouseDown:(NSEvent *)theEvent { + NSPoint mPoint = [theEvent locationInWindow]; + mMousePos[0] = mPoint.x; + mMousePos[1] = mPoint.y; + // Apparently people still use this? if ([theEvent modifierFlags] & NSCommandKeyMask && !([theEvent modifierFlags] & NSControlKeyMask) && -- cgit v1.2.3 From ec9a70de94a3123142de1a1765968185846a8e17 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 21 Mar 2019 18:58:11 +0200 Subject: SL-10648 Handling for Window crash on exit --- indra/llwindow/llwindowwin32.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 504c1589b0..a24f168ab1 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -738,6 +738,17 @@ void LLWindowWin32::restore() SetFocus(mWindowHandle); } +bool destroy_window_handler(HWND &hWnd) +{ + __try + { + return DestroyWindow(hWnd); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + return false; + } +} // close() destroys all OS-specific code associated with a window. // Usually called from LLWindowManager::destroyWindow() @@ -811,7 +822,7 @@ void LLWindowWin32::close() ShowWindow(mWindowHandle, SW_HIDE); // This causes WM_DESTROY to be sent *immediately* - if (!DestroyWindow(mWindowHandle)) + if (!destroy_window_handler(mWindowHandle)) { OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"), mCallbacks->translateString("MBShutdownErr"), -- cgit v1.2.3 From 468fbd6b515cf321834e0056adde9b29e07ccffc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 25 Apr 2019 15:11:55 -0400 Subject: Return CGPoint and CGSize by value, not const ref to temporary. --- indra/llwindow/llwindowmacosx-objc.h | 6 +++--- indra/llwindow/llwindowmacosx-objc.mm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 34da99de19..99af161102 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); +CGPoint getContentViewBoundsPosition(NSWindowRef window); +CGSize getContentViewBoundsSize(NSWindowRef window); +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..f895c17643 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) +CGPoint getContentViewBoundsPosition(NSWindowRef window) { return [[(LLNSWindow*)window contentView] bounds].origin; } -const CGSize & getContentViewBoundsSize(NSWindowRef window) +CGSize getContentViewBoundsSize(NSWindowRef window) { return [[(LLNSWindow*)window contentView] bounds].size; } -const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view) +CGSize getDeviceContentViewSize(NSWindowRef window, GLViewRef view) { return [(NSOpenGLView*)view convertRectToBacking:[[(LLNSWindow*)window contentView] bounds]].size; } -- cgit v1.2.3 From 6308743fd2c9fde30277c7c63aeeacd8facd9419 Mon Sep 17 00:00:00 2001 From: Drake Arconis Date: Fri, 8 Feb 2019 19:26:28 -0800 Subject: Fix issue where gamma was being corrupted on windows with night light enabled --- indra/llwindow/llwindowwin32.cpp | 24 ++++++++++++++++++++---- indra/llwindow/llwindowwin32.h | 5 +++-- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 504c1589b0..27787a51a8 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -425,6 +425,9 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mKeyVirtualKey = 0; mhDC = NULL; mhRC = NULL; + memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp)); + memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp)); + mCustomGammaSet = FALSE; if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0)) { @@ -2989,13 +2992,26 @@ F32 LLWindowWin32::getGamma() BOOL LLWindowWin32::restoreGamma() { - return SetDeviceGammaRamp(mhDC, mPrevGammaRamp); + if (mCustomGammaSet != FALSE) + { + mCustomGammaSet = FALSE; + return SetDeviceGammaRamp(mhDC, mPrevGammaRamp); + } + return TRUE; } BOOL LLWindowWin32::setGamma(const F32 gamma) { mCurrentGamma = gamma; + //Get the previous gamma ramp to restore later. + if (mCustomGammaSet == FALSE) + { + if (GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE) + return FALSE; + mCustomGammaSet = TRUE; + } + LL_DEBUGS("Window") << "Setting gamma to " << gamma << LL_ENDL; for ( int i = 0; i < 256; ++i ) @@ -3007,9 +3023,9 @@ BOOL LLWindowWin32::setGamma(const F32 gamma) if ( value > 0xffff ) value = 0xffff; - mCurrentGammaRamp [ 0 * 256 + i ] = - mCurrentGammaRamp [ 1 * 256 + i ] = - mCurrentGammaRamp [ 2 * 256 + i ] = ( WORD )value; + mCurrentGammaRamp[0][i] = + mCurrentGammaRamp[1][i] = + mCurrentGammaRamp[2][i] = (WORD) value; }; return SetDeviceGammaRamp ( mhDC, mCurrentGammaRamp ); diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index d72623a6f4..9cd16eb993 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -184,8 +184,9 @@ protected: F32 mCurrentGamma; U32 mFSAASamples; - WORD mPrevGammaRamp[256*3]; - WORD mCurrentGammaRamp[256*3]; + WORD mPrevGammaRamp[3][256]; + WORD mCurrentGammaRamp[3][256]; + BOOL mCustomGammaSet; LPWSTR mIconResource; BOOL mMousePositionModified; -- cgit v1.2.3 From 19cae5d2ccbefee3741a80b8bc8e486dccf26873 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 8 Apr 2019 18:53:47 +0300 Subject: SL-10907 getWidthF32 crash in fonts --- indra/llwindow/llwindowwin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 504c1589b0..20bf007b09 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4012,7 +4012,7 @@ void LLWindowWin32::setDPIAwareness() F32 LLWindowWin32::getSystemUISize() { - float scale_value = 0; + F32 scale_value = 1.f; HWND hWnd = (HWND)getPlatformWindow(); HDC hdc = GetDC(hWnd); HMONITOR hMonitor; -- cgit v1.2.3 From db6d4a3cb45e65d06f2e2dca54b5352694cd0a16 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Mon, 15 Apr 2019 20:26:13 +0300 Subject: SL-10888 Fixed OSX mouse issues in HiDPI mode --- indra/llwindow/llopenglview-objc.mm | 14 +++++++++++++- indra/llwindow/llwindowmacosx-objc.h | 6 +++--- indra/llwindow/llwindowmacosx-objc.mm | 6 +++--- indra/llwindow/llwindowmacosx.cpp | 8 ++++++-- 4 files changed, 25 insertions(+), 9 deletions(-) (limited to 'indra/llwindow') 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); -- cgit v1.2.3 From 77ba332880819112b49395f85eff7e575a12e3ec Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Thu, 16 May 2019 12:14:07 +0300 Subject: SL-11178 FIXED [mac] Viewer crashes if another app gets focus before viewer window is created --- indra/llwindow/llwindowmacosx.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 6dec131a34..3554f90be8 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -382,7 +382,10 @@ void callWindowFocus() void callWindowUnfocus() { - gWindowImplementation->getCallbacks()->handleFocusLost(gWindowImplementation); + if ( gWindowImplementation && gWindowImplementation->getCallbacks() ) + { + gWindowImplementation->getCallbacks()->handleFocusLost(gWindowImplementation); + } } void callWindowHide() -- cgit v1.2.3 From 9212c1f33e6790c50957c4c46b8e1a386990aef9 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Tue, 4 Jun 2019 00:03:03 +0300 Subject: SL-11341 Skip storing the previous gamma value on Intel GPUs + more logging --- indra/llwindow/llwindowwin32.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 27787a51a8..97cd31de81 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2994,6 +2994,7 @@ BOOL LLWindowWin32::restoreGamma() { if (mCustomGammaSet != FALSE) { + LL_DEBUGS("Window") << "Restoring gamma" << LL_ENDL; mCustomGammaSet = FALSE; return SetDeviceGammaRamp(mhDC, mPrevGammaRamp); } @@ -3007,8 +3008,15 @@ BOOL LLWindowWin32::setGamma(const F32 gamma) //Get the previous gamma ramp to restore later. if (mCustomGammaSet == FALSE) { - if (GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE) - return FALSE; + if (!gGLManager.mIsIntel) // skip for Intel GPUs (see SL-11341) + { + LL_DEBUGS("Window") << "Getting the previous gamma ramp to restore later" << LL_ENDL; + if(GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE) + { + LL_WARNS("Window") << "Failed to get the previous gamma ramp" << LL_ENDL; + return FALSE; + } + } mCustomGammaSet = TRUE; } -- cgit v1.2.3