Mercurial > hg > Applications > AliceVNC
view src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveServerInitMessage.java @ 1:a73b8a20e233
create another viewer window
author | one |
---|---|
date | Sat, 13 Sep 2014 04:57:52 +0900 |
parents | |
children | e046eb8a3ac1 |
line wrap: on
line source
package jp.ac.u_ryukyu.alicevnc; import com.glavsoft.drawing.Renderer; import com.glavsoft.rfb.IRepaintController; import com.glavsoft.rfb.encoding.ServerInitMessage; import com.glavsoft.rfb.protocol.Protocol; import com.glavsoft.rfb.protocol.ProtocolSettings; import com.glavsoft.viewer.Viewer; import com.glavsoft.viewer.cli.Parser; import com.glavsoft.viewer.swing.ParametersHandler; import com.glavsoft.viewer.swing.SwingViewerWindow; import com.glavsoft.viewer.swing.SwingViewerWindowFactory; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class ReceiveServerInitMessage extends CodeSegment { private Receiver info = ids.create(CommandType.PEEK); public ReceiveServerInitMessage(){ info.setKey("ServerInitMessage"); } public void run() { Parser parser = new Parser(); ParametersHandler.completeParserOptions(parser); if (parser.isSet(ParametersHandler.ARG_HELP)) { System.exit(0); } Viewer viewer = new Viewer(parser); SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(true, false, viewer); ProtocolSettings settings = ProtocolSettings.getDefaultSettings(); Protocol context = new Protocol(null, null, null, settings); ServerInitMessage serverInitMessage = info.asClass(ServerInitMessage.class); context.setPixelFormat(serverInitMessage.getPixelFormat()); context.setFbWidth(serverInitMessage.getFrameBufferWidth()); context.setFbHeight(serverInitMessage.getFrameBufferHeight()); context.setRemoteDesktopName(serverInitMessage.getName()); SwingViewerWindow viewerWindow = viewerWindowFactory.createViewerWindow(context, settings, viewer.getUiSettings(), null, null); IRepaintController repaintController = viewerWindow.getSurface(); Renderer renderer = repaintController.createRenderer(null, 1280, 800, context.getPixelFormat()); } }