public override void run()
        {
            HIDCommand hidCommand = null;

            if (!commands.TryDequeue(out hidCommand))
            {
                return;
            }

            if (hidCommand is MouseCommand)
            {
                MouseCommand cmd = (MouseCommand)hidCommand;
                // if (cmd.eventType == MouseCommand.MOUSE_MOVE) MouseCtrl.mouseMove(cmd.x, cmd.y);
                if (cmd.eventType == MouseCommand.MOUSE_DOWN)
                {
                    MouseCtrl.mouseDown(cmd.x, cmd.y, cmd.key);
                }
                else if (cmd.eventType == MouseCommand.MOUSE_UP)
                {
                    MouseCtrl.mouseUp(cmd.x, cmd.y, cmd.key);
                }
                else if (cmd.eventType == MouseCommand.MOUSE_WHEEL)
                {
                    MouseCtrl.mouseScroll(cmd.x, cmd.y, cmd.key);
                }
            }
            else if (hidCommand is KeyboardCommand)
            {
                // TODO: 键盘指令
            }
        }
예제 #2
0
        // 键鼠事件
        public Packet hidCommandExec(Packet packet)
        {
            int        hidType    = packet.nextByte() & 0xff;
            int        eventType  = packet.nextByte() & 0xff;
            int        key        = packet.nextByte() & 0xff;
            short      x          = packet.nextShort();
            short      y          = packet.nextShort();
            int        timestamp  = packet.nextInt() & 0x7fffffff;
            HIDCommand hidCommand = null;

            if (hidType == HIDCommand.TYPE_MOUSE)
            {
                hidCommand = new MouseCommand(eventType, key, x, y, timestamp);
                hidExecutor.add(hidCommand);
            }
            else
            {
                hidCommand = new KeyboardCommand(key, eventType, timestamp);
            }
            return(null);
        }
 public void add(HIDCommand cmd)
 {
     commands.Enqueue(cmd);
 }