aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow/llkeyboardwin32.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llwindow/llkeyboardwin32.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/llwindow/llkeyboardwin32.cpp')
-rw-r--r--linden/indra/llwindow/llkeyboardwin32.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/linden/indra/llwindow/llkeyboardwin32.cpp b/linden/indra/llwindow/llkeyboardwin32.cpp
index e166ec2..33664b9 100644
--- a/linden/indra/llwindow/llkeyboardwin32.cpp
+++ b/linden/indra/llwindow/llkeyboardwin32.cpp
@@ -187,10 +187,7 @@ MASK LLKeyboardWin32::updateModifiers()
187 187
188 // Scan the modifier keys as of the last Windows key message 188 // Scan the modifier keys as of the last Windows key message
189 // (keydown encoded in high order bit of short) 189 // (keydown encoded in high order bit of short)
190 //setModifierKeyLevel( KEY_SHIFT, GetKeyState(VK_SHIFT) & 0x8000 ); 190 mKeyLevel[KEY_CAPSLOCK] = (GetKeyState(VK_CAPITAL) & 0x0001) != 0; // Low order bit carries the toggle state.
191 //setModifierKeyLevel( KEY_CONTROL, GetKeyState(VK_CONTROL) & 0x8000 );
192 //setModifierKeyLevel( KEY_ALT, GetKeyState(VK_MENU) & 0x8000 );
193 //setModifierKeyLevel( KEY_CAPSLOCK, GetKeyState(VK_CAPITAL) & 0x0001); // Low order bit carries the toggle state.
194 // Get mask for keyboard events 191 // Get mask for keyboard events
195 MASK mask = currentMask(FALSE); 192 MASK mask = currentMask(FALSE);
196 return mask; 193 return mask;
@@ -214,7 +211,6 @@ BOOL LLKeyboardWin32::handleKeyDown(const U16 key, MASK mask)
214 return handled; 211 return handled;
215} 212}
216 213
217
218// mask is ignored, except for extended flag -- we poll the modifier keys for the other flags 214// mask is ignored, except for extended flag -- we poll the modifier keys for the other flags
219BOOL LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask) 215BOOL LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask)
220{ 216{
@@ -248,10 +244,14 @@ MASK LLKeyboardWin32::currentMask(BOOL)
248void LLKeyboardWin32::scanKeyboard() 244void LLKeyboardWin32::scanKeyboard()
249{ 245{
250 S32 key; 246 S32 key;
247 MSG msg;
248 BOOL pending_key_events = PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD);
251 for (key = 0; key < KEY_COUNT; key++) 249 for (key = 0; key < KEY_COUNT; key++)
252 { 250 {
253 // On Windows, verify key down state. JC 251 // On Windows, verify key down state. JC
254 if (mKeyLevel[key]) 252 // RN: only do this if we don't have further key events in the queue
253 // as otherwise there might be key repeat events still waiting for this key we are now dumping
254 if (!pending_key_events && mKeyLevel[key])
255 { 255 {
256 // *TODO: I KNOW there must be a better way of 256 // *TODO: I KNOW there must be a better way of
257 // interrogating the key state than this, using async key 257 // interrogating the key state than this, using async key
@@ -262,9 +262,9 @@ void LLKeyboardWin32::scanKeyboard()
262 // ...translate back to windows key 262 // ...translate back to windows key
263 U16 virtual_key = inverseTranslateExtendedKey(key); 263 U16 virtual_key = inverseTranslateExtendedKey(key);
264 // keydown in highest bit 264 // keydown in highest bit
265 if (!(GetAsyncKeyState(virtual_key) & 0x8000)) 265 if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000))
266 { 266 {
267 //llinfos << "Key up event missed, resetting" << llendl; 267 //llinfos << "Key up event missed, resetting" << llendl;
268 mKeyLevel[key] = FALSE; 268 mKeyLevel[key] = FALSE;
269 } 269 }
270 } 270 }