diff options
author | simon <none@none> | 2014-03-19 11:41:42 -0700 |
---|---|---|
committer | simon <none@none> | 2014-03-19 11:41:42 -0700 |
commit | 00a325ccb90b1c6800ec78e1211b5097d9c27a58 (patch) | |
tree | 8b58fbd99d5bce117cf8dad5181b5690af4bd34f /indra/llwindow | |
parent | 09d1c27d4f78c78d949b6a3d896d6f58df2dfc06 (diff) | |
parent | 1ab9f19f82a84a109cf429998f423986268801f6 (diff) |
Pull in viewer-lion to lock down next release
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llopenglview-objc.h | 3 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 21 | ||||
-rwxr-xr-x | indra/llwindow/llwindow.h | 2 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.h | 1 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.mm | 7 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx.h | 5 | ||||
-rwxr-xr-x | indra/llwindow/llwindowwin32.cpp | 34 |
7 files changed, 64 insertions, 9 deletions
diff --git a/indra/llwindow/llopenglview-objc.h b/indra/llwindow/llopenglview-objc.h index 1e0e47cd02..f1fab3b2c6 100644 --- a/indra/llwindow/llopenglview-objc.h +++ b/indra/llwindow/llopenglview-objc.h @@ -42,6 +42,7 @@ unsigned int mMarkedTextLength; bool mMarkedTextAllowed; bool mSimulatedRightClick; + bool mOldResize; } - (id) initWithSamples:(NSUInteger)samples; - (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync; @@ -49,6 +50,8 @@ - (void)commitCurrentPreedit; +- (void) setOldResize:(bool)oldresize; + // rebuildContext // Destroys and recreates a context with the view's internal format set via setPixelFormat; // Use this in event of needing to rebuild a context for whatever reason, without needing to assign a new pixel format. diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index b393a3796d..017ea3769c 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -94,8 +94,11 @@ attributedStringInfo getSegments(NSAttributedString *str) // Force a high quality update after live resizing - (void) viewDidEndLiveResize { - NSSize size = [self frame].size; - callResize(size.width, size.height); + if (mOldResize) //Maint-3135 + { + NSSize size = [self frame].size; + callResize(size.width, size.height); + } } - (unsigned long)getVramSize @@ -124,10 +127,18 @@ attributedStringInfo getSegments(NSAttributedString *str) object:[self window]]; } +- (void)setOldResize:(bool)oldresize +{ + mOldResize = oldresize; +} + - (void)windowResized:(NSNotification *)notification; { - //NSSize size = [self frame].size; - //callResize(size.width, size.height); + if (!mOldResize) //Maint-3288 + { + NSSize size = [self frame].size; + callResize(size.width, size.height); + } } - (void)dealloc @@ -204,6 +215,8 @@ attributedStringInfo getSegments(NSAttributedString *str) [glContext setValues:(const GLint*)0 forParameter:NSOpenGLCPSwapInterval]; } + mOldResize = false; + return self; } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 78186004b8..50ea614634 100755 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -123,7 +123,7 @@ public: virtual void swapBuffers() = 0; virtual void bringToFront() = 0; virtual void focusClient() { }; // this may not have meaning or be required on other platforms, therefore, it's not abstract - + virtual void setOldResize(bool oldresize) { }; // handy coordinate space conversion routines // NB: screen to window and vice verse won't work on width/height coordinate pairs, // as the conversion must take into account left AND right border widths, etc. diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 81b25601a9..d64525fbdd 100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -74,6 +74,7 @@ void showNSCursor(); void hideNSCursorTillMove(bool hide); void requestUserAttention(); long showAlert(std::string title, std::string text, int type); +void setResizeMode(bool oldresize, void* glview); NSWindowRef createNSWindow(int x, int y, int width, int height); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 0768d0352e..1a21bf8430 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -91,7 +91,7 @@ const unsigned short *copyFromPBoard() NSArray *objToPaste = [pboard readObjectsForClasses:classArray options:[NSDictionary dictionary]]; str = [objToPaste objectAtIndex:0]; } - unichar* temp = (unichar*)calloc([str length], sizeof(unichar)); + unichar* temp = (unichar*)calloc([str length]+1, sizeof(unichar)); [str getCharacters:temp]; [pool release]; return temp; @@ -222,6 +222,11 @@ GLViewRef createOpenGLView(NSWindowRef window, unsigned int samples, bool vsync) return glview; } +void setResizeMode(bool oldresize, void* glview) +{ + [(LLOpenGLView *)glview setOldResize:oldresize]; +} + void glSwapBuffers(void* context) { [(NSOpenGLContext*)context flushBuffer]; diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 6a6b39e674..825fd05c5f 100755 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -152,7 +152,10 @@ protected: BOOL resetDisplayResolution(); BOOL shouldPostQuit() { return mPostQuit; } - + + //Satisfy MAINT-3135 and MAINT-3288 with a flag. + /*virtual */ void setOldResize(bool oldresize) {setResizeMode(oldresize, mGLView); } + protected: // diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 30f5526500..5106da09b2 100755 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -85,6 +85,18 @@ void show_window_creation_error(const std::string& title) LL_WARNS("Window") << title << LL_ENDL; } +HGLRC SafeCreateContext(HDC hdc) +{ + __try + { + return wglCreateContext(hdc); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + return NULL; + } +} + //static BOOL LLWindowWin32::sIsClassRegistered = FALSE; @@ -1166,14 +1178,15 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO return FALSE; } - if (!(mhRC = wglCreateContext(mhDC))) + + if (!(mhRC = SafeCreateContext(mhDC))) { close(); OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } - + if (!wglMakeCurrent(mhDC, mhRC)) { close(); @@ -1831,6 +1844,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // This helps prevent avatar walking after maximizing the window by double-clicking the title bar. static bool sHandleLeftMouseUp = true; + // Ignore the double click received right after activating app. + // This is to avoid triggering double click teleport after returning focus (see MAINT-3786). + static bool sHandleDoubleClick = true; + LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA); @@ -1958,6 +1975,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ } } + if (!activating) + { + sHandleDoubleClick = false; + } + window_imp->mCallbacks->handleActivateApp(window_imp, activating); break; @@ -2182,6 +2204,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_NCLBUTTONDOWN"); // A click in a non-client area, e.g. title bar or window border. sHandleLeftMouseUp = false; + sHandleDoubleClick = true; } break; @@ -2226,6 +2249,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ //case WM_RBUTTONDBLCLK: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDBLCLK"); + + if (!sHandleDoubleClick) + { + sHandleDoubleClick = true; + break; + } + // Because we move the cursor position in the app, we need to query // to find out where the cursor at the time the event is handled. // If we don't do this, many clicks could get buffered up, and if the |