Mercurial > hg > Applications > AliceVNC
view src/main/java/jp/ac/u_ryukyu/alicevnc/CreateWindow.java @ 56:9f1289c78b22
update maven change compressed DSM to only pixelData
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 16 Nov 2015 23:19:26 +0900 |
parents | 57ca704f86a3 |
children | fe627049e289 |
line wrap: on
line source
package jp.ac.u_ryukyu.alicevnc; import jp.ac.u_ryukyu.ie.cr.DecodeInfomation; import com.glavsoft.drawing.Renderer; import com.glavsoft.rfb.IRepaintController; import com.glavsoft.rfb.encoding.PixelFormat; 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 CreateWindow extends CodeSegment { private Receiver info = ids.create(CommandType.PEEK); public CreateWindow(String key){ info.setKey(key, "initMessage"); } public void run() { PixelFormat pixelFormat = null; int width = 0; int height = 0; String name = "defalut"; 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.setMessageQueue(new MyMessageQueue()); DecodeInfomation message = info.asClass(DecodeInfomation.class); pixelFormat = message.getPixelFormat(); width = message.width; height = message.height; name = message.name; ods.update("initMessage", message); context.setPixelFormat(pixelFormat); context.setFbWidth(width); context.setFbHeight(height); context.setRemoteDesktopName(name); SwingViewerWindow viewerWindow = viewerWindowFactory.createViewerWindow(context, settings, viewer.getUiSettings(), null, null); settings.setViewOnly(true); IRepaintController repaintController = viewerWindow.getSurface(); Renderer renderer = repaintController.createRenderer(null, width, height, context.getPixelFormat()); RenderAndControllerHolder holder = new RenderAndControllerHolder(renderer, repaintController, viewerWindow); ods.put("holder", holder); new ReceiveUpdateRectangle(); } }