view src/main/java/jp/ac/u_ryukyu/treevnc/ChangeDesktopSize.java @ 441:cee43ceac9b3

send thatscreen position INIT_DATA
author one
date Thu, 16 Jun 2016 21:08:19 +0900
parents eaf6dbcb42dc
children 614057b86122
line wrap: on
line source

package jp.ac.u_ryukyu.treevnc;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import com.glavsoft.rfb.encoding.EncodingType;

public class ChangeDesktopSize {

    private ByteBuffer msg;

    public ChangeDesktopSize(int width, int height,
                             int x, int y, EncodingType desktopSize, byte[] initData, short id) {
        msg = ByteBuffer.allocate(16+4+initData.length).order(ByteOrder.BIG_ENDIAN);
        msg.put((byte) 0); // FrameBufferUpdate
        msg.put((byte) 0); // padding
        msg.putShort((short) 1); // number of rectangle
        msg.putShort((short) x);
        msg.putShort((short) y);
        msg.putShort((short) width);
        msg.putShort((short) height);
        msg.putInt(desktopSize.getId());
        msg.putInt(initData.length+2);
        msg.putShort(id);
        msg.put(initData);
        msg.flip();

    }

    public ByteBuffer getMessage(){
        return msg;
    }


}