diff options
author | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
commit | a8a62201ba762e98dff92cf49033e577fc34d8d4 (patch) | |
tree | 11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/llui/llfocusmgr.cpp | |
parent | Second Life viewer sources 1.18.6.4-RC (diff) | |
download | meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2 meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz |
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/llui/llfocusmgr.cpp')
-rw-r--r-- | linden/indra/llui/llfocusmgr.cpp | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/linden/indra/llui/llfocusmgr.cpp b/linden/indra/llui/llfocusmgr.cpp index 065c206..efca3d8 100644 --- a/linden/indra/llui/llfocusmgr.cpp +++ b/linden/indra/llui/llfocusmgr.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 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 | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 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 | 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 | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -42,11 +42,10 @@ LLFocusMgr gFocusMgr; | |||
42 | LLFocusMgr::LLFocusMgr() | 42 | LLFocusMgr::LLFocusMgr() |
43 | : | 43 | : |
44 | mLockedView( NULL ), | 44 | mLockedView( NULL ), |
45 | mKeyboardLockedFocusLostCallback( NULL ), | ||
46 | mMouseCaptor( NULL ), | 45 | mMouseCaptor( NULL ), |
47 | mKeyboardFocus( NULL ), | 46 | mKeyboardFocus( NULL ), |
47 | mLastKeyboardFocus( NULL ), | ||
48 | mDefaultKeyboardFocus( NULL ), | 48 | mDefaultKeyboardFocus( NULL ), |
49 | mKeyboardFocusLostCallback( NULL ), | ||
50 | mTopCtrl( NULL ), | 49 | mTopCtrl( NULL ), |
51 | mFocusWeight(0.f), | 50 | mFocusWeight(0.f), |
52 | mAppHasFocus(TRUE) // Macs don't seem to notify us that we've gotten focus, so default to true | 51 | mAppHasFocus(TRUE) // Macs don't seem to notify us that we've gotten focus, so default to true |
@@ -75,12 +74,11 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) | |||
75 | if (view == mLockedView) | 74 | if (view == mLockedView) |
76 | { | 75 | { |
77 | mLockedView = NULL; | 76 | mLockedView = NULL; |
78 | mKeyboardLockedFocusLostCallback = NULL; | 77 | setKeyboardFocus( NULL ); |
79 | setKeyboardFocus( NULL, NULL ); | ||
80 | } | 78 | } |
81 | else | 79 | else |
82 | { | 80 | { |
83 | setKeyboardFocus( mLockedView, mKeyboardLockedFocusLostCallback ); | 81 | setKeyboardFocus( mLockedView ); |
84 | } | 82 | } |
85 | } | 83 | } |
86 | 84 | ||
@@ -91,7 +89,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) | |||
91 | } | 89 | } |
92 | 90 | ||
93 | 91 | ||
94 | void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, FocusLostCallback on_focus_lost, BOOL lock) | 92 | void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock) |
95 | { | 93 | { |
96 | if (mLockedView && | 94 | if (mLockedView && |
97 | (new_focus == NULL || | 95 | (new_focus == NULL || |
@@ -101,28 +99,27 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, FocusLostCallback on_focu | |||
101 | // or one of its descendants | 99 | // or one of its descendants |
102 | return; | 100 | return; |
103 | } | 101 | } |
104 | FocusLostCallback old_callback = mKeyboardFocusLostCallback; | ||
105 | mKeyboardFocusLostCallback = on_focus_lost; | ||
106 | 102 | ||
107 | //llinfos << "Keyboard focus handled by " << (new_focus ? new_focus->getName() : "nothing") << llendl; | 103 | //llinfos << "Keyboard focus handled by " << (new_focus ? new_focus->getName() : "nothing") << llendl; |
108 | 104 | ||
109 | if( new_focus != mKeyboardFocus ) | 105 | if( new_focus != mKeyboardFocus ) |
110 | { | 106 | { |
111 | LLUICtrl* old_focus = mKeyboardFocus; | 107 | mLastKeyboardFocus = mKeyboardFocus; |
112 | mKeyboardFocus = new_focus; | 108 | mKeyboardFocus = new_focus; |
113 | 109 | ||
110 | if( mLastKeyboardFocus ) | ||
111 | { | ||
112 | mLastKeyboardFocus->onFocusLost(); | ||
113 | } | ||
114 | |||
114 | // clear out any existing flash | 115 | // clear out any existing flash |
115 | if (new_focus) | 116 | if (new_focus) |
116 | { | 117 | { |
117 | mFocusWeight = 0.f; | 118 | mFocusWeight = 0.f; |
119 | new_focus->onFocusReceived(); | ||
118 | } | 120 | } |
119 | mFocusTimer.reset(); | 121 | mFocusTimer.reset(); |
120 | 122 | ||
121 | if( old_callback ) | ||
122 | { | ||
123 | old_callback( old_focus ); | ||
124 | } | ||
125 | |||
126 | #ifdef _DEBUG | 123 | #ifdef _DEBUG |
127 | mKeyboardFocusName = new_focus ? new_focus->getName() : "none"; | 124 | mKeyboardFocusName = new_focus ? new_focus->getName() : "none"; |
128 | #endif | 125 | #endif |
@@ -204,13 +201,11 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( LLView* focus ) | |||
204 | if (focus == mLockedView) | 201 | if (focus == mLockedView) |
205 | { | 202 | { |
206 | mLockedView = NULL; | 203 | mLockedView = NULL; |
207 | mKeyboardLockedFocusLostCallback = NULL; | ||
208 | } | 204 | } |
209 | 205 | ||
210 | if( mKeyboardFocus == focus ) | 206 | if( mKeyboardFocus == focus ) |
211 | { | 207 | { |
212 | mKeyboardFocus = NULL; | 208 | mKeyboardFocus = NULL; |
213 | mKeyboardFocusLostCallback = NULL; | ||
214 | #ifdef _DEBUG | 209 | #ifdef _DEBUG |
215 | mKeyboardFocusName = "none"; | 210 | mKeyboardFocusName = "none"; |
216 | #endif | 211 | #endif |
@@ -293,13 +288,19 @@ BOOL LLFocusMgr::childIsTopCtrl( LLView* parent ) | |||
293 | // set new_top = NULL to release top_view. | 288 | // set new_top = NULL to release top_view. |
294 | void LLFocusMgr::setTopCtrl( LLUICtrl* new_top ) | 289 | void LLFocusMgr::setTopCtrl( LLUICtrl* new_top ) |
295 | { | 290 | { |
296 | if( new_top != mTopCtrl ) | 291 | LLUICtrl* old_top = mTopCtrl; |
292 | if( new_top != old_top ) | ||
297 | { | 293 | { |
298 | mTopCtrl = new_top; | 294 | mTopCtrl = new_top; |
299 | 295 | ||
300 | #ifdef _DEBUG | 296 | #ifdef _DEBUG |
301 | mTopCtrlName = new_top ? new_top->getName() : "none"; | 297 | mTopCtrlName = new_top ? new_top->getName() : "none"; |
302 | #endif | 298 | #endif |
299 | |||
300 | if (old_top) | ||
301 | { | ||
302 | old_top->onLostTop(); | ||
303 | } | ||
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
@@ -317,13 +318,11 @@ void LLFocusMgr::removeTopCtrlWithoutCallback( LLUICtrl* top_view ) | |||
317 | void LLFocusMgr::lockFocus() | 318 | void LLFocusMgr::lockFocus() |
318 | { | 319 | { |
319 | mLockedView = mKeyboardFocus; | 320 | mLockedView = mKeyboardFocus; |
320 | mKeyboardLockedFocusLostCallback = mKeyboardFocusLostCallback; | ||
321 | } | 321 | } |
322 | 322 | ||
323 | void LLFocusMgr::unlockFocus() | 323 | void LLFocusMgr::unlockFocus() |
324 | { | 324 | { |
325 | mLockedView = NULL; | 325 | mLockedView = NULL; |
326 | mKeyboardLockedFocusLostCallback = NULL; | ||
327 | } | 326 | } |
328 | 327 | ||
329 | F32 LLFocusMgr::getFocusFlashAmt() | 328 | F32 LLFocusMgr::getFocusFlashAmt() |
@@ -356,9 +355,9 @@ void LLFocusMgr::setAppHasFocus(BOOL focus) | |||
356 | } | 355 | } |
357 | 356 | ||
358 | // release focus from "top ctrl"s, which generally hides them | 357 | // release focus from "top ctrl"s, which generally hides them |
359 | if (!focus && mTopCtrl && mTopCtrl->hasFocus()) | 358 | if (!focus && mTopCtrl) |
360 | { | 359 | { |
361 | mTopCtrl->setFocus(FALSE); | 360 | setTopCtrl(NULL); |
362 | } | 361 | } |
363 | mAppHasFocus = focus; | 362 | mAppHasFocus = focus; |
364 | } | 363 | } |