diff options
Diffstat (limited to 'linden/indra/newview/llwebbrowserctrl.cpp')
-rw-r--r-- | linden/indra/newview/llwebbrowserctrl.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/linden/indra/newview/llwebbrowserctrl.cpp b/linden/indra/newview/llwebbrowserctrl.cpp index a9c1ec8..fbbd827 100644 --- a/linden/indra/newview/llwebbrowserctrl.cpp +++ b/linden/indra/newview/llwebbrowserctrl.cpp | |||
@@ -71,7 +71,8 @@ LLWebBrowserCtrl::LLWebBrowserCtrl( const std::string& name, const LLRect& rect | |||
71 | mIgnoreUIScale( true ), | 71 | mIgnoreUIScale( true ), |
72 | mAlwaysRefresh( false ), | 72 | mAlwaysRefresh( false ), |
73 | mExternalUrl( "" ), | 73 | mExternalUrl( "" ), |
74 | mMediaSource( 0 ) | 74 | mMediaSource( 0 ), |
75 | mTakeFocusOnClick( true ) | ||
75 | { | 76 | { |
76 | S32 screen_width = mIgnoreUIScale ? | 77 | S32 screen_width = mIgnoreUIScale ? |
77 | llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth(); | 78 | llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth(); |
@@ -161,6 +162,13 @@ void LLWebBrowserCtrl::setBorderVisible( BOOL border_visible ) | |||
161 | }; | 162 | }; |
162 | 163 | ||
163 | //////////////////////////////////////////////////////////////////////////////// | 164 | //////////////////////////////////////////////////////////////////////////////// |
165 | // | ||
166 | void LLWebBrowserCtrl::setTakeFocusOnClick( bool take_focus ) | ||
167 | { | ||
168 | mTakeFocusOnClick = take_focus; | ||
169 | } | ||
170 | |||
171 | //////////////////////////////////////////////////////////////////////////////// | ||
164 | // set flag that forces the embedded browser to open links in the external system browser | 172 | // set flag that forces the embedded browser to open links in the external system browser |
165 | void LLWebBrowserCtrl::setOpenInExternalBrowser( bool valIn ) | 173 | void LLWebBrowserCtrl::setOpenInExternalBrowser( bool valIn ) |
166 | { | 174 | { |
@@ -209,7 +217,17 @@ BOOL LLWebBrowserCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) | |||
209 | convertInputCoords(x, y); | 217 | convertInputCoords(x, y); |
210 | 218 | ||
211 | if (mMediaSource) | 219 | if (mMediaSource) |
220 | { | ||
212 | mMediaSource->mouseUp(x, y); | 221 | mMediaSource->mouseUp(x, y); |
222 | |||
223 | // *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup, | ||
224 | // in addition to the onFocusReceived() call below. Undo this. JC | ||
225 | if (!mTakeFocusOnClick) | ||
226 | { | ||
227 | mMediaSource->focus(false); | ||
228 | gViewerWindow->focusClient(); | ||
229 | } | ||
230 | } | ||
213 | 231 | ||
214 | gViewerWindow->setMouseCapture( NULL ); | 232 | gViewerWindow->setMouseCapture( NULL ); |
215 | 233 | ||
@@ -227,7 +245,10 @@ BOOL LLWebBrowserCtrl::handleMouseDown( S32 x, S32 y, MASK mask ) | |||
227 | 245 | ||
228 | gViewerWindow->setMouseCapture( this ); | 246 | gViewerWindow->setMouseCapture( this ); |
229 | 247 | ||
230 | setFocus( TRUE ); | 248 | if (mTakeFocusOnClick) |
249 | { | ||
250 | setFocus( TRUE ); | ||
251 | } | ||
231 | 252 | ||
232 | return TRUE; | 253 | return TRUE; |
233 | } | 254 | } |
@@ -243,7 +264,10 @@ BOOL LLWebBrowserCtrl::handleDoubleClick( S32 x, S32 y, MASK mask ) | |||
243 | 264 | ||
244 | gViewerWindow->setMouseCapture( this ); | 265 | gViewerWindow->setMouseCapture( this ); |
245 | 266 | ||
246 | setFocus( TRUE ); | 267 | if (mTakeFocusOnClick) |
268 | { | ||
269 | setFocus( TRUE ); | ||
270 | } | ||
247 | 271 | ||
248 | return TRUE; | 272 | return TRUE; |
249 | } | 273 | } |