void DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev) { darwinEvents_lock(); { int i; if (pDev->button) { for (i = 0; i < pDev->button->numButtons; i++) { if (BitIsOn(pDev->button->down, i)) { QueuePointerEvents(pDev, ButtonRelease, i, POINTER_ABSOLUTE, NULL); } } } if (pDev->key) { for (i = 0; i < NUM_KEYCODES; i++) { if (BitIsOn(pDev->key->down, i + MIN_KEYCODE)) { QueueKeyboardEvents(pDev, KeyRelease, i + MIN_KEYCODE); } } } DarwinPokeEQ(); } darwinEvents_unlock(); }
static void xf86ReleaseKeys(DeviceIntPtr pDev) { KeyClassPtr keyc; int i, sigstate; if (!pDev || !pDev->key) return; keyc = pDev->key; /* * Hmm... here is the biggest hack of every time ! * It may be possible that a switch-vt procedure has finished BEFORE * you released all keys neccessary to do this. That peculiar behavior * can fool the X-server pretty much, cause it assumes that some keys * were not released. TWM may stuck alsmost completly.... * OK, what we are doing here is after returning from the vt-switch * exeplicitely unrelease all keyboard keys before the input-devices * are reenabled. */ for (i = keyc->xkbInfo->desc->min_key_code; i < keyc->xkbInfo->desc->max_key_code; i++) { if (key_is_down(pDev, i, KEY_POSTED)) { sigstate = xf86BlockSIGIO (); QueueKeyboardEvents(pDev, KeyRelease, i, NULL); xf86UnblockSIGIO(sigstate); } } }
static inline void PressKey(DeviceIntPtr dev, int kc, Bool down, const char *msg) { int action; if (msg != NULL && xkbDebug) rfbLog("PressKey: %s %d %s\n", msg, kc, down ? "down" : "up"); action = down ? KeyPress : KeyRelease; QueueKeyboardEvents(dev, action, kc, NULL); }
void winSendKeyEvent (DWORD dwKey, Bool fDown) { /* * When alt-tabing between screens we can get phantom key up messages * Here we only pass them through it we think we should! */ if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return; /* Update the keyState map */ g_winKeyState[dwKey] = fDown; QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL); winDebug("winSendKeyEvent: dwKey: %d, fDown: %d\n", dwKey, fDown); }
void DarwinSendKeyboardEvents(int ev_type, int keycode) { if (!darwinEvents) { DEBUG_LOG( "DarwinSendKeyboardEvents called before darwinEvents was initialized\n"); return; } darwinEvents_lock(); { QueueKeyboardEvents(darwinKeyboard, ev_type, keycode + MIN_KEYCODE); DarwinPokeEQ(); } darwinEvents_unlock(); }
void KbdReleaseAllKeys() { int i, j; if (!kbdDevice) FatalError("Keyboard device not initialized"); for (i = 0; i < DOWN_LENGTH; i++) { if (kbdDevice->key->down[i] != 0) { for (j = 0; j < 8; j++) { if (kbdDevice->key->down[i] & (1 << j)) { QueueKeyboardEvents(kbdDevice, KeyRelease, (i << 3) | j, NULL); } } } } }
void xnestQueueKeyEvent(int type, unsigned int keycode) { lastEventTime = GetTimeInMillis(); QueueKeyboardEvents(xnestKeyboardDevice, type, keycode, NULL); }