void ViewerWindow::desktopStateUpdate() { // Adjust window of viewer to size of remote desktop. adjustWindowSize(); // Update state of toolbar-buttons (Ctrl, Alt) to hardware-button state. updateKeyState(); }
//! sets key buffer to be pressed or not bool EKeyboardModuleGlut::updateKeyState( int _platformKeyCode, bool _bDown ){ bool result = false; if(_platformKeyCode >= GLUT_KEY_F1 && _platformKeyCode <= GLUT_KEY_F12){ E_KEY_CODE kc = (E_KEY_CODE)(_platformKeyCode + 111); result = updateKeyState(kc, E_KC_F1, E_KC_F12, _bDown); }else if(_platformKeyCode >= GLUT_KEY_LEFT && _platformKeyCode <= GLUT_KEY_DOWN){ E_KEY_CODE kc = (E_KEY_CODE)(_platformKeyCode - 63); result = updateKeyState(kc, E_KC_LEFT, E_KC_DOWN, _bDown); }else if(_platformKeyCode >= GLUT_KEY_PAGE_UP && _platformKeyCode <= GLUT_KEY_PAGE_DOWN){ E_KEY_CODE kc = (E_KEY_CODE)(_platformKeyCode - 71); result = updateKeyState(kc, E_KC_PRIOR, E_KC_NEXT, _bDown); }else if(_platformKeyCode == GLUT_KEY_HOME){ E_KEY_CODE kc = (E_KEY_CODE)(_platformKeyCode - 70); result = updateKeyState(kc, E_KC_HOME, E_KC_HOME, _bDown); }else if(_platformKeyCode == GLUT_KEY_END){ E_KEY_CODE kc = (E_KEY_CODE)(_platformKeyCode - 68); result = updateKeyState(kc, E_KC_END, E_KC_END, _bDown); }else if(_platformKeyCode == GLUT_KEY_INSERT){ E_KEY_CODE kc = (E_KEY_CODE)(_platformKeyCode - 63); result = updateKeyState(kc, E_KC_INSERT, E_KC_INSERT, _bDown); }else{ E_KEY_CODE kc = (E_KEY_CODE)(_platformKeyCode); result = updateKeyState(kc, E_KC_0, E_KC_Z, _bDown); } return result; }
void OSXKeyState::checkKeyboardLayout() { // XXX -- should call this when notified that groups have changed. // if no notification for that then we should poll. GroupList groups; if (getGroups(groups) && groups != m_groups) { updateKeyMap(); updateKeyState(); } }
void CKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button) { // get the sequence of keys to simulate key press and the final // modifier state. Keystrokes keys; KeyButton localID = (KeyButton)(mapKey(keys, id, mask, false) & kButtonMask); if (keys.empty()) { // do nothing if there are no associated keys LOG((CLOG_DEBUG2 "cannot map key 0x%08x", id)); return; } // generate key events fakeKeyEvents(keys, 1); // note that key is down updateKeyState((KeyButton)(button & kButtonMask), localID, true, true); }
void CKeyState::fakeKeyUp(KeyButton button) { // if we haven't seen this button go down then ignore it KeyButton localID = m_serverKeyMap[button & kButtonMask]; if (localID == 0) { return; } // get the sequence of keys to simulate key release Keystrokes keys; Keystroke keystroke; keystroke.m_key = localID; keystroke.m_press = false; keystroke.m_repeat = false; keys.push_back(keystroke); // generate key events fakeKeyEvents(keys, 1); // note that key is now up updateKeyState(button, localID, false, true); }
void CKeyState::setKeyDown(KeyButton button, bool down) { button &= kButtonMask; updateKeyState(button, button, down, false); }