summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-09-23 01:53:11 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-09-23 01:53:11 +0000
commitafe61eb994377e25d60d0a0893510a693149c6be (patch)
tree80c6e33cd664e5c8b1c5f55c3b7b49c081dd590a /indra/llwindow
parent2945882258ad1befe8e8094c0a1a655e4ddbcd30 (diff)
QAR-849 merge maint-viewer-10-merge 96838-97237 -> release
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindow.cpp6
-rw-r--r--indra/llwindow/llwindow.h1
-rw-r--r--indra/llwindow/llwindowsdl.cpp62
-rw-r--r--indra/llwindow/llwindowsdl.h25
4 files changed, 53 insertions, 41 deletions
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 4f467be02d..03c36e95fc 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -310,6 +310,12 @@ std::string LLWindow::getFontListSans()
#endif
}
+//virtual
+void LLWindow::processMiscNativeEvents()
+{
+ // do nothing unless subclassed
+}
+
#define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400)
#define UTF16_IS_LOW_SURROGATE(U) ((U16)((U) - 0xDC00) < 0x0400)
#define UTF16_SURROGATE_PAIR_TO_UTF32(H,L) (((H) << 10) + (L) - (0xD800 << 10) - 0xDC00 + 0x00010000)
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 9b1f005920..9c3dfd319c 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -190,6 +190,7 @@ public:
virtual U32 getFSAASamples() = 0;
virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma)
virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
+ virtual void processMiscNativeEvents();
virtual void gatherInput() = 0;
virtual void delayInputProcessing() = 0;
virtual void swapBuffers() = 0;
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index e2d114245d..96a8fae592 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -104,7 +104,8 @@ void maybe_unlock_display(void)
#if LL_GTK
// Lazily initialize and check the runtime GTK version for goodness.
-BOOL ll_try_gtk_init(void)
+// static
+bool LLWindowSDL::ll_try_gtk_init(void)
{
static BOOL done_gtk_diag = FALSE;
static BOOL gtk_is_good = FALSE;
@@ -166,7 +167,8 @@ BOOL ll_try_gtk_init(void)
#if LL_X11
-Window get_SDL_XWindowID(void)
+// static
+Window LLWindowSDL::get_SDL_XWindowID(void)
{
if (gWindowImplementation) {
return gWindowImplementation->mSDL_XWindowID;
@@ -174,7 +176,8 @@ Window get_SDL_XWindowID(void)
return None;
}
-Display* get_SDL_Display(void)
+//static
+Display* LLWindowSDL::get_SDL_Display(void)
{
if (gWindowImplementation) {
return gWindowImplementation->mSDL_Display;
@@ -1235,7 +1238,7 @@ typedef Atom x11clipboard_type;
*/
static x11clipboard_type get_x11_readwrite_clipboard_type(void)
{
- return XInternAtom(get_SDL_Display(), "CLIPBOARD", False);
+ return XInternAtom(LLWindowSDL::get_SDL_Display(), "CLIPBOARD", False);
}
static x11clipboard_type get_x11_write_clipboard_type(void)
@@ -1248,18 +1251,18 @@ static x11clipboard_type get_x11_write_clipboard_type(void)
storage because their use isn't really defined for holding UTF8. */
static x11clipboard_type get_x11_cutbuffer_clipboard_type(void)
{
- return XInternAtom(get_SDL_Display(), "SECONDLIFE_CUTBUFFER", False);
+ return XInternAtom(LLWindowSDL::get_SDL_Display(), "SECONDLIFE_CUTBUFFER", False);
}
/* Some X11 atom-generators */
static Atom get_x11_targets_atom(void)
{
- return XInternAtom(get_SDL_Display(), "TARGETS", False);
+ return XInternAtom(LLWindowSDL::get_SDL_Display(), "TARGETS", False);
}
static Atom get_x11_text_atom(void)
{
- return XInternAtom(get_SDL_Display(), "TEXT", False);
+ return XInternAtom(LLWindowSDL::get_SDL_Display(), "TEXT", False);
}
/* These defines, and convert_data/convert_x11clipboard,
@@ -1544,7 +1547,7 @@ int clipboard_filter_callback(const SDL_Event *event)
sevent.xselection.property = None;
sevent.xselection.requestor = req->requestor;
sevent.xselection.time = req->time;
- if ( XGetWindowProperty(get_SDL_Display(), DefaultRootWindow(get_SDL_Display()),
+ if ( XGetWindowProperty(LLWindowSDL::get_SDL_Display(), DefaultRootWindow(LLWindowSDL::get_SDL_Display()),
get_x11_cutbuffer_clipboard_type(), 0, INT_MAX/4, False, req->target,
&sevent.xselection.target, &seln_format,
&nbytes, &overflow, &seln_data) == Success )
@@ -1558,7 +1561,7 @@ int clipboard_filter_callback(const SDL_Event *event)
if ( seln_data[nbytes-1] == '\0' )
--nbytes;
}
- XChangeProperty(get_SDL_Display(), req->requestor, req->property,
+ XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor, req->property,
req->target, seln_format, PropModeReplace,
seln_data, nbytes);
sevent.xselection.property = req->property;
@@ -1571,7 +1574,7 @@ int clipboard_filter_callback(const SDL_Event *event)
get_x11_targets_atom()
};
supported[0] = sevent.xselection.target;
- XChangeProperty(get_SDL_Display(), req->requestor,
+ XChangeProperty(LLWindowSDL::get_SDL_Display(), req->requestor,
req->property, XA_ATOM, 32, PropModeReplace,
(unsigned char*)supported,
num_supported);
@@ -1584,10 +1587,10 @@ int clipboard_filter_callback(const SDL_Event *event)
XFree(seln_data);
}
int sendret =
- XSendEvent(get_SDL_Display(),req->requestor,False,0,&sevent);
+ XSendEvent(LLWindowSDL::get_SDL_Display(),req->requestor,False,0,&sevent);
if ((sendret==BadValue) || (sendret==BadWindow))
llwarns << "Clipboard SendEvent failed" << llendl;
- XSync(get_SDL_Display(), False);
+ XSync(LLWindowSDL::get_SDL_Display(), False);
}
break;
}
@@ -1959,17 +1962,14 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
return mGrabbyKeyFlags;
}
-void LLWindowSDL::gatherInput()
+// virtual
+void LLWindowSDL::processMiscNativeEvents()
{
- const Uint32 CLICK_THRESHOLD = 300; // milliseconds
- static int leftClick = 0;
- static int rightClick = 0;
- static Uint32 lastLeftDown = 0;
- static Uint32 lastRightDown = 0;
- SDL_Event event;
-
-#if LL_GTK && LL_LLMOZLIB_ENABLED
- // Pump GTK events so embedded Gecko doesn't starve.
+#if LL_GTK && (LL_LLMOZLIB_ENABLED || LL_DBUS_ENABLED)
+ // Pump GTK events to avoid starvation for:
+ // * Embedded Gecko
+ // * DBUS servicing
+ // * Anything else which quietly hooks into the default glib/GTK loop
if (ll_try_gtk_init())
{
// Yuck, Mozilla's GTK callbacks play with the locale - push/pop
@@ -1992,7 +1992,17 @@ void LLWindowSDL::gatherInput()
setlocale(LC_ALL, saved_locale.c_str() );
}
-#endif // LL_GTK && LL_LLMOZLIB_ENABLED
+#endif // LL_GTK && (LL_LLMOZLIB_ENABLED || LL_DBUS_ENABLED)
+}
+
+void LLWindowSDL::gatherInput()
+{
+ const Uint32 CLICK_THRESHOLD = 300; // milliseconds
+ static int leftClick = 0;
+ static int rightClick = 0;
+ static Uint32 lastLeftDown = 0;
+ static Uint32 lastRightDown = 0;
+ SDL_Event event;
// Handle all outstanding SDL events
while (SDL_PollEvent(&event))
@@ -2497,12 +2507,10 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ
{
S32 rtn = OSBTN_CANCEL;
- ll_try_gtk_init();
-
if(gWindowImplementation != NULL)
gWindowImplementation->beforeDialog();
- if (ll_try_gtk_init()
+ if (LLWindowSDL::ll_try_gtk_init()
// We can NOT expect to combine GTK and SDL's aggressive fullscreen
&& ((NULL==gWindowImplementation) || (!was_fullscreen))
)
@@ -2754,7 +2762,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url)
void *LLWindowSDL::getPlatformWindow()
{
#if LL_GTK && LL_LLMOZLIB_ENABLED
- if (ll_try_gtk_init())
+ if (LLWindowSDL::ll_try_gtk_init())
{
maybe_lock_display();
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 6ac2a789ac..091b0de1e0 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -89,6 +89,7 @@ public:
/*virtual*/ void setFSAASamples(const U32 samples);
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
+ /*virtual*/ void processMiscNativeEvents();
/*virtual*/ void gatherInput();
/*virtual*/ void swapBuffers();
@@ -129,6 +130,16 @@ public:
void (*Lock_Display)(void);
void (*Unlock_Display)(void);
+#if LL_GTK
+ // Lazily initialize and check the runtime GTK version for goodness.
+ static bool ll_try_gtk_init(void);
+#endif // LL_GTK
+
+#if LL_X11
+ static Window get_SDL_XWindowID(void);
+ static Display* get_SDL_Display(void);
+#endif // LL_X11
+
protected:
LLWindowSDL(
const std::string& title, int x, int y, int width, int height, U32 flags,
@@ -205,8 +216,6 @@ private:
BOOL mFlashing;
LLTimer mFlashTimer;
#endif //LL_X11
-
-
};
@@ -223,16 +232,4 @@ public:
S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type);
-void load_url_external(const char* url);
-
-#if LL_GTK
-// Lazily initialize and check the runtime GTK version for goodness.
-BOOL ll_try_gtk_init(void);
-#endif // LL_GTK
-
-#if LL_X11
-Window get_SDL_XWindowID(void);
-Display* get_SDL_Display(void);
-#endif // LL_X11
-
#endif //LL_LLWINDOWSDL_H