From 786b291d9c6b784c7ce6ceef0e38a4ec76ea14db Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 16:32:52 +0200 Subject: Move CMake files to modernized cmake syntax, step 1. Change projects to cmake targetsto get rid of havig to hardcore include directories and link libraries in consumer projects. --- indra/llwindow/CMakeLists.txt | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 70eb99c86c..952fbbb56f 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -14,26 +14,9 @@ include(00-Common) include(DragDrop) include(LLCommon) include(LLImage) -include(LLMath) -include(LLRender) -include(LLFileSystem) include(LLWindow) -include(LLXML) include(UI) -include_directories( - ${LLCOMMON_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} - ${LLMATH_INCLUDE_DIRS} - ${LLRENDER_INCLUDE_DIRS} - ${LLFILESYSTEM_INCLUDE_DIRS} - ${LLWINDOW_INCLUDE_DIRS} - ${LLXML_INCLUDE_DIRS} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_INCLUDE_DIRS} - ${LLXML_SYSTEM_INCLUDE_DIRS} - ) set(llwindow_SOURCE_FILES llcursortypes.cpp @@ -64,17 +47,18 @@ set(viewer_HEADER_FILES llmousehandler.h ) +set(llwindow_LINK_LIBRARIES + llcommon + llimage + llmath + llrender + llfilesystem + llxml + ) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level if (LINUX) - set(llwindow_LINK_LIBRARIES - ${LLCOMMON_LIBRARIES} - ${LLIMAGE_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLRENDER_LIBRARIES} - ${LLFILESYSTEM_LIBRARIES} - ${LLWINDOW_LIBRARIES} - ${LLXML_LIBRARIES} + set(llwindow_LINK_LIBRARIES APPEND ${UI_LIBRARIES} # for GTK ${SDL_LIBRARY} fontconfig # For FCInit and other FC* functions. @@ -196,5 +180,5 @@ if (SDL_FOUND) ) endif (SDL_FOUND) - target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) - +target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) +set_target_include_dirs(llwindow ${CMAKE_CURRENT_SOURCE_DIR}) -- cgit v1.2.3 From 5f7c74fa2e796c04915b6da5e7db013a94c00e2d Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 20:25:49 +0200 Subject: Create and use sdl::sdl target --- indra/llwindow/CMakeLists.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 952fbbb56f..2b5a03d219 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -174,11 +174,5 @@ endif (llwindow_HEADER_FILES) ${viewer_SOURCE_FILES} ) -if (SDL_FOUND) - set_property(TARGET llwindow - PROPERTY COMPILE_DEFINITIONS LL_SDL=1 - ) -endif (SDL_FOUND) - -target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) +target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES} sdl::sdl) set_target_include_dirs(llwindow ${CMAKE_CURRENT_SOURCE_DIR}) -- cgit v1.2.3 From 241919e7f7986c11586a49bff53cf19c2c0e0ea6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 19:21:55 +0200 Subject: Rework cmake, the original plan was to maybe be able to use conan targets with the same name (that's why 3ps had names like apr::apr), but it's safer and saner to put the LL 3ps under the ll:: prefix. This also allows means it is possible to get rid of that bad "if( TRAGET ...) return() endif()" pattern and rather use include_guard(). --- indra/llwindow/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 2b5a03d219..c997bbdf59 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -174,5 +174,5 @@ endif (llwindow_HEADER_FILES) ${viewer_SOURCE_FILES} ) -target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES} sdl::sdl) +target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES} ll::sdl) set_target_include_dirs(llwindow ${CMAKE_CURRENT_SOURCE_DIR}) -- cgit v1.2.3 From 924fa0fa78b41c7e8486c1ed29764afb1e32fd7e Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 17:28:26 +0200 Subject: create target ll::uilibraries to have one common target that defines what each operation system needs as dependencies on OS gui libraries. --- indra/llwindow/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index c997bbdf59..4c2f8149b4 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -59,9 +59,9 @@ set(llwindow_LINK_LIBRARIES # Sort by high-level to low-level if (LINUX) set(llwindow_LINK_LIBRARIES APPEND - ${UI_LIBRARIES} # for GTK - ${SDL_LIBRARY} - fontconfig # For FCInit and other FC* functions. + ll::uilibraries + ll::sdl + ll::fontconfig # For FCInit and other FC* functions. ) list(APPEND viewer_SOURCE_FILES -- cgit v1.2.3 From e0cf0cdfd49e5a946dcd202a083fb23f01e4f1fe Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 18:04:57 +0200 Subject: Switch to target_include_directories All 3Ps include dirs are treated as SYSTEM, this will stop compilers stop emitting warnings from those files and greatly helps having high warning levels and not being swamped by warnings that come from external libraries. --- indra/llwindow/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 4c2f8149b4..826edf31cf 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -175,4 +175,4 @@ endif (llwindow_HEADER_FILES) ) target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES} ll::sdl) -set_target_include_dirs(llwindow ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories( llwindow INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -- cgit v1.2.3 From a9f4e88a30ada36b098f0d43e7a652ab4df7a0d9 Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 18 Apr 2022 03:10:54 +0200 Subject: Introduce ll::fontconfig target (missing the correct link library, but at least this gets us compiling) --- indra/llwindow/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 826edf31cf..dfa511e6ec 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -16,7 +16,7 @@ include(LLCommon) include(LLImage) include(LLWindow) include(UI) - +include(ViewerMiscLibs) set(llwindow_SOURCE_FILES llcursortypes.cpp -- cgit v1.2.3 From 98ef2494705aeecf636ae4733dcee04cf23297d7 Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 18 Apr 2022 03:42:26 +0200 Subject: Need to use list( APPEND ... to append to a list. --- indra/llwindow/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index dfa511e6ec..c86b252994 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -58,7 +58,7 @@ set(llwindow_LINK_LIBRARIES # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level if (LINUX) - set(llwindow_LINK_LIBRARIES APPEND + list( APPEND llwindow_LINK_LIBRARIES ll::uilibraries ll::sdl ll::fontconfig # For FCInit and other FC* functions. -- cgit v1.2.3 From 2b151e0aefd54671e1be504269f10318d303dccb Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 18 Apr 2022 18:11:43 +0200 Subject: Round one to support conan for 3P packages, this allows to build the viewer on Linux again. --- indra/llwindow/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index c86b252994..a2044f374c 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -54,14 +54,15 @@ set(llwindow_LINK_LIBRARIES llrender llfilesystem llxml + ll::glh_linear + ll::glext ) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level if (LINUX) list( APPEND llwindow_LINK_LIBRARIES ll::uilibraries - ll::sdl - ll::fontconfig # For FCInit and other FC* functions. + ll::SDL ) list(APPEND viewer_SOURCE_FILES @@ -174,5 +175,5 @@ endif (llwindow_HEADER_FILES) ${viewer_SOURCE_FILES} ) -target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES} ll::sdl) +target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) target_include_directories( llwindow INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -- cgit v1.2.3 From 283c2a20cc4ef856076d287303c7143332b201fe Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 1 May 2022 00:38:40 +0200 Subject: Remove setting of HEADER_FILE_ONLY on .h* files, cmake automatically sets the property on those. --- indra/llwindow/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index a2044f374c..d09e5387b9 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -142,9 +142,6 @@ if (SOLARIS) ) endif (SOLARIS) -set_source_files_properties(${llwindow_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE) - if (BUILD_HEADLESS) set(llwindowheadless_SOURCE_FILES llwindowmesaheadless.cpp -- cgit v1.2.3 From c66f444d2b3af7c5ea5220db5302b693bbc54f54 Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 20 Jun 2022 23:29:57 +0200 Subject: Cleanup dependency on ui libraries. --- indra/llwindow/CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index d09e5387b9..cc60625683 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -56,15 +56,12 @@ set(llwindow_LINK_LIBRARIES llxml ll::glh_linear ll::glext + ll::uilibraries + ll::SDL ) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level if (LINUX) - list( APPEND llwindow_LINK_LIBRARIES - ll::uilibraries - ll::SDL - ) - list(APPEND viewer_SOURCE_FILES llkeyboardsdl.cpp llwindowsdl.cpp -- cgit v1.2.3 From 65612700f389d453d4817fb3f68429a60ea144b8 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 24 Aug 2022 14:00:16 -0400 Subject: DRTVWR-558: Eliminate many spurious set-not-used variables. With Xcode 13.4, these unused variables break Release builds. --- indra/llwindow/llwindowmacosx.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index bc4f07941b..b44c6138f4 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -621,8 +621,6 @@ void LLWindowMacOSX::getMouseDeltas(float* delta) BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL enable_vsync) { - BOOL glNeedsInit = FALSE; - mFullscreen = fullscreen; if (mWindow == NULL) @@ -636,10 +634,6 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits // Get the view instead. mGLView = createOpenGLView(mWindow, mFSAASamples, enable_vsync); mContext = getCGLContextObj(mGLView); - - // Since we just created the context, it needs to be set up. - glNeedsInit = TRUE; - gGLManager.mVRAM = getVramSize(mGLView); } @@ -1719,12 +1713,6 @@ void LLSplashScreenMacOSX::showImpl() void LLSplashScreenMacOSX::updateImpl(const std::string& mesg) { - if(mWindow != NULL) - { - CFStringRef string = NULL; - - string = CFStringCreateWithCString(NULL, mesg.c_str(), kCFStringEncodingUTF8); - } } -- cgit v1.2.3 From c7366f4c55c6442414eb6c5a6736baf90f1a4700 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 17 Sep 2022 02:09:04 +0300 Subject: SL-17238 Fix coding policy build issues --- indra/llwindow/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index cc60625683..dbab58c5de 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -54,8 +54,8 @@ set(llwindow_LINK_LIBRARIES llrender llfilesystem llxml - ll::glh_linear - ll::glext + ll::glh_linear + ll::glext ll::uilibraries ll::SDL ) -- cgit v1.2.3 From 97ea17e6e9fec4538868e3dc86b802c1117e012b Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Fri, 28 Oct 2022 18:50:38 -0400 Subject: Fix leak of copy and paste on mac --- indra/llwindow/llwindowmacosx-objc.h | 2 +- indra/llwindow/llwindowmacosx-objc.mm | 45 ++++++++++++++++++----------------- indra/llwindow/llwindowmacosx.cpp | 7 ++++-- 3 files changed, 29 insertions(+), 25 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 43edc0110d..77024d3a9c 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -83,7 +83,7 @@ int createNSApp(int argc, const char **argv); void setupCocoa(); bool pasteBoardAvailable(); bool copyToPBoard(const unsigned short *str, unsigned int len); -const unsigned short *copyFromPBoard(); +unsigned short *copyFromPBoard(); CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); short releaseImageCursor(CursorRef ref); short setImageCursor(CursorRef ref); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 5ec9b017cf..acbcd1c281 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -64,13 +64,13 @@ void setupCocoa() bool copyToPBoard(const unsigned short *str, unsigned int len) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; - NSPasteboard *pboard = [NSPasteboard generalPasteboard]; - [pboard clearContents]; - - NSArray *contentsToPaste = [[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil]; - [pool release]; - return [pboard writeObjects:contentsToPaste]; + @autoreleasepool { + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + [pboard clearContents]; + + NSArray *contentsToPaste = [[[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil] autorelease]; + return [pboard writeObjects:contentsToPaste]; + } } bool pasteBoardAvailable() @@ -79,22 +79,23 @@ bool pasteBoardAvailable() return [[NSPasteboard generalPasteboard] canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; } -const unsigned short *copyFromPBoard() +unsigned short *copyFromPBoard() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; - NSPasteboard *pboard = [NSPasteboard generalPasteboard]; - NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; - NSString *str = NULL; - BOOL ok = [pboard canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; - if (ok) - { - NSArray *objToPaste = [pboard readObjectsForClasses:classArray options:[NSDictionary dictionary]]; - str = [objToPaste objectAtIndex:0]; - } - unichar* temp = (unichar*)calloc([str length]+1, sizeof(unichar)); - [str getCharacters:temp]; - [pool release]; - return temp; + @autoreleasepool { + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; + NSString *str = NULL; + BOOL ok = [pboard canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; + if (ok) + { + NSArray *objToPaste = [pboard readObjectsForClasses:classArray options:[NSDictionary dictionary]]; + str = [objToPaste objectAtIndex:0]; + } + NSUInteger str_len = [str length]; + unichar* temp = (unichar*)calloc(str_len+1, sizeof(unichar)); + [str getCharacters:temp range:NSMakeRange(0, str_len)]; + return temp; + } } CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY) diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index c29131d60b..cf940bf68c 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1246,8 +1246,11 @@ BOOL LLWindowMacOSX::isClipboardTextAvailable() } BOOL LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) -{ - llutf16string str(copyFromPBoard()); +{ + unsigned short* pboard_data = copyFromPBoard(); // must free returned data + llutf16string str(pboard_data); + free(pboard_data); + dst = utf16str_to_wstring(str); if (dst != L"") { -- cgit v1.2.3 From 83466b301a34183a0d146d13bdc7973e02172588 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Fri, 28 Oct 2022 18:53:34 -0400 Subject: Clean up autorelease behavior in llwindowmac and additional leaks --- indra/llwindow/llwindowmacosx-objc.mm | 91 +++++++++++++++++------------------ 1 file changed, 45 insertions(+), 46 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index acbcd1c281..57c3d86295 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -49,14 +49,12 @@ void setupCocoa() if(!inited) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. - // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' - // when init'ing the Cocoa App window. - [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; - - [pool release]; + @autoreleasepool { + // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. + // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' + // when init'ing the Cocoa App window. + [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; + } inited = true; } @@ -100,19 +98,18 @@ unsigned short *copyFromPBoard() CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - // extra retain on the NSCursor since we want it to live for the lifetime of the app. - NSCursor *cursor = - [[[NSCursor alloc] - initWithImage: - [[[NSImage alloc] initWithContentsOfFile: - [NSString stringWithUTF8String:fullpath] - ]autorelease] - hotSpot:NSMakePoint(hotspotX, hotspotY) - ]retain]; - - [pool release]; + NSCursor *cursor = nil; + @autoreleasepool { + // extra retain on the NSCursor since we want it to live for the lifetime of the app. + cursor = + [[[NSCursor alloc] + initWithImage: + [[[NSImage alloc] initWithContentsOfFile: + [NSString stringWithUTF8String:fullpath] + ] autorelease] + hotSpot:NSMakePoint(hotspotX, hotspotY) + ] retain]; + } return (CursorRef)cursor; } @@ -179,10 +176,10 @@ OSErr releaseImageCursor(CursorRef ref) { if( ref != NULL ) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSCursor *cursor = (NSCursor*)ref; - [cursor release]; - [pool release]; + @autoreleasepool { + NSCursor *cursor = (NSCursor*)ref; + [cursor autorelease]; + } } else { @@ -196,10 +193,10 @@ OSErr setImageCursor(CursorRef ref) { if( ref != NULL ) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSCursor *cursor = (NSCursor*)ref; - [cursor set]; - [pool release]; + @autoreleasepool { + NSCursor *cursor = (NSCursor*)ref; + [cursor set]; + } } else { @@ -420,24 +417,26 @@ void requestUserAttention() long showAlert(std::string text, std::string title, int type) { - NSAlert *alert = [[NSAlert alloc] init]; - - [alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]]; - [alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]]; - if (type == 0) - { - [alert addButtonWithTitle:@"Okay"]; - } else if (type == 1) - { - [alert addButtonWithTitle:@"Okay"]; - [alert addButtonWithTitle:@"Cancel"]; - } else if (type == 2) - { - [alert addButtonWithTitle:@"Yes"]; - [alert addButtonWithTitle:@"No"]; + long ret = 0; + @autoreleasepool { + NSAlert *alert = [[[NSAlert alloc] init] autorelease]; + + [alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]]; + [alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]]; + if (type == 0) + { + [alert addButtonWithTitle:@"Okay"]; + } else if (type == 1) + { + [alert addButtonWithTitle:@"Okay"]; + [alert addButtonWithTitle:@"Cancel"]; + } else if (type == 2) + { + [alert addButtonWithTitle:@"Yes"]; + [alert addButtonWithTitle:@"No"]; + } + ret = [alert runModal]; } - long ret = [alert runModal]; - [alert dealloc]; if (ret == NSAlertFirstButtonReturn) { -- cgit v1.2.3 From d89033420ef05b9b0a5751c3f254ce802e90df0b Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sat, 29 Oct 2022 23:18:03 -0400 Subject: Fix RenderAppleUseMultGL debug setting for enabling threaded GL engine --- indra/llwindow/llwindowmacosx.cpp | 4 ++-- indra/llwindow/llwindowmacosx.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index cf940bf68c..2fe0ed469e 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -668,11 +668,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits if (cgl_err != kCGLNoError ) { - LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL; + LL_INFOS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL; } else { - LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL; + LL_INFOS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL; } } makeFirstResponder(mWindow, mGLView); diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index b0f339e1db..851c860017 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -228,6 +228,7 @@ protected: BOOL mLanguageTextInputAllowed; LLPreeditor* mPreeditor; +public: static BOOL sUseMultGL; friend class LLWindowManager; -- cgit v1.2.3 From 971fd6f8433b07bbd51ef83f2de518ef8b20d07f Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sat, 29 Oct 2022 23:18:35 -0400 Subject: Fix use of deprecated CGDisplayAvailableModes with CGDisplayCopyAllDisplayModes --- indra/llwindow/llwindowmacosx.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 2fe0ed469e..f924b17090 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1283,7 +1283,7 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r { if (!mSupportedResolutions) { - CFArrayRef modes = CGDisplayAvailableModes(mDisplay); + CFArrayRef modes = CGDisplayCopyAllDisplayModes(mDisplay, nullptr); if(modes != NULL) { @@ -1322,6 +1322,7 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r } } } + CFRelease(modes); } } -- cgit v1.2.3 From d0e07c770b978d57210a5403bc42cc48e700ef63 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sun, 30 Oct 2022 06:56:16 -0400 Subject: Fix checks for empty LLSD maps to use size and not emptyMap which is for creating an empty LLSDMap type. --- indra/llwindow/lldxhardware.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index 81e938edbe..391a377280 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -1098,7 +1098,7 @@ LLSD LLDXHardware::getDisplayInfo() } LCleanup: - if (ret.emptyMap()) + if (!ret.isMap() || (ret.size() == 0)) { LL_INFOS() << "Failed to get data, cleaning up" << LL_ENDL; } -- cgit v1.2.3 From d01f7afff206dd610b6c209e6bd69d646b47863f Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko <118780484+maxim-productengine@users.noreply.github.com> Date: Fri, 25 Nov 2022 18:16:31 +0200 Subject: SL-18713 fix crash in handleCompositionMessage (#12) --- indra/llwindow/llwindowwin32.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index c487877caf..740224adf9 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4100,6 +4100,10 @@ void LLWindowWin32::handleStartCompositionMessage() void LLWindowWin32::handleCompositionMessage(const U32 indexes) { + if (!mPreeditor) + { + return; + } BOOL needs_update = FALSE; LLWString result_string; LLWString preedit_string; -- cgit v1.2.3 From 07baa83ef273f41135b886363b34c423a566bffc Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 14 Dec 2022 20:49:56 +0200 Subject: SL-18384 Fix NSException for keyboard handling Affects accent keys for diacritical marks --- indra/llwindow/llopenglview-objc.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 049226db65..7936245744 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -495,7 +495,12 @@ attributedStringInfo getSegments(NSAttributedString *str) // e.g. OS Window for upload something or Input Window... // mModifiers instance variable is for insertText: or insertText:replacementRange: (by Pell Smit) mModifiers = [theEvent modifierFlags]; - unichar ch = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]; + NSString *str_no_modifiers = [theEvent charactersIgnoringModifiers]; + unichar ch = 0; + if (str_no_modifiers.length) + { + ch = [str_no_modifiers characterAtIndex:0]; + } bool acceptsText = mHasMarkedText ? false : callKeyDown(&eventData, keycode, mModifiers, ch); if (acceptsText && -- cgit v1.2.3 From 63494cf5c9157db76e57ccddb241d759b716813f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 12 Jan 2023 23:33:38 +0200 Subject: SL-12456 Potential fix for NSPersistentUIFileManager crash NSPersistentUIFileManager is supposed to be responsible for restoring window position and size --- indra/llwindow/llwindowmacosx-objc.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 5ec9b017cf..3693042eef 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -217,6 +217,7 @@ NSWindowRef createNSWindow(int x, int y, int width, int height) styleMask:NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:NO]; [window makeKeyAndOrderFront:nil]; [window setAcceptsMouseMovedEvents:TRUE]; + [window setRestorable:FALSE]; // Viewer manages state from own settings return window; } -- cgit v1.2.3 From 89f3bf6c13c07038c1d50ea0babb35045cba7f77 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 17 Jan 2023 22:06:22 +0200 Subject: SL-18985 Crash at std::basic_string::erase --- 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 6039aa6618..11a3c943ee 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4438,7 +4438,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res LLWString context = find_context(wtext, preedit, preedit_length, &context_offset); preedit -= context_offset; preedit_length = llmin(preedit_length, (S32)context.length() - preedit); - if (preedit_length && preedit >= 0) + if (preedit_length > 0 && preedit >= 0) { // IMR_DOCUMENTFEED may be called when we have an active preedit. // We should pass the context string *excluding* the preedit string. -- cgit v1.2.3 From 472ecc8088233168b25f60a100403d9c4ab832b1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 19 Jan 2023 01:44:16 +0200 Subject: SL-18999 IME disabling should be called in window's thread For some reason positioning IME window works fine, but disabling and enabling ime works from window's thread only --- indra/llwindow/llwindowwin32.cpp | 76 ++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 35 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 11a3c943ee..6f67b131d1 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3904,42 +3904,48 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) sLanguageTextInputAllowed = b; - if ( sLanguageTextInputAllowed ) - { - // Allowing: Restore the previous IME status, so that the user has a feeling that the previous - // text input continues naturally. Be careful, however, the IME status is meaningful only during the user keeps - // using same Input Locale (aka Keyboard Layout). - if (sWinIMEOpened && GetKeyboardLayout(0) == sWinInputLocale) - { - HIMC himc = LLWinImm::getContext(mWindowHandle); - LLWinImm::setOpenStatus(himc, TRUE); - LLWinImm::setConversionStatus(himc, sWinIMEConversionMode, sWinIMESentenceMode); - LLWinImm::releaseContext(mWindowHandle, himc); - } - } - else - { - // Disallowing: Turn off the IME so that succeeding key events bypass IME and come to us directly. - // However, do it after saving the current IME status. We need to restore the status when - // allowing language text input again. - sWinInputLocale = GetKeyboardLayout(0); - sWinIMEOpened = LLWinImm::isIME(sWinInputLocale); - if (sWinIMEOpened) - { - HIMC himc = LLWinImm::getContext(mWindowHandle); - sWinIMEOpened = LLWinImm::getOpenStatus(himc); - if (sWinIMEOpened) - { - LLWinImm::getConversionStatus(himc, &sWinIMEConversionMode, &sWinIMESentenceMode); + if (sLanguageTextInputAllowed) + { + mWindowThread->post([=]() + { + // Allowing: Restore the previous IME status, so that the user has a feeling that the previous + // text input continues naturally. Be careful, however, the IME status is meaningful only during the user keeps + // using same Input Locale (aka Keyboard Layout). + if (sWinIMEOpened && GetKeyboardLayout(0) == sWinInputLocale) + { + HIMC himc = LLWinImm::getContext(mWindowHandle); + LLWinImm::setOpenStatus(himc, TRUE); + LLWinImm::setConversionStatus(himc, sWinIMEConversionMode, sWinIMESentenceMode); + LLWinImm::releaseContext(mWindowHandle, himc); + } + }); + } + else + { + mWindowThread->post([=]() + { + // Disallowing: Turn off the IME so that succeeding key events bypass IME and come to us directly. + // However, do it after saving the current IME status. We need to restore the status when + // allowing language text input again. + sWinInputLocale = GetKeyboardLayout(0); + sWinIMEOpened = LLWinImm::isIME(sWinInputLocale); + if (sWinIMEOpened) + { + HIMC himc = LLWinImm::getContext(mWindowHandle); + sWinIMEOpened = LLWinImm::getOpenStatus(himc); + if (sWinIMEOpened) + { + LLWinImm::getConversionStatus(himc, &sWinIMEConversionMode, &sWinIMESentenceMode); - // We need both ImmSetConversionStatus and ImmSetOpenStatus here to surely disable IME's - // keyboard hooking, because Some IME reacts only on the former and some other on the latter... - LLWinImm::setConversionStatus(himc, IME_CMODE_NOCONVERSION, sWinIMESentenceMode); - LLWinImm::setOpenStatus(himc, FALSE); - } - LLWinImm::releaseContext(mWindowHandle, himc); - } - } + // We need both ImmSetConversionStatus and ImmSetOpenStatus here to surely disable IME's + // keyboard hooking, because Some IME reacts only on the former and some other on the latter... + LLWinImm::setConversionStatus(himc, IME_CMODE_NOCONVERSION, sWinIMESentenceMode); + LLWinImm::setOpenStatus(himc, FALSE); + } + LLWinImm::releaseContext(mWindowHandle, himc); + } + }); + } } void LLWindowWin32::fillCandidateForm(const LLCoordGL& caret, const LLRect& bounds, -- cgit v1.2.3