public static bool SysTVGetKeyEvent(ref SysKeyEvent Event) { W32Kbd.KbdUpdateEventQueues(); if (W32Kbd.SysKeyCount == 0) { return(false); } else { W32Kbd.SysKeyCount--; Event = W32Kbd.SysKeyQue[0]; for (int i = W32Kbd.SysKeyCount; i > 0; i--) { W32Kbd.SysKeyQue[i] = W32Kbd.SysKeyQue[i - 1]; } return(true); } }
public static bool SysTVGetMouseEvent(out SysMouseEvent Event) { Event = new SysMouseEvent(); W32Kbd.KbdUpdateEventQueues(); if (W32Kbd.SysMouCount == 0) { return(false); } else { W32Kbd.SysMouCount--; Event = W32Kbd.SysMouQue[0]; for (int i = W32Kbd.SysMouCount; i > 0; i--) { W32Kbd.SysMouQue[i] = W32Kbd.SysMouQue[i - 1]; } return(true); } }
public static Event GetMouseEvent() { byte B; uint CurTicks; SysMouseEvent SysMouseEvent; Event Event = new Event(); if (!MouseEvents) { Event.What = Event.Nothing; } else { if (!SysTVGetMouseEvent(out SysMouseEvent)) { MouseButtons = LastButtons; SysMouseEvent.smeTime = (int)W32Kbd.SysSysMouseCount(); SysMouseEvent.smePos.X = (short)MouseManager.MouseWhereX; SysMouseEvent.smePos.Y = (short)MouseManager.MouseWhereY; } else { if (MouseReverse) { B = 0; if ((SysMouseEvent.smeButtons & 0x0001) != 0) { B += 0x0002; } if ((SysMouseEvent.smeButtons & 0x0002) != 0) { B += 0x0001; } SysMouseEvent.smeButtons = B; } MouseButtons = SysMouseEvent.smeButtons; } CurTicks = (uint)SysMouseEvent.smeTime / 55; if ((LastButtons != 0) && (MouseButtons == 0)) { StoreEvent(Event.MouseUp, ref Event, SysMouseEvent); } else if (LastButtons == MouseButtons) { if ((SysMouseEvent.smePos.Y != MouseWhereY) || (SysMouseEvent.smePos.X != MouseWhereX)) { StoreEvent(Event.MouseMove, ref Event, SysMouseEvent); } else if ((MouseButtons != 0) && ((CurTicks - AutoTicks) >= AutoDelay)) { AutoTicks = CurTicks; AutoDelay = 1; StoreEvent(Event.MouseAuto, ref Event, SysMouseEvent); } else { StoreEvent(Event.Nothing, ref Event, SysMouseEvent); } } else { LastDouble = false; if ((MouseButtons == DownButtons) && (SysMouseEvent.smePos.Y == DownWhere.Y) && (SysMouseEvent.smePos.X == DownWhere.X) && (CurTicks - DownTicks) < DoubleDelay) { LastDouble = true; } DownButtons = MouseButtons; DownWhere.Y = SysMouseEvent.smePos.Y; DownWhere.X = SysMouseEvent.smePos.X; DownTicks = CurTicks; AutoTicks = CurTicks; AutoDelay = RepeatDelay; StoreEvent(Event.MouseDown, ref Event, SysMouseEvent); } } return(Event); }