Search in sources :

Example 1 with KeyOrder

use of common.KeyOrder in project cloudstack by apache.

the class AwtRdpKeyboardAdapter method handleData.

@Override
public void handleData(ByteBuffer buf, Link link) {
    if (verbose)
        System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
    KeyOrder order = (KeyOrder) buf.getOrder();
    buf.unref();
    ByteBuffer outBuf = new ByteBuffer(2, true);
    int scanCode = map_en_us(order.event);
    // eventHeader (1 byte): An 8-bit, unsigned integer. The format of this
    // field is the same as the eventHeader byte field described in section
    // 2.2.8.1.2.2. The eventCode bitfield (3 bits in size) MUST be set to
    // FASTPATH_INPUT_EVENT_SCANCODE (0). The eventFlags bitfield (5 bits in
    // size) contains flags describing the keyboard event.
    outBuf.writeByte((scanCode >> 8) | (FASTPATH_INPUT_EVENT_SCANCODE << 5) | ((order.pressed) ? 0 : FASTPATH_INPUT_KBDFLAGS_RELEASE));
    // keyCode (1 byte): An 8-bit, unsigned integer. The scancode of the key
    // which triggered the event.
    outBuf.writeByte(scanCode);
    // Push buffer to one pad only, so it can be modified without copying of
    // data
    pushDataToPad(STDOUT, outBuf);
}
Also used : KeyOrder(common.KeyOrder) ByteBuffer(streamer.ByteBuffer)

Example 2 with KeyOrder

use of common.KeyOrder in project cloudstack by apache.

the class AwtVncKeyboardAdapter method handleData.

@Override
public void handleData(ByteBuffer buf, Link link) {
    if (verbose)
        System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
    KeyOrder order = (KeyOrder) buf.getOrder();
    buf.unref();
    ByteBuffer outBuf = new ByteBuffer(8);
    outBuf.writeByte(RfbConstants.CLIENT_KEYBOARD_EVENT);
    outBuf.writeByte((order.pressed) ? RfbConstants.KEY_DOWN : RfbConstants.KEY_UP);
    // padding
    outBuf.writeShort(0);
    outBuf.writeInt(map_en_us(order));
    pushDataToAllOuts(outBuf);
}
Also used : KeyOrder(common.KeyOrder) ByteBuffer(streamer.ByteBuffer)

Aggregations

KeyOrder (common.KeyOrder)2 ByteBuffer (streamer.ByteBuffer)2