diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/cmake/Variables.cmake | 31 | ||||
-rw-r--r-- | indra/llplugin/slplugin/CMakeLists.txt | 20 | ||||
-rw-r--r-- | indra/llplugin/slplugin/slplugin.cpp | 94 | ||||
-rw-r--r-- | indra/llplugin/slplugin/slplugin_info.plist | 4 | ||||
-rw-r--r-- | indra/llvfs/lldir_mac.cpp | 2 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_object.xml | 8 | ||||
-rwxr-xr-x | indra/newview/viewer_manifest.py | 11 |
8 files changed, 152 insertions, 24 deletions
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index db0b44eb8f..bfaf3f4f26 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -75,11 +75,33 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(DARWIN 1) - # set this dynamically from the build system now - - # NOTE: wont have a distributable build unless you add this on the configure line with: + + # NOTE: If specifying a different SDK with CMAKE_OSX_SYSROOT at configure + # time you should also specify CMAKE_OSX_DEPLOYMENT_TARGET explicitly, + # otherwise CMAKE_OSX_SYSROOT will be overridden here. We can't just check + # for it being unset, as it gets set to the system default :( + + # Default to building against the 10.4 SDK if no deployment target is + # specified. + if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) + # NOTE: setting -isysroot is NOT adequate: http://lists.apple.com/archives/Xcode-users/2007/Oct/msg00696.html + # see http://public.kitware.com/Bug/view.php?id=9959 + poppy + set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.4) + endif (NOT CMAKE_OSX_DEPLOYMENT_TARGET) + + # GCC 4.2 is incompatible with the MacOSX 10.4 SDK + if (${CMAKE_OSX_SYSROOT} MATCHES "10.4u") + set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "4.0") + endif (${CMAKE_OSX_SYSROOT} MATCHES "10.4u") + + # NOTE: To attempt an i386/PPC Universal build, add this on the configure line: # -DCMAKE_OSX_ARCHITECTURES:STRING='i386;ppc' - #set(CMAKE_OSX_ARCHITECTURES i386;ppc) - set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) + # Build only for i386 by default, system default on MacOSX 10.6 is x86_64 + if (NOT CMAKE_OSX_ARCHITECTURES) + set(CMAKE_OSX_ARCHITECTURES i386) + endif (NOT CMAKE_OSX_ARCHITECTURES) + if (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") set(ARCH universal) else (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") @@ -89,6 +111,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(ARCH i386) endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc") endif (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + set(LL_ARCH ${ARCH}_darwin) set(LL_ARCH_DIR universal-darwin) set(WORD_SIZE 32) diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt index 4a7d670c23..c1536e85de 100644 --- a/indra/llplugin/slplugin/CMakeLists.txt +++ b/indra/llplugin/slplugin/CMakeLists.txt @@ -27,9 +27,15 @@ set(SLPlugin_SOURCE_FILES add_executable(SLPlugin WIN32 + MACOSX_BUNDLE ${SLPlugin_SOURCE_FILES} ) +set_target_properties(SLPlugin + PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist + ) + target_link_libraries(SLPlugin ${LLPLUGIN_LIBRARIES} ${LLMESSAGE_LIBRARIES} @@ -44,12 +50,16 @@ add_dependencies(SLPlugin ) if (DARWIN) - # Mac version needs to link against carbon, and also needs an embedded plist (to set LSBackgroundOnly) + # Mac version needs to link against Carbon target_link_libraries(SLPlugin ${CARBON_LIBRARY}) - set_target_properties( - SLPlugin - PROPERTIES - LINK_FLAGS "-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist" + # Make sure the app bundle has a Resources directory (it will get populated by viewer-manifest.py later) + add_custom_command( + TARGET SLPlugin POST_BUILD + COMMAND mkdir + ARGS + -p + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/SLPlugin.app/Contents/Resources ) endif (DARWIN) +ll_deploy_sharedlibs_command(SLPlugin) diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp index 77240ce546..c18e2375f9 100644 --- a/indra/llplugin/slplugin/slplugin.cpp +++ b/indra/llplugin/slplugin/slplugin.cpp @@ -51,7 +51,7 @@ #endif /* - On Mac OS, since we call WaitNextEvent, this process will show up in the dock unless we set the LSBackgroundOnly flag in the Info.plist. + On Mac OS, since we call WaitNextEvent, this process will show up in the dock unless we set the LSBackgroundOnly or LSUIElement flag in the Info.plist. Normally non-bundled binaries don't have an info.plist file, but it's possible to embed one in the binary by adding this to the linker flags: @@ -60,7 +60,8 @@ which means adding this to the gcc flags: -Wl,-sectcreate,__TEXT,__info_plist,/path/to/slplugin_info.plist - + + Now that SLPlugin is a bundled app on the Mac, this is no longer necessary (it can just use a regular Info.plist file), but I'm leaving this comment in for posterity. */ #if LL_DARWIN || LL_LINUX @@ -239,6 +240,21 @@ int main(int argc, char **argv) checkExceptionHandler(); #endif +#if LL_DARWIN + // If the plugin opens a new window (such as the Flash plugin's fullscreen player), we may need to bring this plugin process to the foreground. + // Use this to track the current frontmost window and bring this process to the front if it changes. + WindowRef front_window = NULL; + WindowGroupRef layer_group = NULL; + int window_hack_state = 0; + CreateWindowGroup(kWindowGroupAttrFixedLevel, &layer_group); + if(layer_group) + { + // Start out with a window layer that's way out in front (fixes the problem with the menubar not getting hidden on first switch to fullscreen youtube) + SetWindowGroupName(layer_group, CFSTR("SLPlugin Layer")); + SetWindowGroupLevel(layer_group, kCGOverlayWindowLevel); + } +#endif + while(!plugin->isDone()) { timer.reset(); @@ -248,6 +264,80 @@ int main(int argc, char **argv) // Some plugins (webkit at least) will want an event loop. This qualifies. EventRecord evt; WaitNextEvent(0, &evt, 0, NULL); + + // Check for a change in this process's frontmost window. + if(FrontWindow() != front_window) + { + ProcessSerialNumber self = { 0, kCurrentProcess }; + ProcessSerialNumber parent = { 0, kNoProcess }; + ProcessSerialNumber front = { 0, kNoProcess }; + Boolean this_is_front_process = false; + Boolean parent_is_front_process = false; + { + // Get this process's parent + ProcessInfoRec info; + info.processInfoLength = sizeof(ProcessInfoRec); + info.processName = NULL; + info.processAppSpec = NULL; + if(GetProcessInformation( &self, &info ) == noErr) + { + parent = info.processLauncher; + } + + // and figure out whether this process or its parent are currently frontmost + if(GetFrontProcess(&front) == noErr) + { + (void) SameProcess(&self, &front, &this_is_front_process); + (void) SameProcess(&parent, &front, &parent_is_front_process); + } + } + + if((FrontWindow() != NULL) && (front_window == NULL)) + { + // Opening the first window + + if(window_hack_state == 0) + { + // Next time through the event loop, lower the window group layer + window_hack_state = 1; + } + + if(layer_group) + { + SetWindowGroup(FrontWindow(), layer_group); + } + + if(parent_is_front_process) + { + // Bring this process's windows to the front. + (void) SetFrontProcess( &self ); + } + + ActivateWindow(FrontWindow(), true); + } + else if((FrontWindow() == NULL) && (front_window != NULL)) + { + // Closing the last window + + if(this_is_front_process) + { + // Try to bring this process's parent to the front + (void) SetFrontProcess(&parent); + } + } + else if(window_hack_state == 1) + { + if(layer_group) + { + // Set the window group level back to something less extreme + SetWindowGroupLevel(layer_group, kCGNormalWindowLevel); + } + window_hack_state = 2; + } + + front_window = FrontWindow(); + + } } #endif F64 elapsed = timer.getElapsedTimeF64(); diff --git a/indra/llplugin/slplugin/slplugin_info.plist b/indra/llplugin/slplugin/slplugin_info.plist index b1daf87424..c4597380e0 100644 --- a/indra/llplugin/slplugin/slplugin_info.plist +++ b/indra/llplugin/slplugin/slplugin_info.plist @@ -6,7 +6,7 @@ <string>English</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> - <key>LSBackgroundOnly</key> - <true/> + <key>LSUIElement</key> + <string>1</string> </dict> </plist> diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 7bc6f63e1f..8d3852002c 100644 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -426,7 +426,7 @@ BOOL LLDir_Mac::fileExists(const std::string &filename) const /*virtual*/ std::string LLDir_Mac::getLLPluginLauncher() { return gDirUtilp->getAppRODataDir() + gDirUtilp->getDirDelimiter() + - "SLPlugin"; + "SLPlugin.app/Contents/MacOS/SLPlugin"; } /*virtual*/ std::string LLDir_Mac::getLLPluginFilename(std::string base_name) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index efb16d1e42..cc1a79503e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1390,7 +1390,7 @@ if (WINDOWS) # If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency # here. - # *NOTE:Mani - This is a crappy hack to have important dependecies for the viewer_manifest copy action + # *NOTE:Mani - This is a crappy hack to have important dependencies for the viewer_manifest copy action # be met. I'm looking forward to a source-code split-up project next year that will address this kind of thing. # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py # and have the build deps get tracked *please* tell me about it. @@ -1411,7 +1411,7 @@ if (WINDOWS) endif(USE_GOOGLE_PERFTOOLS) - set(COPY_INPUT_DEPENDECIES + set(COPY_INPUT_DEPENDENCIES # The following commented dependencies are determined at variably at build time. Can't do this here. #${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll ${CMAKE_SOURCE_DIR}/../etc/message.xml @@ -1507,7 +1507,7 @@ if (WINDOWS) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py stage_third_party_libs - ${COPY_INPUT_DEPENDECIES} + ${COPY_INPUT_DEPENDENCIES} COMMENT "Performing viewer_manifest copy" ) diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml index 8b10c7b049..6ca8766e3f 100644 --- a/indra/newview/skins/default/xui/en/menu_object.xml +++ b/indra/newview/skins/default/xui/en/menu_object.xml @@ -18,16 +18,16 @@ name="Edit..."> <menu_item_call.on_click function="Object.Edit" /> - <menu_item_call.on_visible + <menu_item_call.on_visible function="EnableEdit"/> </menu_item_call> <menu_item_call label="Build" name="Build"> <menu_item_call.on_click - function="Object.Edit" /> - <menu_item_call.on_visible - function="VisibleBuild"/> + function="Object.Build" /> + <menu_item_call.on_visible + function="EnableEdit"/> </menu_item_call> <menu_item_call enabled="false" diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 18ac10fe38..19b18b3282 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -639,10 +639,14 @@ class DarwinManifest(ViewerManifest): self.path("../mac_crash_logger/" + self.args['configuration'] + "/mac-crash-logger.app", "mac-crash-logger.app") self.path("../mac_updater/" + self.args['configuration'] + "/mac-updater.app", "mac-updater.app") + # plugin launcher + self.path("../llplugin/slplugin/" + self.args['configuration'] + "/SLPlugin.app", "SLPlugin.app") + # our apps dependencies on shared libs if dylibs["llcommon"]: mac_crash_logger_res_path = self.dst_path_of("mac-crash-logger.app/Contents/Resources") mac_updater_res_path = self.dst_path_of("mac-updater.app/Contents/Resources") + slplugin_res_path = self.dst_path_of("SLPlugin.app/Contents/Resources") for libfile in ("libllcommon.dylib", "libapr-1.0.3.7.dylib", "libaprutil-1.0.3.8.dylib", @@ -656,9 +660,10 @@ class DarwinManifest(ViewerManifest): {'target': target_lib, 'link' : os.path.join(mac_updater_res_path, libfile)} ) - - # plugin launcher - self.path("../llplugin/slplugin/" + self.args['configuration'] + "/SLPlugin", "SLPlugin") + self.run_command("ln -sf %(target)r %(link)r" % + {'target': target_lib, + 'link' : os.path.join(slplugin_res_path, libfile)} + ) # plugins if self.prefix(src="", dst="llplugin"): |