Search in sources :

Example 1 with MouseOrder

use of common.MouseOrder in project cloudstack by apache.

the class AwtRdpMouseAdapter method handleData.

@Override
public void handleData(ByteBuffer buf, Link link) {
    if (verbose)
        System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
    // Get mouse event
    MouseOrder order = (MouseOrder) buf.getOrder();
    ByteBuffer outBuf = new ByteBuffer(7, true);
    // eventHeader (1 byte): An 8-bit, unsigned integer. EventCode bitfield (top
    // 3 bits) MUST be set to FASTPATH_INPUT_EVENT_MOUSE (1). The
    // eventFlags bitfield (low 5 bits) MUST be zeroed out.
    outBuf.writeByte(FASTPATH_INPUT_EVENT_MOUSE << 5);
    // pointerFlags (2 bytes): A 16-bit, unsigned integer.
    outBuf.writeShortLE(getPointerFlags(order));
    // xPos (2 bytes): A 16-bit, unsigned integer. The x-coordinate of the
    // pointer.
    outBuf.writeShortLE(order.event.getX());
    // yPos (2 bytes): A 16-bit, unsigned integer. The y-coordinate of the
    // pointer.
    outBuf.writeShortLE(order.event.getY());
    // Push buffer to one pad only, so it can be modified without copying of
    // data
    pushDataToPad(STDOUT, outBuf);
}
Also used : MouseOrder(common.MouseOrder) ByteBuffer(streamer.ByteBuffer)

Example 2 with MouseOrder

use of common.MouseOrder in project cloudstack by apache.

the class AwtVncMouseAdapter method handleData.

@Override
public void handleData(ByteBuffer buf, Link link) {
    if (verbose)
        System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
    // Get mouse event
    MouseOrder order = (MouseOrder) buf.getOrder();
    ByteBuffer outBuf = new ByteBuffer(6);
    outBuf.writeByte(RfbConstants.CLIENT_POINTER_EVENT);
    int buttonMask = mapAwtModifiersToVncButtonMask(order.event.getModifiersEx());
    outBuf.writeByte(buttonMask);
    outBuf.writeShort(order.event.getX());
    outBuf.writeShort(order.event.getY());
    pushDataToAllOuts(outBuf);
}
Also used : MouseOrder(common.MouseOrder) ByteBuffer(streamer.ByteBuffer)

Aggregations

MouseOrder (common.MouseOrder)2 ByteBuffer (streamer.ByteBuffer)2