view src/main/java/jp/ac/u_ryukyu/treevnc/ChangeDesktopSize.java @ 448:344a35b7c47f

send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 18 Jun 2016 20:09:46 +0900
parents 614057b86122
children
line wrap: on
line source

package jp.ac.u_ryukyu.treevnc;

import com.glavsoft.rfb.encoding.EncodingType;

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

public class ChangeDesktopSize {

    private ByteBuffer msg;

    public ChangeDesktopSize(int fbwidth, int fbheight,int width, int height,
                             int x, int y, EncodingType desktopSize, byte[] initData, short id) {
        msg = ByteBuffer.allocate(16+10+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) fbwidth);
        msg.putShort((short) fbheight);
        msg.putInt(desktopSize.getId());
        msg.putInt(initData.length+6);
        msg.putShort(id);
        msg.putShort((short) width);
        msg.putShort((short)height);
        msg.put(initData);
        msg.flip();

    }

    public ByteBuffer getMessage(){
        return msg;
    }


}