public void Press(KeyScanCode scanCode) { var key = PS2ScanCodeTranslator.Instance.GetCode(scanCode); data.Enqueue((byte)(key & 0x7f)); NotifyParent(); }
public void Press(KeyScanCode scanCode) { this.Log(LogLevel.Error, "Pressed key {0}", scanCode); var key = PS2ScanCodeTranslator.Instance.GetCode(scanCode); data.Enqueue((byte)(key & 0x7f)); NotifyParent(); }
private void ReleaseInner(KeyScanCode scanCode) { var key = PS2ScanCodeTranslator.Instance.GetCode(scanCode); data.Enqueue((byte)Command.Release); data.Enqueue((byte)(key & 0x7f)); NotifyParent(); }
public void Release(KeyScanCode scanCode) { if (!UpdateModifiers(scanCode, false)) { pressedKey = 0; } SendPacket(); }
public void Press(KeyScanCode scanCode) { if (!UpdateModifiers(scanCode, true)) { pressedKey = (byte)((int)scanCode & 0x7f); } SendPacket(); }
public int GetCode(KeyScanCode scanCode) { int result; if(!mapping.TryGetValue(scanCode, out result)) { result = 0; } return result; }
private bool UpdateModifiers(KeyScanCode scanCode, bool set) { if (scanCode >= KeyScanCode.CtrlL && scanCode <= KeyScanCode.WinR) { BitHelper.SetBit(ref modifiers, (byte)((int)scanCode & 0x7), set); return(true); } return(false); }
public void Release(KeyScanCode scanCode) { this.Log(LogLevel.Noisy, "Releasing {0}", scanCode); if (!UpdateModifiers(scanCode, false)) { pressedKey = 0; } SendPacket(); }
public void Press(KeyScanCode scanCode) { this.Log(LogLevel.Noisy, "Pressing {0}", scanCode); if (!UpdateModifiers(scanCode, true)) { pressedKey = (byte)((int)scanCode & 0x7f); } SendPacket(); }
public void Release(KeyScanCode scanCode) { this.Log(LogLevel.Noisy, "Released key {0}", scanCode); var key = PS2ScanCodeTranslator.Instance.GetCode(scanCode); data.Enqueue((byte)Command.Release); data.Enqueue((byte)(key & 0x7f)); NotifyParent(); }
public static void click(KeyScanCode scanCode, KeyId id) { //press down id keybd_event((byte)id, (byte)scanCode, KEYEVENT_KEYDOWN, (IntPtr)0); Thread.Sleep(PERSON_CLICK_DELAY); //press up id keybd_event((byte)id, (byte)scanCode, KEYEVENT_KEYUP, (IntPtr)0); }
public int GetCode(KeyScanCode scanCode) { int result; if (!mapping.TryGetValue(scanCode, out result)) { result = 0; } return(result); }
public void KeyReleased(KeyScanCode key) { lalt &= (key != KeyScanCode.AltL); lctrl &= (key != KeyScanCode.CtrlL); lshift &= (key != KeyScanCode.ShiftL); var kh = keyboardHandler; if (kh != null) { kh.Release(key); } }
private void PressInner(KeyScanCode scanCode) { lock (thisLock) { pkey = (int)scanCode & 0x7f; if (((int)scanCode) >= 0xe0 && ((int)scanCode) <= 0xe7) { modifiers |= 1 << (((int)scanCode) & 0x7); pkey = 0; } queue.Enqueue((byte)pkey); } Refresh(); }
/// <summary> /// Signals that the given key is being held down. /// </summary> /// <param name="key"></param> public void SetKey(KeyScanCode key) { if (key == KeyScanCode.None) { return; } if (key == KeyScanCode.On) { OnKey = true; return; } int n = (int)key - 1; SetKey(n >> 3, n & 0x7); }
/// <summary> /// Signals that the given key is not being held down. /// </summary> /// <param name="key"></param> public void ResetKey(KeyScanCode key) { if (key == KeyScanCode.None) { return; } if (key == KeyScanCode.On) { OnKey = false; return; } int n = (int)key - 1; ResetKey(n >> 3, n & 0x7); }
private void ReleaseInner(KeyScanCode scanCode) { lock (thisLock) { pkey = (int)0; if (((int)scanCode) >= 0xe0 && ((int)scanCode) <= 0xe7) { modifiers &= ~(1 << (((int)scanCode) & 0x7)); } for (int i = 0; i < 6; i++) { queue.Enqueue((byte)pkey); } } Refresh(); }
/// <summary> /// Returns true if the specified key is being held down. /// </summary> /// <param name="key"></param> /// <returns></returns> public bool TestKey(KeyScanCode key) { if (key == KeyScanCode.None) { return(false); } if (key == KeyScanCode.On) { return(onKey); } int n = (int)key - 1; int group = n >> 3; int bit = n & 0x7; return((KeyStateTable[group] & (1 << bit)) != 0); }
/// <summary> /// This provides a simple way to control which keys are being pressed. /// </summary> /// <param name="key"></param> /// <returns></returns> public bool this[KeyScanCode key] { get { return(TestKey(key)); } set { if (value) { SetKey(key); } else { ResetKey(key); } } }
public void KeyPressed(KeyScanCode key) { var kh = keyboardHandler; lalt |= (key == KeyScanCode.AltL); lctrl |= (key == KeyScanCode.CtrlL); lshift |= (key == KeyScanCode.ShiftL); if(lctrl && lalt && lshift) { lalt = false; lctrl = false; lshift = false; if(status == Status.Grabbed) { // ask if we should grab source.DetachHandler(); source = new XWTEventSource(widget); source.AttachHandler(this); status = Status.NotGrabbed; } if(kh != null) { kh.Release(KeyScanCode.AltL); kh.Release(KeyScanCode.CtrlL); kh.Release(KeyScanCode.ShiftL); } return; } if(kh != null) { kh.Press(key); } }
public void KeyPressed(KeyScanCode key) { var kh = keyboardHandler; lalt |= (key == KeyScanCode.AltL); lctrl |= (key == KeyScanCode.CtrlL); lshift |= (key == KeyScanCode.ShiftL); if (lctrl && lalt && lshift) { lalt = false; lctrl = false; lshift = false; if (status == Status.Grabbed) { // ask if we should grab source.DetachHandler(); source = new XWTEventSource(widget); source.AttachHandler(this); status = Status.NotGrabbed; } if (kh != null) { kh.Release(KeyScanCode.AltL); kh.Release(KeyScanCode.CtrlL); kh.Release(KeyScanCode.ShiftL); } return; } if (kh != null) { kh.Press(key); } }
public void KeyReleased(KeyScanCode key) { lalt &= (key != KeyScanCode.AltL); lctrl &= (key != KeyScanCode.CtrlL); lshift &= (key != KeyScanCode.ShiftL); var kh = keyboardHandler; if(kh != null) { kh.Release(key); } }
private void UpdateKeyList(KeyScanCode scanCode, bool isPress) { // Ignore duplicate events which happen due to key repeat. if ((isPress && this.PressedKeys.ContainsKey(scanCode)) || (!isPress && !this.PressedKeys.ContainsKey(scanCode))) { return; } // If we can't handle this key, don't process it. if (!MatrixMapping.ContainsKey(scanCode)) { this.Log(LogLevel.Debug, "No key mapping found for {0}", scanCode); return; } // Add or remove this key from the list of currently-active keys this.Log(LogLevel.Debug, "Got new key -- press? {0} : {1}", isPress, scanCode); if (isPress) { this.PressedKeys.Add(scanCode, true); } else { this.PressedKeys.Remove(scanCode); } // Reconstruct the keyboard matrix press state for (var i = 0; i < this.rows.Length; i++) { this.rows[i] = 0; } // Simulate the keyboard matrix by ORing all pressed keys. foreach (var key in this.PressedKeys) { KeyMap result; MatrixMapping.TryGetValue(key.Key, out result); for (var i = 0; i < this.rows.Length; i++) { this.rows[i] |= result.rows[i]; } } // for (var i = 0; i <= 8; i++) // { // this.Log(LogLevel.Debug, " rows[{0}] = {1}", i, rows[i]); // } // Update the `rowChange` field if no interrupt is pending. if (!this.irqInjectPending.Value) { for (var i = 0; i <= 8; i++) { if (this.rows[i] != 0) { this.rowChange |= (1u << i); } } } this.irqKeyPressedStatus = true; this.UpdateInterrupts(); this.irqKeyPressedStatus = false; return; }
public void Release(KeyScanCode scanCode) { this.UpdateKeyList(scanCode, false); }
public void Press(KeyScanCode scanCode) { machine.ReportForeignEvent(scanCode, PressInner); }
public void Release(KeyScanCode scanCode) { machine.ReportForeignEvent(scanCode, ReleaseInner); }
public static void release(KeyScanCode scanCode, KeyId id) { //press up id keybd_event((byte)id, (byte)scanCode, KEYEVENT_KEYUP, (IntPtr)0); }
public static void press(KeyScanCode scanCode, KeyId id) { //press down id keybd_event((byte)id, (byte)scanCode, KEYEVENT_KEYDOWN, (IntPtr)0); }
private void ReleaseInner(KeyScanCode scanCode) { lock(thisLock) { pkey = (int)0; if(((int)scanCode) >= 0xe0 && ((int)scanCode) <= 0xe7) { modifiers &= ~(1 << (((int)scanCode) & 0x7)); } for(int i = 0; i < 6; i++) queue.Enqueue((byte)pkey); } Refresh(); }
private void PressInner(KeyScanCode scanCode) { lock(thisLock) { pkey = (int)scanCode & 0x7f; if(((int)scanCode) >= 0xe0 && ((int)scanCode) <= 0xe7) { modifiers |= 1 << (((int)scanCode) & 0x7); pkey = 0; } queue.Enqueue((byte)pkey); } Refresh(); }
public void Press(KeyScanCode scanCode) { this.UpdateKeyList(scanCode, true); }