diff options
author | Armin Weatherwax | 2010-08-07 19:17:13 +0200 |
---|---|---|
committer | Armin Weatherwax | 2010-09-23 15:42:40 +0200 |
commit | 70800de39a3d942d2120abd926fbdb24577fb0f6 (patch) | |
tree | efeb12456e1a8ee7182656dc7503dc9b89a07a63 /linden/indra/llplugin/slplugin | |
parent | fix some mime type issues (diff) | |
download | meta-impy-70800de39a3d942d2120abd926fbdb24577fb0f6.zip meta-impy-70800de39a3d942d2120abd926fbdb24577fb0f6.tar.gz meta-impy-70800de39a3d942d2120abd926fbdb24577fb0f6.tar.bz2 meta-impy-70800de39a3d942d2120abd926fbdb24577fb0f6.tar.xz |
update to viewer-external SLPlugin + webkit. Fixes (lots of) webpages not loading.
Issue: llqtwebkit needs update for Linux 64bit
Diffstat (limited to 'linden/indra/llplugin/slplugin')
-rwxr-xr-x | linden/indra/llplugin/slplugin/CMakeLists.txt | 39 | ||||
-rw-r--r-- | linden/indra/llplugin/slplugin/slplugin-objc.h | 42 | ||||
-rw-r--r-- | linden/indra/llplugin/slplugin/slplugin-objc.mm | 89 | ||||
-rwxr-xr-x | linden/indra/llplugin/slplugin/slplugin.cpp | 111 | ||||
-rwxr-xr-x | linden/indra/llplugin/slplugin/slplugin_info.plist | 4 |
5 files changed, 275 insertions, 10 deletions
diff --git a/linden/indra/llplugin/slplugin/CMakeLists.txt b/linden/indra/llplugin/slplugin/CMakeLists.txt index 4a7d670..81d9299 100755 --- a/linden/indra/llplugin/slplugin/CMakeLists.txt +++ b/linden/indra/llplugin/slplugin/CMakeLists.txt | |||
@@ -16,6 +16,7 @@ include_directories( | |||
16 | if (DARWIN) | 16 | if (DARWIN) |
17 | include(CMakeFindFrameworks) | 17 | include(CMakeFindFrameworks) |
18 | find_library(CARBON_LIBRARY Carbon) | 18 | find_library(CARBON_LIBRARY Carbon) |
19 | find_library(COCOA_LIBRARY Cocoa) | ||
19 | endif (DARWIN) | 20 | endif (DARWIN) |
20 | 21 | ||
21 | 22 | ||
@@ -25,11 +26,33 @@ set(SLPlugin_SOURCE_FILES | |||
25 | slplugin.cpp | 26 | slplugin.cpp |
26 | ) | 27 | ) |
27 | 28 | ||
29 | if (DARWIN) | ||
30 | list(APPEND SLPlugin_SOURCE_FILES | ||
31 | slplugin-objc.mm | ||
32 | ) | ||
33 | list(APPEND SLPlugin_HEADER_FILES | ||
34 | slplugin-objc.h | ||
35 | ) | ||
36 | endif (DARWIN) | ||
37 | |||
38 | set_source_files_properties(${SLPlugin_HEADER_FILES} | ||
39 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
40 | |||
41 | if (SLPlugin_HEADER_FILES) | ||
42 | list(APPEND SLPlugin_SOURCE_FILES ${SLPlugin_HEADER_FILES}) | ||
43 | endif (SLPlugin_HEADER_FILES) | ||
44 | |||
28 | add_executable(SLPlugin | 45 | add_executable(SLPlugin |
29 | WIN32 | 46 | WIN32 |
47 | MACOSX_BUNDLE | ||
30 | ${SLPlugin_SOURCE_FILES} | 48 | ${SLPlugin_SOURCE_FILES} |
31 | ) | 49 | ) |
32 | 50 | ||
51 | set_target_properties(SLPlugin | ||
52 | PROPERTIES | ||
53 | MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist | ||
54 | ) | ||
55 | |||
33 | target_link_libraries(SLPlugin | 56 | target_link_libraries(SLPlugin |
34 | ${LLPLUGIN_LIBRARIES} | 57 | ${LLPLUGIN_LIBRARIES} |
35 | ${LLMESSAGE_LIBRARIES} | 58 | ${LLMESSAGE_LIBRARIES} |
@@ -44,12 +67,16 @@ add_dependencies(SLPlugin | |||
44 | ) | 67 | ) |
45 | 68 | ||
46 | if (DARWIN) | 69 | if (DARWIN) |
47 | # Mac version needs to link against carbon, and also needs an embedded plist (to set LSBackgroundOnly) | 70 | # Mac version needs to link against Carbon |
48 | target_link_libraries(SLPlugin ${CARBON_LIBRARY}) | 71 | target_link_libraries(SLPlugin ${CARBON_LIBRARY} ${COCOA_LIBRARY}) |
49 | set_target_properties( | 72 | # Make sure the app bundle has a Resources directory (it will get populated by viewer-manifest.py later) |
50 | SLPlugin | 73 | add_custom_command( |
51 | PROPERTIES | 74 | TARGET SLPlugin POST_BUILD |
52 | LINK_FLAGS "-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist" | 75 | COMMAND mkdir |
76 | ARGS | ||
77 | -p | ||
78 | ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/SLPlugin.app/Contents/Resources | ||
53 | ) | 79 | ) |
54 | endif (DARWIN) | 80 | endif (DARWIN) |
55 | 81 | ||
82 | #ll_deploy_sharedlibs_command(SLPlugin) | ||
diff --git a/linden/indra/llplugin/slplugin/slplugin-objc.h b/linden/indra/llplugin/slplugin/slplugin-objc.h new file mode 100644 index 0000000..42029e4 --- /dev/null +++ b/linden/indra/llplugin/slplugin/slplugin-objc.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /** | ||
2 | * @file slplugin-objc.h | ||
3 | * @brief Header file for slplugin-objc.mm. | ||
4 | * | ||
5 | * @cond | ||
6 | * | ||
7 | * $LicenseInfo:firstyear=2010&license=viewergpl$ | ||
8 | * | ||
9 | * Copyright (c) 2010, Linden Research, Inc. | ||
10 | * | ||
11 | * Second Life Viewer Source Code | ||
12 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
13 | * to you under the terms of the GNU General Public License, version 2.0 | ||
14 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
15 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
16 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
18 | * | ||
19 | * There are special exceptions to the terms and conditions of the GPL as | ||
20 | * it is applied to this Source Code. View the full text of the exception | ||
21 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
22 | * online at | ||
23 | * http://secondlife.com/developers/opensource/flossexception | ||
24 | * | ||
25 | * By copying, modifying or distributing this software, you acknowledge | ||
26 | * that you have read and understood your obligations described above, | ||
27 | * and agree to abide by those obligations. | ||
28 | * | ||
29 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
30 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
31 | * COMPLETENESS OR PERFORMANCE. | ||
32 | * $/LicenseInfo$ | ||
33 | * | ||
34 | * | ||
35 | * @endcond | ||
36 | */ | ||
37 | |||
38 | |||
39 | /* Defined in slplugin-objc.mm: */ | ||
40 | void setupCocoa(); | ||
41 | void createAutoReleasePool(); | ||
42 | void deleteAutoReleasePool(); | ||
diff --git a/linden/indra/llplugin/slplugin/slplugin-objc.mm b/linden/indra/llplugin/slplugin/slplugin-objc.mm new file mode 100644 index 0000000..125b264 --- /dev/null +++ b/linden/indra/llplugin/slplugin/slplugin-objc.mm | |||
@@ -0,0 +1,89 @@ | |||
1 | /** | ||
2 | * @file slplugin-objc.mm | ||
3 | * @brief Objective-C++ file for use with the loader shell, so we can use a couple of Cocoa APIs. | ||
4 | * | ||
5 | * @cond | ||
6 | * | ||
7 | * $LicenseInfo:firstyear=2010&license=viewergpl$ | ||
8 | * | ||
9 | * Copyright (c) 2010, Linden Research, Inc. | ||
10 | * | ||
11 | * Second Life Viewer Source Code | ||
12 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
13 | * to you under the terms of the GNU General Public License, version 2.0 | ||
14 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
15 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
16 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
18 | * | ||
19 | * There are special exceptions to the terms and conditions of the GPL as | ||
20 | * it is applied to this Source Code. View the full text of the exception | ||
21 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
22 | * online at | ||
23 | * http://secondlife.com/developers/opensource/flossexception | ||
24 | * | ||
25 | * By copying, modifying or distributing this software, you acknowledge | ||
26 | * that you have read and understood your obligations described above, | ||
27 | * and agree to abide by those obligations. | ||
28 | * | ||
29 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
30 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
31 | * COMPLETENESS OR PERFORMANCE. | ||
32 | * $/LicenseInfo$ | ||
33 | * | ||
34 | * | ||
35 | * @endcond | ||
36 | */ | ||
37 | |||
38 | |||
39 | #include <AppKit/AppKit.h> | ||
40 | |||
41 | #include "slplugin-objc.h" | ||
42 | |||
43 | |||
44 | void setupCocoa() | ||
45 | { | ||
46 | static bool inited = false; | ||
47 | |||
48 | if(!inited) | ||
49 | { | ||
50 | createAutoReleasePool(); | ||
51 | |||
52 | // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. | ||
53 | // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' | ||
54 | // when init'ing the Cocoa App window. | ||
55 | [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; | ||
56 | |||
57 | // This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor": | ||
58 | // http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html | ||
59 | |||
60 | // Needed for Carbon based applications which call into Cocoa | ||
61 | NSApplicationLoad(); | ||
62 | |||
63 | // Must first call [[[NSWindow alloc] init] release] to get the NSWindow machinery set up so that NSCursor can use a window to cache the cursor image | ||
64 | [[[NSWindow alloc] init] release]; | ||
65 | |||
66 | deleteAutoReleasePool(); | ||
67 | |||
68 | inited = true; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | static NSAutoreleasePool *sPool = NULL; | ||
73 | |||
74 | void createAutoReleasePool() | ||
75 | { | ||
76 | if(!sPool) | ||
77 | { | ||
78 | sPool = [[NSAutoreleasePool alloc] init]; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | void deleteAutoReleasePool() | ||
83 | { | ||
84 | if(sPool) | ||
85 | { | ||
86 | [sPool release]; | ||
87 | sPool = NULL; | ||
88 | } | ||
89 | } | ||
diff --git a/linden/indra/llplugin/slplugin/slplugin.cpp b/linden/indra/llplugin/slplugin/slplugin.cpp index 649d568..64c087b 100755 --- a/linden/indra/llplugin/slplugin/slplugin.cpp +++ b/linden/indra/llplugin/slplugin/slplugin.cpp | |||
@@ -46,6 +46,7 @@ | |||
46 | 46 | ||
47 | #if LL_DARWIN | 47 | #if LL_DARWIN |
48 | #include <Carbon/Carbon.h> | 48 | #include <Carbon/Carbon.h> |
49 | #include "slplugin-objc.h" | ||
49 | #endif | 50 | #endif |
50 | 51 | ||
51 | #if LL_DARWIN || LL_LINUX | 52 | #if LL_DARWIN || LL_LINUX |
@@ -53,7 +54,7 @@ | |||
53 | #endif | 54 | #endif |
54 | 55 | ||
55 | /* | 56 | /* |
56 | 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. | 57 | 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. |
57 | 58 | ||
58 | 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: | 59 | 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: |
59 | 60 | ||
@@ -62,7 +63,8 @@ | |||
62 | which means adding this to the gcc flags: | 63 | which means adding this to the gcc flags: |
63 | 64 | ||
64 | -Wl,-sectcreate,__TEXT,__info_plist,/path/to/slplugin_info.plist | 65 | -Wl,-sectcreate,__TEXT,__info_plist,/path/to/slplugin_info.plist |
65 | 66 | ||
67 | 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. | ||
66 | */ | 68 | */ |
67 | 69 | ||
68 | #if LL_DARWIN || LL_LINUX | 70 | #if LL_DARWIN || LL_LINUX |
@@ -230,10 +232,19 @@ int main(int argc, char **argv) | |||
230 | signal(SIGSYS, &crash_handler); // non-existent system call invoked | 232 | signal(SIGSYS, &crash_handler); // non-existent system call invoked |
231 | #endif | 233 | #endif |
232 | 234 | ||
235 | #if LL_DARWIN | ||
236 | setupCocoa(); | ||
237 | createAutoReleasePool(); | ||
238 | #endif | ||
239 | |||
233 | LLPluginProcessChild *plugin = new LLPluginProcessChild(); | 240 | LLPluginProcessChild *plugin = new LLPluginProcessChild(); |
234 | 241 | ||
235 | plugin->init(port); | 242 | plugin->init(port); |
236 | 243 | ||
244 | #if LL_DARWIN | ||
245 | deleteAutoReleasePool(); | ||
246 | #endif | ||
247 | |||
237 | LLTimer timer; | 248 | LLTimer timer; |
238 | timer.start(); | 249 | timer.start(); |
239 | 250 | ||
@@ -242,10 +253,28 @@ int main(int argc, char **argv) | |||
242 | #endif | 253 | #endif |
243 | 254 | ||
244 | #if LL_DARWIN | 255 | #if LL_DARWIN |
256 | // 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. | ||
257 | // Use this to track the current frontmost window and bring this process to the front if it changes. | ||
258 | WindowRef front_window = NULL; | ||
259 | WindowGroupRef layer_group = NULL; | ||
260 | int window_hack_state = 0; | ||
261 | CreateWindowGroup(kWindowGroupAttrFixedLevel, &layer_group); | ||
262 | if(layer_group) | ||
263 | { | ||
264 | // 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) | ||
265 | SetWindowGroupName(layer_group, CFSTR("SLPlugin Layer")); | ||
266 | SetWindowGroupLevel(layer_group, kCGOverlayWindowLevel); | ||
267 | } | ||
268 | #endif | ||
269 | |||
270 | #if LL_DARWIN | ||
245 | EventTargetRef event_target = GetEventDispatcherTarget(); | 271 | EventTargetRef event_target = GetEventDispatcherTarget(); |
246 | #endif | 272 | #endif |
247 | while(!plugin->isDone()) | 273 | while(!plugin->isDone()) |
248 | { | 274 | { |
275 | #if LL_DARWIN | ||
276 | createAutoReleasePool(); | ||
277 | #endif | ||
249 | timer.reset(); | 278 | timer.reset(); |
250 | plugin->idle(); | 279 | plugin->idle(); |
251 | #if LL_DARWIN | 280 | #if LL_DARWIN |
@@ -257,6 +286,80 @@ int main(int argc, char **argv) | |||
257 | SendEventToEventTarget (event, event_target); | 286 | SendEventToEventTarget (event, event_target); |
258 | ReleaseEvent(event); | 287 | ReleaseEvent(event); |
259 | } | 288 | } |
289 | |||
290 | // Check for a change in this process's frontmost window. | ||
291 | if(FrontWindow() != front_window) | ||
292 | { | ||
293 | ProcessSerialNumber self = { 0, kCurrentProcess }; | ||
294 | ProcessSerialNumber parent = { 0, kNoProcess }; | ||
295 | ProcessSerialNumber front = { 0, kNoProcess }; | ||
296 | Boolean this_is_front_process = false; | ||
297 | Boolean parent_is_front_process = false; | ||
298 | { | ||
299 | // Get this process's parent | ||
300 | ProcessInfoRec info; | ||
301 | info.processInfoLength = sizeof(ProcessInfoRec); | ||
302 | info.processName = NULL; | ||
303 | info.processAppSpec = NULL; | ||
304 | if(GetProcessInformation( &self, &info ) == noErr) | ||
305 | { | ||
306 | parent = info.processLauncher; | ||
307 | } | ||
308 | |||
309 | // and figure out whether this process or its parent are currently frontmost | ||
310 | if(GetFrontProcess(&front) == noErr) | ||
311 | { | ||
312 | (void) SameProcess(&self, &front, &this_is_front_process); | ||
313 | (void) SameProcess(&parent, &front, &parent_is_front_process); | ||
314 | } | ||
315 | } | ||
316 | |||
317 | if((FrontWindow() != NULL) && (front_window == NULL)) | ||
318 | { | ||
319 | // Opening the first window | ||
320 | |||
321 | if(window_hack_state == 0) | ||
322 | { | ||
323 | // Next time through the event loop, lower the window group layer | ||
324 | window_hack_state = 1; | ||
325 | } | ||
326 | |||
327 | if(layer_group) | ||
328 | { | ||
329 | SetWindowGroup(FrontWindow(), layer_group); | ||
330 | } | ||
331 | |||
332 | if(parent_is_front_process) | ||
333 | { | ||
334 | // Bring this process's windows to the front. | ||
335 | (void) SetFrontProcess( &self ); | ||
336 | } | ||
337 | |||
338 | ActivateWindow(FrontWindow(), true); | ||
339 | } | ||
340 | else if((FrontWindow() == NULL) && (front_window != NULL)) | ||
341 | { | ||
342 | // Closing the last window | ||
343 | |||
344 | if(this_is_front_process) | ||
345 | { | ||
346 | // Try to bring this process's parent to the front | ||
347 | (void) SetFrontProcess(&parent); | ||
348 | } | ||
349 | } | ||
350 | else if(window_hack_state == 1) | ||
351 | { | ||
352 | if(layer_group) | ||
353 | { | ||
354 | // Set the window group level back to something less extreme | ||
355 | SetWindowGroupLevel(layer_group, kCGNormalWindowLevel); | ||
356 | } | ||
357 | window_hack_state = 2; | ||
358 | } | ||
359 | |||
360 | front_window = FrontWindow(); | ||
361 | |||
362 | } | ||
260 | } | 363 | } |
261 | #endif | 364 | #endif |
262 | F64 elapsed = timer.getElapsedTimeF64(); | 365 | F64 elapsed = timer.getElapsedTimeF64(); |
@@ -289,6 +392,10 @@ int main(int argc, char **argv) | |||
289 | // exception handler such as QuickTime. | 392 | // exception handler such as QuickTime. |
290 | //checkExceptionHandler(); | 393 | //checkExceptionHandler(); |
291 | #endif | 394 | #endif |
395 | |||
396 | #if LL_DARWIN | ||
397 | deleteAutoReleasePool(); | ||
398 | #endif | ||
292 | } | 399 | } |
293 | 400 | ||
294 | delete plugin; | 401 | delete plugin; |
diff --git a/linden/indra/llplugin/slplugin/slplugin_info.plist b/linden/indra/llplugin/slplugin/slplugin_info.plist index b1daf87..c459738 100755 --- a/linden/indra/llplugin/slplugin/slplugin_info.plist +++ b/linden/indra/llplugin/slplugin/slplugin_info.plist | |||
@@ -6,7 +6,7 @@ | |||
6 | <string>English</string> | 6 | <string>English</string> |
7 | <key>CFBundleInfoDictionaryVersion</key> | 7 | <key>CFBundleInfoDictionaryVersion</key> |
8 | <string>6.0</string> | 8 | <string>6.0</string> |
9 | <key>LSBackgroundOnly</key> | 9 | <key>LSUIElement</key> |
10 | <true/> | 10 | <string>1</string> |
11 | </dict> | 11 | </dict> |
12 | </plist> | 12 | </plist> |