diff options
author | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
commit | e4b0e7c82d670081c071d8a3da31b5ec407b8e07 (patch) | |
tree | 9410962bbb582eedbec448139e217f2714050777 /linden/indra/llwindow | |
parent | Started 1.3.0 branch (diff) | |
parent | Updated and added some Linux libs. (diff) | |
download | meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.zip meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.gz meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.bz2 meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.xz |
Merged working branch of 1.2 into LL 1.23 merge
Diffstat (limited to 'linden/indra/llwindow')
-rw-r--r-- | linden/indra/llwindow/CMakeLists.txt | 1 | ||||
-rw-r--r-- | linden/indra/llwindow/llmousehandler.cpp | 59 | ||||
-rw-r--r-- | linden/indra/llwindow/llmousehandler.h | 21 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindow.cpp | 16 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindow.h | 7 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowsdl.cpp | 66 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowsdl.h | 6 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowwin32.cpp | 12 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowwin32.h | 1 |
9 files changed, 179 insertions, 10 deletions
diff --git a/linden/indra/llwindow/CMakeLists.txt b/linden/indra/llwindow/CMakeLists.txt index 95e315f..afce0c0 100644 --- a/linden/indra/llwindow/CMakeLists.txt +++ b/linden/indra/llwindow/CMakeLists.txt | |||
@@ -46,6 +46,7 @@ set(llwindows_HEADER_FILES | |||
46 | 46 | ||
47 | set(viewer_SOURCE_FILES | 47 | set(viewer_SOURCE_FILES |
48 | llwindow.cpp | 48 | llwindow.cpp |
49 | llmousehandler.cpp | ||
49 | ) | 50 | ) |
50 | 51 | ||
51 | set(viewer_HEADER_FILES | 52 | set(viewer_HEADER_FILES |
diff --git a/linden/indra/llwindow/llmousehandler.cpp b/linden/indra/llwindow/llmousehandler.cpp new file mode 100644 index 0000000..ae2f147 --- /dev/null +++ b/linden/indra/llwindow/llmousehandler.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | /** | ||
2 | * @file llmousehandler.cpp | ||
3 | * @brief LLMouseHandler class implementation | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at http://secondlife.com/developers/opensource/flossexception | ||
21 | * | ||
22 | * By copying, modifying or distributing this software, you acknowledge | ||
23 | * that you have read and understood your obligations described above, | ||
24 | * and agree to abide by those obligations. | ||
25 | * | ||
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
28 | * COMPLETENESS OR PERFORMANCE. | ||
29 | * $/LicenseInfo$ | ||
30 | */ | ||
31 | |||
32 | #include "llmousehandler.h" | ||
33 | |||
34 | //virtual | ||
35 | BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) | ||
36 | { | ||
37 | BOOL handled = FALSE; | ||
38 | if (down) | ||
39 | { | ||
40 | switch (clicktype) | ||
41 | { | ||
42 | case CLICK_LEFT: handled = handleMouseDown(x, y, mask); break; | ||
43 | case CLICK_RIGHT: handled = handleRightMouseDown(x, y, mask); break; | ||
44 | case CLICK_MIDDLE: handled = handleMiddleMouseDown(x, y, mask); break; | ||
45 | case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; | ||
46 | } | ||
47 | } | ||
48 | else | ||
49 | { | ||
50 | switch (clicktype) | ||
51 | { | ||
52 | case CLICK_LEFT: handled = handleMouseUp(x, y, mask); break; | ||
53 | case CLICK_RIGHT: handled = handleRightMouseUp(x, y, mask); break; | ||
54 | case CLICK_MIDDLE: handled = handleMiddleMouseUp(x, y, mask); break; | ||
55 | case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; | ||
56 | } | ||
57 | } | ||
58 | return handled; | ||
59 | } | ||
diff --git a/linden/indra/llwindow/llmousehandler.h b/linden/indra/llwindow/llmousehandler.h index f3a2edd..7bd0f2e 100644 --- a/linden/indra/llwindow/llmousehandler.h +++ b/linden/indra/llwindow/llmousehandler.h | |||
@@ -33,9 +33,10 @@ | |||
33 | #ifndef LL_MOUSEHANDLER_H | 33 | #ifndef LL_MOUSEHANDLER_H |
34 | #define LL_MOUSEHANDLER_H | 34 | #define LL_MOUSEHANDLER_H |
35 | 35 | ||
36 | #include "llstring.h" | 36 | #include "linden_common.h" |
37 | #include "llrect.h" | ||
37 | 38 | ||
38 | // Abstract interface. | 39 | // Mostly-abstract interface. |
39 | // Intended for use via multiple inheritance. | 40 | // Intended for use via multiple inheritance. |
40 | // A class may have as many interfaces as it likes, but never needs to inherit one more than once. | 41 | // A class may have as many interfaces as it likes, but never needs to inherit one more than once. |
41 | 42 | ||
@@ -49,13 +50,23 @@ public: | |||
49 | SHOW_IF_NOT_BLOCKED, | 50 | SHOW_IF_NOT_BLOCKED, |
50 | SHOW_ALWAYS, | 51 | SHOW_ALWAYS, |
51 | } EShowToolTip; | 52 | } EShowToolTip; |
53 | typedef enum { | ||
54 | CLICK_LEFT, | ||
55 | CLICK_MIDDLE, | ||
56 | CLICK_RIGHT, | ||
57 | CLICK_DOUBLELEFT | ||
58 | } EClickType; | ||
59 | virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down); | ||
52 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; | 60 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; |
53 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; | 61 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; |
54 | virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; | 62 | virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; |
55 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; | 63 | virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; |
56 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; | ||
57 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; | 64 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; |
58 | virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; | 65 | virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; |
66 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; | ||
67 | |||
68 | virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; | ||
69 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; | ||
59 | virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; | 70 | virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; |
60 | virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; | 71 | virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; |
61 | virtual const std::string& getName() const = 0; | 72 | virtual const std::string& getName() const = 0; |
diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp index fb4770e..53ca68d 100644 --- a/linden/indra/llwindow/llwindow.cpp +++ b/linden/indra/llwindow/llwindow.cpp | |||
@@ -308,6 +308,22 @@ void *LLWindow::getMediaWindow() | |||
308 | return getPlatformWindow(); | 308 | return getPlatformWindow(); |
309 | } | 309 | } |
310 | 310 | ||
311 | //virtual | ||
312 | BOOL LLWindow::isPrimaryTextAvailable() | ||
313 | { | ||
314 | return FALSE; // no | ||
315 | } | ||
316 | //virtual | ||
317 | BOOL LLWindow::pasteTextFromPrimary(LLWString &dst) | ||
318 | { | ||
319 | return FALSE; // fail | ||
320 | } | ||
321 | // virtual | ||
322 | BOOL LLWindow::copyTextToPrimary(const LLWString &src) | ||
323 | { | ||
324 | return FALSE; // fail | ||
325 | } | ||
326 | |||
311 | // static | 327 | // static |
312 | std::vector<std::string> LLWindow::getDynamicFallbackFontList() | 328 | std::vector<std::string> LLWindow::getDynamicFallbackFontList() |
313 | { | 329 | { |
diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h index 9e01596..a649766 100644 --- a/linden/indra/llwindow/llwindow.h +++ b/linden/indra/llwindow/llwindow.h | |||
@@ -144,9 +144,15 @@ public: | |||
144 | virtual void captureMouse() = 0; | 144 | virtual void captureMouse() = 0; |
145 | virtual void releaseMouse() = 0; | 145 | virtual void releaseMouse() = 0; |
146 | virtual void setMouseClipping( BOOL b ) = 0; | 146 | virtual void setMouseClipping( BOOL b ) = 0; |
147 | |||
147 | virtual BOOL isClipboardTextAvailable() = 0; | 148 | virtual BOOL isClipboardTextAvailable() = 0; |
148 | virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0; | 149 | virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0; |
149 | virtual BOOL copyTextToClipboard(const LLWString &src) = 0; | 150 | virtual BOOL copyTextToClipboard(const LLWString &src) = 0; |
151 | |||
152 | virtual BOOL isPrimaryTextAvailable(); | ||
153 | virtual BOOL pasteTextFromPrimary(LLWString &dst); | ||
154 | virtual BOOL copyTextToPrimary(const LLWString &src); | ||
155 | |||
150 | virtual void flashIcon(F32 seconds) = 0; | 156 | virtual void flashIcon(F32 seconds) = 0; |
151 | virtual F32 getGamma() = 0; | 157 | virtual F32 getGamma() = 0; |
152 | virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma | 158 | virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma |
@@ -197,6 +203,7 @@ public: | |||
197 | virtual void updateLanguageTextInputArea() {} | 203 | virtual void updateLanguageTextInputArea() {} |
198 | virtual void interruptLanguageTextInput() {} | 204 | virtual void interruptLanguageTextInput() {} |
199 | virtual void spawnWebBrowser(const std::string& escaped_url) {}; | 205 | virtual void spawnWebBrowser(const std::string& escaped_url) {}; |
206 | virtual void ShellEx(const std::string& command) {}; | ||
200 | 207 | ||
201 | static std::vector<std::string> getDynamicFallbackFontList(); | 208 | static std::vector<std::string> getDynamicFallbackFontList(); |
202 | 209 | ||
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index f9c170e..4dd0550 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp | |||
@@ -1230,7 +1230,6 @@ void LLWindowSDL::flashIcon(F32 seconds) | |||
1230 | #endif // LL_X11 | 1230 | #endif // LL_X11 |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | |||
1234 | #if LL_GTK | 1233 | #if LL_GTK |
1235 | BOOL LLWindowSDL::isClipboardTextAvailable() | 1234 | BOOL LLWindowSDL::isClipboardTextAvailable() |
1236 | { | 1235 | { |
@@ -1274,22 +1273,80 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text) | |||
1274 | return FALSE; // failure | 1273 | return FALSE; // failure |
1275 | } | 1274 | } |
1276 | 1275 | ||
1277 | #else | 1276 | BOOL LLWindowSDL::isPrimaryTextAvailable() |
1277 | { | ||
1278 | if (ll_try_gtk_init()) | ||
1279 | { | ||
1280 | GtkClipboard * const clipboard = | ||
1281 | gtk_clipboard_get(GDK_SELECTION_PRIMARY); | ||
1282 | return gtk_clipboard_wait_is_text_available(clipboard) ? | ||
1283 | TRUE : FALSE; | ||
1284 | } | ||
1285 | return FALSE; // failure | ||
1286 | } | ||
1287 | |||
1288 | BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &text) | ||
1289 | { | ||
1290 | if (ll_try_gtk_init()) | ||
1291 | { | ||
1292 | GtkClipboard * const clipboard = | ||
1293 | gtk_clipboard_get(GDK_SELECTION_PRIMARY); | ||
1294 | gchar * const data = gtk_clipboard_wait_for_text(clipboard); | ||
1295 | if (data) | ||
1296 | { | ||
1297 | text = LLWString(utf8str_to_wstring(data)); | ||
1298 | g_free(data); | ||
1299 | return TRUE; | ||
1300 | } | ||
1301 | } | ||
1302 | return FALSE; // failure | ||
1303 | } | ||
1278 | 1304 | ||
1305 | BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text) | ||
1306 | { | ||
1307 | if (ll_try_gtk_init()) | ||
1308 | { | ||
1309 | const std::string utf8 = wstring_to_utf8str(text); | ||
1310 | GtkClipboard * const clipboard = | ||
1311 | gtk_clipboard_get(GDK_SELECTION_PRIMARY); | ||
1312 | gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length()); | ||
1313 | return TRUE; | ||
1314 | } | ||
1315 | return FALSE; // failure | ||
1316 | } | ||
1317 | |||
1318 | #else | ||
1319 | |||
1279 | BOOL LLWindowSDL::isClipboardTextAvailable() | 1320 | BOOL LLWindowSDL::isClipboardTextAvailable() |
1280 | { | 1321 | { |
1281 | return FALSE; // unsupported | 1322 | return FALSE; // unsupported |
1282 | } | 1323 | } |
1283 | 1324 | ||
1284 | BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) | 1325 | BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) |
1285 | { | 1326 | { |
1286 | return FALSE; // unsupported | 1327 | return FALSE; // unsupported |
1287 | } | 1328 | } |
1329 | |||
1288 | 1330 | ||
1289 | BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) | 1331 | BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) |
1290 | { | 1332 | { |
1291 | return FALSE; // unsupported | 1333 | return FALSE; // unsupported |
1292 | } | 1334 | } |
1335 | |||
1336 | BOOL LLWindowSDL::isPrimaryTextAvailable() | ||
1337 | { | ||
1338 | return FALSE; // unsupported | ||
1339 | } | ||
1340 | |||
1341 | BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst) | ||
1342 | { | ||
1343 | return FALSE; // unsupported | ||
1344 | } | ||
1345 | |||
1346 | BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s) | ||
1347 | { | ||
1348 | return FALSE; // unsupported | ||
1349 | } | ||
1293 | #endif // LL_GTK | 1350 | #endif // LL_GTK |
1294 | 1351 | ||
1295 | LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions) | 1352 | LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions) |
@@ -2092,8 +2149,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ | |||
2092 | buttons = GTK_BUTTONS_YES_NO; | 2149 | buttons = GTK_BUTTONS_YES_NO; |
2093 | break; | 2150 | break; |
2094 | } | 2151 | } |
2095 | win = gtk_message_dialog_new(NULL, flags, messagetype, buttons, "%s", | 2152 | win = gtk_message_dialog_new(NULL,flags, messagetype, buttons, "%s", text.c_str()); |
2096 | text.c_str()); | ||
2097 | 2153 | ||
2098 | # if LL_X11 | 2154 | # if LL_X11 |
2099 | // Make GTK tell the window manager to associate this | 2155 | // Make GTK tell the window manager to associate this |
diff --git a/linden/indra/llwindow/llwindowsdl.h b/linden/indra/llwindow/llwindowsdl.h index cebb151..632d8fc 100644 --- a/linden/indra/llwindow/llwindowsdl.h +++ b/linden/indra/llwindow/llwindowsdl.h | |||
@@ -80,9 +80,15 @@ public: | |||
80 | /*virtual*/ void captureMouse(); | 80 | /*virtual*/ void captureMouse(); |
81 | /*virtual*/ void releaseMouse(); | 81 | /*virtual*/ void releaseMouse(); |
82 | /*virtual*/ void setMouseClipping( BOOL b ); | 82 | /*virtual*/ void setMouseClipping( BOOL b ); |
83 | |||
83 | /*virtual*/ BOOL isClipboardTextAvailable(); | 84 | /*virtual*/ BOOL isClipboardTextAvailable(); |
84 | /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); | 85 | /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); |
85 | /*virtual*/ BOOL copyTextToClipboard(const LLWString & src); | 86 | /*virtual*/ BOOL copyTextToClipboard(const LLWString & src); |
87 | |||
88 | /*virtual*/ BOOL isPrimaryTextAvailable(); | ||
89 | /*virtual*/ BOOL pasteTextFromPrimary(LLWString &dst); | ||
90 | /*virtual*/ BOOL copyTextToPrimary(const LLWString & src); | ||
91 | |||
86 | /*virtual*/ void flashIcon(F32 seconds); | 92 | /*virtual*/ void flashIcon(F32 seconds); |
87 | /*virtual*/ F32 getGamma(); | 93 | /*virtual*/ F32 getGamma(); |
88 | /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma | 94 | /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma |
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp index 6280868..b2826c8 100644 --- a/linden/indra/llwindow/llwindowwin32.cpp +++ b/linden/indra/llwindow/llwindowwin32.cpp | |||
@@ -2918,6 +2918,18 @@ S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 t | |||
2918 | return retval; | 2918 | return retval; |
2919 | } | 2919 | } |
2920 | 2920 | ||
2921 | void LLWindowWin32::ShellEx(const std::string& command ) | ||
2922 | { | ||
2923 | LLWString url_wstring = utf8str_to_wstring( command ); | ||
2924 | llutf16string url_utf16 = wstring_to_utf16str( url_wstring ); | ||
2925 | |||
2926 | SHELLEXECUTEINFO sei = { sizeof( sei ) }; | ||
2927 | sei.fMask = SEE_MASK_FLAG_DDEWAIT; | ||
2928 | sei.nShow = SW_SHOWNORMAL; | ||
2929 | sei.lpVerb = L"open"; | ||
2930 | sei.lpFile = url_utf16.c_str(); | ||
2931 | ShellExecuteEx( &sei ); | ||
2932 | } | ||
2921 | 2933 | ||
2922 | void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) | 2934 | void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) |
2923 | { | 2935 | { |
diff --git a/linden/indra/llwindow/llwindowwin32.h b/linden/indra/llwindow/llwindowwin32.h index 237f834..d3ae325 100644 --- a/linden/indra/llwindow/llwindowwin32.h +++ b/linden/indra/llwindow/llwindowwin32.h | |||
@@ -111,6 +111,7 @@ public: | |||
111 | /*virtual*/ void updateLanguageTextInputArea(); | 111 | /*virtual*/ void updateLanguageTextInputArea(); |
112 | /*virtual*/ void interruptLanguageTextInput(); | 112 | /*virtual*/ void interruptLanguageTextInput(); |
113 | /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); | 113 | /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); |
114 | /*virtual*/ void ShellEx(const std::string& command); | ||
114 | 115 | ||
115 | static std::vector<std::string> getDynamicFallbackFontList(); | 116 | static std::vector<std::string> getDynamicFallbackFontList(); |
116 | 117 | ||