diff options
Diffstat (limited to 'linden/indra/llwindow')
-rw-r--r-- | linden/indra/llwindow/llwindow.cpp | 6 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindow.h | 1 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowsdl.cpp | 65 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowsdl.h | 25 |
4 files changed, 55 insertions, 42 deletions
diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp index e8b0a1b..9ce227b 100644 --- a/linden/indra/llwindow/llwindow.cpp +++ b/linden/indra/llwindow/llwindow.cpp | |||
@@ -321,6 +321,12 @@ std::string LLWindow::getFontListSans() | |||
321 | #endif | 321 | #endif |
322 | } | 322 | } |
323 | 323 | ||
324 | //virtual | ||
325 | void LLWindow::processMiscNativeEvents() | ||
326 | { | ||
327 | // do nothing unless subclassed | ||
328 | } | ||
329 | |||
324 | #define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400) | 330 | #define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400) |
325 | #define UTF16_IS_LOW_SURROGATE(U) ((U16)((U) - 0xDC00) < 0x0400) | 331 | #define UTF16_IS_LOW_SURROGATE(U) ((U16)((U) - 0xDC00) < 0x0400) |
326 | #define UTF16_SURROGATE_PAIR_TO_UTF32(H,L) (((H) << 10) + (L) - (0xD800 << 10) - 0xDC00 + 0x00010000) | 332 | #define UTF16_SURROGATE_PAIR_TO_UTF32(H,L) (((H) << 10) + (L) - (0xD800 << 10) - 0xDC00 + 0x00010000) |
diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h index 7e948b9..e2c28a2 100644 --- a/linden/indra/llwindow/llwindow.h +++ b/linden/indra/llwindow/llwindow.h | |||
@@ -194,6 +194,7 @@ public: | |||
194 | virtual U32 getFSAASamples() = 0; | 194 | virtual U32 getFSAASamples() = 0; |
195 | virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma) | 195 | virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma) |
196 | virtual ESwapMethod getSwapMethod() { return mSwapMethod; } | 196 | virtual ESwapMethod getSwapMethod() { return mSwapMethod; } |
197 | virtual void processMiscNativeEvents(); | ||
197 | virtual void gatherInput() = 0; | 198 | virtual void gatherInput() = 0; |
198 | virtual void delayInputProcessing() = 0; | 199 | virtual void delayInputProcessing() = 0; |
199 | virtual void swapBuffers() = 0; | 200 | virtual void swapBuffers() = 0; |
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index e5d15c4..361126d 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp | |||
@@ -104,7 +104,8 @@ void maybe_unlock_display(void) | |||
104 | 104 | ||
105 | #if LL_GTK | 105 | #if LL_GTK |
106 | // Lazily initialize and check the runtime GTK version for goodness. | 106 | // Lazily initialize and check the runtime GTK version for goodness. |
107 | BOOL ll_try_gtk_init(void) | 107 | // static |
108 | bool LLWindowSDL::ll_try_gtk_init(void) | ||
108 | { | 109 | { |
109 | static BOOL done_gtk_diag = FALSE; | 110 | static BOOL done_gtk_diag = FALSE; |
110 | static BOOL gtk_is_good = FALSE; | 111 | static BOOL gtk_is_good = FALSE; |
@@ -166,7 +167,8 @@ BOOL ll_try_gtk_init(void) | |||
166 | 167 | ||
167 | 168 | ||
168 | #if LL_X11 | 169 | #if LL_X11 |
169 | Window get_SDL_XWindowID(void) | 170 | // static |
171 | Window LLWindowSDL::get_SDL_XWindowID(void) | ||
170 | { | 172 | { |
171 | if (gWindowImplementation) { | 173 | if (gWindowImplementation) { |
172 | return gWindowImplementation->mSDL_XWindowID; | 174 | return gWindowImplementation->mSDL_XWindowID; |
@@ -174,7 +176,8 @@ Window get_SDL_XWindowID(void) | |||
174 | return None; | 176 | return None; |
175 | } | 177 | } |
176 | 178 | ||
177 | Display* get_SDL_Display(void) | 179 | //static |
180 | Display* LLWindowSDL::get_SDL_Display(void) | ||
178 | { | 181 | { |
179 | if (gWindowImplementation) { | 182 | if (gWindowImplementation) { |
180 | return gWindowImplementation->mSDL_Display; | 183 | return gWindowImplementation->mSDL_Display; |
@@ -1235,7 +1238,7 @@ typedef Atom x11clipboard_type; | |||
1235 | */ | 1238 | */ |
1236 | static x11clipboard_type get_x11_readwrite_clipboard_type(void) | 1239 | static x11clipboard_type get_x11_readwrite_clipboard_type(void) |
1237 | { | 1240 | { |
1238 | return XInternAtom(get_SDL_Display(), "CLIPBOARD", False); | 1241 | return XInternAtom(LLWindowSDL::get_SDL_Display(), "CLIPBOARD", False); |
1239 | } | 1242 | } |
1240 | 1243 | ||
1241 | static x11clipboard_type get_x11_write_clipboard_type(void) | 1244 | static x11clipboard_type get_x11_write_clipboard_type(void) |
@@ -1248,18 +1251,18 @@ static x11clipboard_type get_x11_write_clipboard_type(void) | |||
1248 | storage because their use isn't really defined for holding UTF8. */ | 1251 | storage because their use isn't really defined for holding UTF8. */ |
1249 | static x11clipboard_type get_x11_cutbuffer_clipboard_type(void) | 1252 | static x11clipboard_type get_x11_cutbuffer_clipboard_type(void) |
1250 | { | 1253 | { |
1251 | return XInternAtom(get_SDL_Display(), "SECONDLIFE_CUTBUFFER", False); | 1254 | return XInternAtom(LLWindowSDL::get_SDL_Display(), "SECONDLIFE_CUTBUFFER", False); |
1252 | } | 1255 | } |
1253 | 1256 | ||
1254 | /* Some X11 atom-generators */ | 1257 | /* Some X11 atom-generators */ |
1255 | static Atom get_x11_targets_atom(void) | 1258 | static Atom get_x11_targets_atom(void) |
1256 | { | 1259 | { |
1257 | return XInternAtom(get_SDL_Display(), "TARGETS", False); | 1260 | return XInternAtom(LLWindowSDL::get_SDL_Display(), "TARGETS", False); |
1258 | } | 1261 | } |
1259 | 1262 | ||
1260 | static Atom get_x11_text_atom(void) | 1263 | static Atom get_x11_text_atom(void) |
1261 | { | 1264 | { |
1262 | return XInternAtom(get_SDL_Display(), "TEXT", False); | 1265 | return XInternAtom(LLWindowSDL::get_SDL_Display(), "TEXT", False); |
1263 | } | 1266 | } |
1264 | 1267 | ||
1265 | /* These defines, and convert_data/convert_x11clipboard, | 1268 | /* These defines, and convert_data/convert_x11clipboard, |
@@ -1544,7 +1547,7 @@ int clipboard_filter_callback(const SDL_Event *event) | |||
1544 | sevent.xselection.property = None; | 1547 | sevent.xselection.property = None; |
1545 | sevent.xselection.requestor = req->requestor; | 1548 | sevent.xselection.requestor = req->requestor; |
1546 | sevent.xselection.time = req->time; | 1549 | sevent.xselection.time = req->time; |
1547 | if ( XGetWindowProperty(get_SDL_Display(), DefaultRootWindow(get_SDL_Display()), | 1550 | if ( XGetWindowProperty(LLWindowSDL::get_SDL_Display(), DefaultRootWindow(LLWindowSDL::get_SDL_Display()), |
1548 | get_x11_cutbuffer_clipboard_type(), 0, INT_MAX/4, False, req->target, | 1551 | get_x11_cutbuffer_clipboard_type(), 0, INT_MAX/4, False, req->target, |
1549 | &sevent.xselection.target, &seln_format, | 1552 | &sevent.xselection.target, &seln_format, |
1550 | &nbytes, &overflow, &seln_data) == Success ) | 1553 | &nbytes, &overflow, &seln_data) == Success ) |
@@ -1558,7 +1561,7 @@ int clipboard_filter_callback(const SDL_Event *event) | |||
1558 | if ( seln_data[nbytes-1] == '\0' ) | 1561 | if ( seln_data[nbytes-1] == '\0' ) |
1559 | --nbytes; | 1562 | --nbytes; |
1560 | } | 1563 | } |
1561 | XChangeProperty(get_SDL_Display(), req->requestor, req->property, | 1564 | XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor, req->property, |
1562 | req->target, seln_format, PropModeReplace, | 1565 | req->target, seln_format, PropModeReplace, |
1563 | seln_data, nbytes); | 1566 | seln_data, nbytes); |
1564 | sevent.xselection.property = req->property; | 1567 | sevent.xselection.property = req->property; |
@@ -1571,7 +1574,7 @@ int clipboard_filter_callback(const SDL_Event *event) | |||
1571 | get_x11_targets_atom() | 1574 | get_x11_targets_atom() |
1572 | }; | 1575 | }; |
1573 | supported[0] = sevent.xselection.target; | 1576 | supported[0] = sevent.xselection.target; |
1574 | XChangeProperty(get_SDL_Display(), req->requestor, | 1577 | XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor, |
1575 | req->property, XA_ATOM, 32, PropModeReplace, | 1578 | req->property, XA_ATOM, 32, PropModeReplace, |
1576 | (unsigned char*)supported, | 1579 | (unsigned char*)supported, |
1577 | num_supported); | 1580 | num_supported); |
@@ -1584,10 +1587,10 @@ int clipboard_filter_callback(const SDL_Event *event) | |||
1584 | XFree(seln_data); | 1587 | XFree(seln_data); |
1585 | } | 1588 | } |
1586 | int sendret = | 1589 | int sendret = |
1587 | XSendEvent(get_SDL_Display(),req->requestor,False,0,&sevent); | 1590 | XSendEvent(LLWindowSDL::get_SDL_Display(),req->requestor,False,0,&sevent); |
1588 | if ((sendret==BadValue) || (sendret==BadWindow)) | 1591 | if ((sendret==BadValue) || (sendret==BadWindow)) |
1589 | llwarns << "Clipboard SendEvent failed" << llendl; | 1592 | llwarns << "Clipboard SendEvent failed" << llendl; |
1590 | XSync(get_SDL_Display(), False); | 1593 | XSync(LLWindowSDL::get_SDL_Display(), False); |
1591 | } | 1594 | } |
1592 | break; | 1595 | break; |
1593 | } | 1596 | } |
@@ -1959,17 +1962,14 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain) | |||
1959 | return mGrabbyKeyFlags; | 1962 | return mGrabbyKeyFlags; |
1960 | } | 1963 | } |
1961 | 1964 | ||
1962 | void LLWindowSDL::gatherInput() | 1965 | // virtual |
1966 | void LLWindowSDL::processMiscNativeEvents() | ||
1963 | { | 1967 | { |
1964 | const Uint32 CLICK_THRESHOLD = 300; // milliseconds | 1968 | #if LL_GTK && (LL_LLMOZLIB_ENABLED || LL_DBUS_ENABLED) |
1965 | static int leftClick = 0; | 1969 | // Pump GTK events to avoid starvation for: |
1966 | static int rightClick = 0; | 1970 | // * Embedded Gecko |
1967 | static Uint32 lastLeftDown = 0; | 1971 | // * DBUS servicing |
1968 | static Uint32 lastRightDown = 0; | 1972 | // * Anything else which quietly hooks into the default glib/GTK loop |
1969 | SDL_Event event; | ||
1970 | |||
1971 | #if LL_GTK && LL_LLMOZLIB_ENABLED | ||
1972 | // Pump GTK events so embedded Gecko doesn't starve. | ||
1973 | if (ll_try_gtk_init()) | 1973 | if (ll_try_gtk_init()) |
1974 | { | 1974 | { |
1975 | // Yuck, Mozilla's GTK callbacks play with the locale - push/pop | 1975 | // Yuck, Mozilla's GTK callbacks play with the locale - push/pop |
@@ -1992,7 +1992,17 @@ void LLWindowSDL::gatherInput() | |||
1992 | 1992 | ||
1993 | setlocale(LC_ALL, saved_locale.c_str() ); | 1993 | setlocale(LC_ALL, saved_locale.c_str() ); |
1994 | } | 1994 | } |
1995 | #endif // LL_GTK && LL_LLMOZLIB_ENABLED | 1995 | #endif // LL_GTK && (LL_LLMOZLIB_ENABLED || LL_DBUS_ENABLED) |
1996 | } | ||
1997 | |||
1998 | void LLWindowSDL::gatherInput() | ||
1999 | { | ||
2000 | const Uint32 CLICK_THRESHOLD = 300; // milliseconds | ||
2001 | static int leftClick = 0; | ||
2002 | static int rightClick = 0; | ||
2003 | static Uint32 lastLeftDown = 0; | ||
2004 | static Uint32 lastRightDown = 0; | ||
2005 | SDL_Event event; | ||
1996 | 2006 | ||
1997 | // Handle all outstanding SDL events | 2007 | // Handle all outstanding SDL events |
1998 | while (SDL_PollEvent(&event)) | 2008 | while (SDL_PollEvent(&event)) |
@@ -2497,12 +2507,10 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ | |||
2497 | { | 2507 | { |
2498 | S32 rtn = OSBTN_CANCEL; | 2508 | S32 rtn = OSBTN_CANCEL; |
2499 | 2509 | ||
2500 | ll_try_gtk_init(); | ||
2501 | |||
2502 | if(gWindowImplementation != NULL) | 2510 | if(gWindowImplementation != NULL) |
2503 | gWindowImplementation->beforeDialog(); | 2511 | gWindowImplementation->beforeDialog(); |
2504 | 2512 | ||
2505 | if (ll_try_gtk_init() | 2513 | if (LLWindowSDL::ll_try_gtk_init() |
2506 | // We can NOT expect to combine GTK and SDL's aggressive fullscreen | 2514 | // We can NOT expect to combine GTK and SDL's aggressive fullscreen |
2507 | && ((NULL==gWindowImplementation) || (!was_fullscreen)) | 2515 | && ((NULL==gWindowImplementation) || (!was_fullscreen)) |
2508 | ) | 2516 | ) |
@@ -2530,7 +2538,8 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ | |||
2530 | buttons = GTK_BUTTONS_YES_NO; | 2538 | buttons = GTK_BUTTONS_YES_NO; |
2531 | break; | 2539 | break; |
2532 | } | 2540 | } |
2533 | win = gtk_message_dialog_new(NULL,flags, messagetype, buttons, text.c_str()); | 2541 | win = gtk_message_dialog_new(NULL, flags, messagetype, buttons, "%s", |
2542 | text.c_str()); | ||
2534 | 2543 | ||
2535 | # if LL_X11 | 2544 | # if LL_X11 |
2536 | // Make GTK tell the window manager to associate this | 2545 | // Make GTK tell the window manager to associate this |
@@ -2754,7 +2763,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url) | |||
2754 | void *LLWindowSDL::getPlatformWindow() | 2763 | void *LLWindowSDL::getPlatformWindow() |
2755 | { | 2764 | { |
2756 | #if LL_GTK && LL_LLMOZLIB_ENABLED | 2765 | #if LL_GTK && LL_LLMOZLIB_ENABLED |
2757 | if (ll_try_gtk_init()) | 2766 | if (LLWindowSDL::ll_try_gtk_init()) |
2758 | { | 2767 | { |
2759 | maybe_lock_display(); | 2768 | maybe_lock_display(); |
2760 | 2769 | ||
diff --git a/linden/indra/llwindow/llwindowsdl.h b/linden/indra/llwindow/llwindowsdl.h index a395ccd..547fe12 100644 --- a/linden/indra/llwindow/llwindowsdl.h +++ b/linden/indra/llwindow/llwindowsdl.h | |||
@@ -89,6 +89,7 @@ public: | |||
89 | /*virtual*/ void setFSAASamples(const U32 samples); | 89 | /*virtual*/ void setFSAASamples(const U32 samples); |
90 | /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) | 90 | /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) |
91 | /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } | 91 | /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } |
92 | /*virtual*/ void processMiscNativeEvents(); | ||
92 | /*virtual*/ void gatherInput(); | 93 | /*virtual*/ void gatherInput(); |
93 | /*virtual*/ void swapBuffers(); | 94 | /*virtual*/ void swapBuffers(); |
94 | 95 | ||
@@ -129,6 +130,16 @@ public: | |||
129 | void (*Lock_Display)(void); | 130 | void (*Lock_Display)(void); |
130 | void (*Unlock_Display)(void); | 131 | void (*Unlock_Display)(void); |
131 | 132 | ||
133 | #if LL_GTK | ||
134 | // Lazily initialize and check the runtime GTK version for goodness. | ||
135 | static bool ll_try_gtk_init(void); | ||
136 | #endif // LL_GTK | ||
137 | |||
138 | #if LL_X11 | ||
139 | static Window get_SDL_XWindowID(void); | ||
140 | static Display* get_SDL_Display(void); | ||
141 | #endif // LL_X11 | ||
142 | |||
132 | protected: | 143 | protected: |
133 | LLWindowSDL( | 144 | LLWindowSDL( |
134 | const std::string& title, int x, int y, int width, int height, U32 flags, | 145 | const std::string& title, int x, int y, int width, int height, U32 flags, |
@@ -205,8 +216,6 @@ private: | |||
205 | BOOL mFlashing; | 216 | BOOL mFlashing; |
206 | LLTimer mFlashTimer; | 217 | LLTimer mFlashTimer; |
207 | #endif //LL_X11 | 218 | #endif //LL_X11 |
208 | |||
209 | |||
210 | }; | 219 | }; |
211 | 220 | ||
212 | 221 | ||
@@ -223,16 +232,4 @@ public: | |||
223 | 232 | ||
224 | S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type); | 233 | S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type); |
225 | 234 | ||
226 | void load_url_external(const char* url); | ||
227 | |||
228 | #if LL_GTK | ||
229 | // Lazily initialize and check the runtime GTK version for goodness. | ||
230 | BOOL ll_try_gtk_init(void); | ||
231 | #endif // LL_GTK | ||
232 | |||
233 | #if LL_X11 | ||
234 | Window get_SDL_XWindowID(void); | ||
235 | Display* get_SDL_Display(void); | ||
236 | #endif // LL_X11 | ||
237 | |||
238 | #endif //LL_LLWINDOWSDL_H | 235 | #endif //LL_LLWINDOWSDL_H |