Mercurial > hg > Applications > AliceVNC
view src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveServerInitMessage.java @ 2:e046eb8a3ac1
succeed to repaint another viewer
author | YU |
---|---|
date | Sat, 13 Sep 2014 07:09:27 +0900 |
parents | a73b8a20e233 |
children | 9d932f70b29a |
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.TAKE); 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); //context.createMessageQueue(); // need clear Queue 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, serverInitMessage.getFrameBufferWidth(), serverInitMessage.getFrameBufferHeight(), context.getPixelFormat()); RenderAndControllerHolder holder = new RenderAndControllerHolder(renderer, repaintController); ods.put("Holder", holder); new ReceiveUpdateRectangle(); } }