diff options
author | Josh Bell <josh@lindenlab.com> | 2007-01-09 20:19:31 +0000 |
---|---|---|
committer | Josh Bell <josh@lindenlab.com> | 2007-01-09 20:19:31 +0000 |
commit | 8c344f4da02105428c5933501d028a4a8908a657 (patch) | |
tree | 1463f67247c48a7420620917aa7fde5d6a810820 /indra/llwindow | |
parent | 8534623734e64387736ddb76683939104d796ade (diff) |
svn merge -r 56560:56599 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llkeyboard.cpp | 22 | ||||
-rw-r--r-- | indra/llwindow/llkeyboard.h | 7 | ||||
-rw-r--r-- | indra/llwindow/llkeyboardwin32.cpp | 37 | ||||
-rw-r--r-- | indra/llwindow/llkeyboardwin32.h | 2 |
4 files changed, 29 insertions, 39 deletions
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index ee42f53571..a0970f0140 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -205,6 +205,8 @@ BOOL LLKeyboard::handleTranslatedKeyDown(KEY translated_key, U32 translated_mask { mKeyLevel[translated_key] = TRUE; mKeyLevelTimer[translated_key].reset(); + mKeyLevelFrameCount[translated_key] = 0; + mKeyRepeated[translated_key] = FALSE; } else { @@ -226,7 +228,6 @@ BOOL LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask) if( mKeyLevel[translated_key] ) { mKeyLevel[translated_key] = FALSE; - mKeyLevelFrameCount[translated_key] = 0; // Only generate key up events if the key is thought to // be down. This allows you to call resetKeys() in the @@ -234,7 +235,6 @@ BOOL LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask) // messages in the same frame. This was causing the // sequence W<return> in chat to move agents forward. JC mKeyUp[translated_key] = TRUE; - mKeyRepeated[translated_key] = FALSE; handled = mCallbacks->handleTranslatedKeyUp(translated_key, translated_mask); } @@ -260,27 +260,13 @@ void LLKeyboard::toggleInsertMode() // Returns time in seconds since key was pressed. F32 LLKeyboard::getKeyElapsedTime(KEY key) { - if( mKeyLevel[key] ) - { - return mKeyLevelTimer[key].getElapsedTimeF32(); - } - else - { - return 0.f; - } + return mKeyLevelTimer[key].getElapsedTimeF32(); } // Returns time in frames since key was pressed. S32 LLKeyboard::getKeyElapsedFrameCount(KEY key) { - if( mKeyLevel[key] ) - { - return mKeyLevelFrameCount[key]; - } - else - { - return 0; - } + return mKeyLevelFrameCount[key]; } // static diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index 0c47d117d0..1d7919f06b 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -58,8 +58,8 @@ public: void resetKeys(); - F32 getCurKeyElapsedTime() { return getKeyElapsedTime( mCurScanKey ); } - F32 getCurKeyElapsedFrameCount() { return (F32)getKeyElapsedFrameCount( mCurScanKey ); } + F32 getCurKeyElapsedTime() { return getKeyDown(mCurScanKey) ? getKeyElapsedTime( mCurScanKey ) : 0.f; } + F32 getCurKeyElapsedFrameCount() { return getKeyDown(mCurScanKey) ? (F32)getKeyElapsedFrameCount( mCurScanKey ) : 0.f; } BOOL getKeyDown(const KEY key) { return mKeyLevel[key]; } BOOL getKeyRepeated(const KEY key) { return mKeyRepeated[key]; } @@ -92,9 +92,10 @@ public: void setNumpadDistinct(e_numpad_distinct val) { mNumpadDistinct = val; } void setCallbacks(LLWindowCallbacks *cbs) { mCallbacks = cbs; } -protected: F32 getKeyElapsedTime( KEY key ); // Returns time in seconds since key was pressed. S32 getKeyElapsedFrameCount( KEY key ); // Returns time in frames since key was pressed. + +protected: void addKeyName(KEY key, const LLString& name); protected: diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index ddc099418c..fe553a8230 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -146,29 +146,32 @@ void LLKeyboardWin32::resetMaskKeys() } -void LLKeyboardWin32::setModifierKeyLevel( KEY key, BOOL new_state ) -{ - if( mKeyLevel[key] != new_state ) - { - mKeyLevelFrameCount[key] = 0; - - if( new_state ) - { - mKeyLevelTimer[key].reset(); - } - mKeyLevel[key] = new_state; - } -} +//void LLKeyboardWin32::setModifierKeyLevel( KEY key, BOOL new_state ) +//{ +// if( mKeyLevel[key] != new_state ) +// { +// mKeyLevelFrameCount[key] = 0; +// +// if( new_state ) +// { +// mKeyLevelTimer[key].reset(); +// } +// mKeyLevel[key] = new_state; +// } +//} MASK LLKeyboardWin32::updateModifiers() { + //RN: this seems redundant, as we should have already received the appropriate + // messages for the modifier keys + // Scan the modifier keys as of the last Windows key message // (keydown encoded in high order bit of short) - setModifierKeyLevel( KEY_SHIFT, GetKeyState(VK_SHIFT) & 0x8000 ); - setModifierKeyLevel( KEY_CONTROL, GetKeyState(VK_CONTROL) & 0x8000 ); - setModifierKeyLevel( KEY_ALT, GetKeyState(VK_MENU) & 0x8000 ); - setModifierKeyLevel( KEY_CAPSLOCK, GetKeyState(VK_CAPITAL) & 0x0001); // Low order bit carries the toggle state. + //setModifierKeyLevel( KEY_SHIFT, GetKeyState(VK_SHIFT) & 0x8000 ); + //setModifierKeyLevel( KEY_CONTROL, GetKeyState(VK_CONTROL) & 0x8000 ); + //setModifierKeyLevel( KEY_ALT, GetKeyState(VK_MENU) & 0x8000 ); + //setModifierKeyLevel( KEY_CAPSLOCK, GetKeyState(VK_CAPITAL) & 0x0001); // Low order bit carries the toggle state. // Get mask for keyboard events MASK mask = currentMask(FALSE); return mask; diff --git a/indra/llwindow/llkeyboardwin32.h b/indra/llwindow/llkeyboardwin32.h index e7eb4b9c1e..c8355bb7a1 100644 --- a/indra/llwindow/llkeyboardwin32.h +++ b/indra/llwindow/llkeyboardwin32.h @@ -31,7 +31,7 @@ public: protected: MASK updateModifiers(); - void setModifierKeyLevel( KEY key, BOOL new_state ); + //void setModifierKeyLevel( KEY key, BOOL new_state ); private: std::map<U16, KEY> mTranslateNumpadMap; std::map<KEY, U16> mInvTranslateNumpadMap; |