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/media_plugins/webkit/media_plugin_webkit.cpp | |
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/media_plugins/webkit/media_plugin_webkit.cpp')
-rwxr-xr-x | linden/indra/media_plugins/webkit/media_plugin_webkit.cpp | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp b/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp index 09ba8dc..f9b6451 100755 --- a/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp | |||
@@ -49,13 +49,15 @@ | |||
49 | #if LL_LINUX | 49 | #if LL_LINUX |
50 | # include <iomanip> | 50 | # include <iomanip> |
51 | # define LL_QTWEBKIT_USES_PIXMAPS 0 | 51 | # define LL_QTWEBKIT_USES_PIXMAPS 0 |
52 | extern "C" { | ||
53 | # include <glib.h> | ||
54 | # include <glib-object.h> | ||
55 | } | ||
52 | #else | 56 | #else |
53 | # define LL_QTWEBKIT_USES_PIXMAPS 0 | 57 | # define LL_QTWEBKIT_USES_PIXMAPS 0 |
54 | #endif // LL_LINUX | 58 | #endif // LL_LINUX |
55 | 59 | ||
56 | #if LL_LINUX | 60 | # include "volume_catcher.h" |
57 | # include "linux_volume_catcher.h" | ||
58 | #endif // LL_LINUX | ||
59 | 61 | ||
60 | #if LL_WINDOWS | 62 | #if LL_WINDOWS |
61 | # include <direct.h> | 63 | # include <direct.h> |
@@ -65,7 +67,7 @@ | |||
65 | #endif | 67 | #endif |
66 | 68 | ||
67 | #if LL_WINDOWS | 69 | #if LL_WINDOWS |
68 | // *NOTE:Mani - This captures the module handle fo rthe dll. This is used below | 70 | // *NOTE:Mani - This captures the module handle for the dll. This is used below |
69 | // to get the path to this dll for webkit initialization. | 71 | // to get the path to this dll for webkit initialization. |
70 | // I don't know how/if this can be done with apr... | 72 | // I don't know how/if this can be done with apr... |
71 | namespace { HMODULE gModuleHandle;}; | 73 | namespace { HMODULE gModuleHandle;}; |
@@ -122,9 +124,7 @@ private: | |||
122 | F32 mBackgroundG; | 124 | F32 mBackgroundG; |
123 | F32 mBackgroundB; | 125 | F32 mBackgroundB; |
124 | 126 | ||
125 | #if LL_LINUX | 127 | VolumeCatcher mVolumeCatcher; |
126 | LinuxVolumeCatcher mLinuxVolumeCatcher; | ||
127 | #endif // LL_LINUX | ||
128 | 128 | ||
129 | void setInitState(int state) | 129 | void setInitState(int state) |
130 | { | 130 | { |
@@ -136,11 +136,19 @@ private: | |||
136 | // | 136 | // |
137 | void update(int milliseconds) | 137 | void update(int milliseconds) |
138 | { | 138 | { |
139 | #if LL_QTLINUX_DOESNT_HAVE_GLIB | ||
140 | // pump glib generously, as Linux browser plugins are on the | ||
141 | // glib main loop, even if the browser itself isn't - ugh | ||
142 | // This is NOT NEEDED if Qt itself was built with glib | ||
143 | // mainloop integration. | ||
144 | GMainContext *mainc = g_main_context_default(); | ||
145 | while(g_main_context_iteration(mainc, FALSE)); | ||
146 | #endif // LL_QTLINUX_DOESNT_HAVE_GLIB | ||
147 | |||
148 | // pump qt | ||
139 | LLQtWebKit::getInstance()->pump( milliseconds ); | 149 | LLQtWebKit::getInstance()->pump( milliseconds ); |
140 | 150 | ||
141 | #if LL_LINUX | 151 | mVolumeCatcher.pump(); |
142 | mLinuxVolumeCatcher.pump(); | ||
143 | #endif // LL_LINUX | ||
144 | 152 | ||
145 | checkEditState(); | 153 | checkEditState(); |
146 | 154 | ||
@@ -209,6 +217,14 @@ private: | |||
209 | } | 217 | } |
210 | std::string application_dir = std::string( cwd ); | 218 | std::string application_dir = std::string( cwd ); |
211 | 219 | ||
220 | #if LL_LINUX | ||
221 | // take care to initialize glib properly, because some | ||
222 | // versions of Qt don't, and we indirectly need it for (some | ||
223 | // versions of) Flash to not crash the browser. | ||
224 | if (!g_thread_supported ()) g_thread_init (NULL); | ||
225 | g_type_init(); | ||
226 | #endif | ||
227 | |||
212 | #if LL_DARWIN | 228 | #if LL_DARWIN |
213 | // When running under the Xcode debugger, there's a setting called "Break on Debugger()/DebugStr()" which defaults to being turned on. | 229 | // When running under the Xcode debugger, there's a setting called "Break on Debugger()/DebugStr()" which defaults to being turned on. |
214 | // This causes the environment variable USERBREAK to be set to 1, which causes these legacy calls to break into the debugger. | 230 | // This causes the environment variable USERBREAK to be set to 1, which causes these legacy calls to break into the debugger. |
@@ -306,11 +322,14 @@ private: | |||
306 | // append details to agent string | 322 | // append details to agent string |
307 | LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); | 323 | LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); |
308 | 324 | ||
325 | // Set up window open behavior | ||
326 | LLQtWebKit::getInstance()->setWindowOpenBehavior(mBrowserWindowId, LLQtWebKit::WOB_SIMULATE_BLANK_HREF_CLICK); | ||
327 | |||
309 | #if !LL_QTWEBKIT_USES_PIXMAPS | 328 | #if !LL_QTWEBKIT_USES_PIXMAPS |
310 | // don't flip bitmap | 329 | // don't flip bitmap |
311 | LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true ); | 330 | LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true ); |
312 | #endif // !LL_QTWEBKIT_USES_PIXMAPS | 331 | #endif // !LL_QTWEBKIT_USES_PIXMAPS |
313 | 332 | ||
314 | // set background color | 333 | // set background color |
315 | // convert background color channels from [0.0, 1.0] to [0, 255]; | 334 | // convert background color channels from [0.0, 1.0] to [0, 255]; |
316 | LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) ); | 335 | LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) ); |
@@ -511,6 +530,19 @@ private: | |||
511 | sendMessage(message); | 530 | sendMessage(message); |
512 | } | 531 | } |
513 | 532 | ||
533 | |||
534 | //////////////////////////////////////////////////////////////////////////////// | ||
535 | // virtual | ||
536 | void onCookieChanged(const EventType& event) | ||
537 | { | ||
538 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "cookie_set"); | ||
539 | message.setValue("cookie", event.getStringValue()); | ||
540 | // These could be passed through as well, but aren't really needed. | ||
541 | // message.setValue("uri", event.getEventUri()); | ||
542 | // message.setValueBoolean("dead", (event.getIntValue() != 0)) | ||
543 | sendMessage(message); | ||
544 | } | ||
545 | |||
514 | LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers) | 546 | LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers) |
515 | { | 547 | { |
516 | int result = 0; | 548 | int result = 0; |
@@ -1056,6 +1088,10 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) | |||
1056 | mJavascriptEnabled = message_in.getValueBoolean("enable"); | 1088 | mJavascriptEnabled = message_in.getValueBoolean("enable"); |
1057 | //LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); | 1089 | //LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); |
1058 | } | 1090 | } |
1091 | else if(message_name == "set_cookies") | ||
1092 | { | ||
1093 | LLQtWebKit::getInstance()->setCookies(message_in.getValue("cookies")); | ||
1094 | } | ||
1059 | else if(message_name == "proxy_setup") | 1095 | else if(message_name == "proxy_setup") |
1060 | { | 1096 | { |
1061 | bool val = message_in.getValueBoolean("enable"); | 1097 | bool val = message_in.getValueBoolean("enable"); |
@@ -1125,9 +1161,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) | |||
1125 | 1161 | ||
1126 | void MediaPluginWebKit::setVolume(F32 volume) | 1162 | void MediaPluginWebKit::setVolume(F32 volume) |
1127 | { | 1163 | { |
1128 | #if LL_LINUX | 1164 | mVolumeCatcher.setVolume(volume); |
1129 | mLinuxVolumeCatcher.setVolume(volume); | ||
1130 | #endif // LL_LINUX | ||
1131 | } | 1165 | } |
1132 | 1166 | ||
1133 | int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) | 1167 | int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) |