Mercurial > hg > Applications > AliceVNC
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:9973439e03ad | 1:a73b8a20e233 |
---|---|
1 package jp.ac.u_ryukyu.alicevnc; | |
2 | |
3 import com.glavsoft.drawing.Renderer; | |
4 import com.glavsoft.rfb.IRepaintController; | |
5 import com.glavsoft.rfb.encoding.ServerInitMessage; | |
6 import com.glavsoft.rfb.protocol.Protocol; | |
7 import com.glavsoft.rfb.protocol.ProtocolSettings; | |
8 import com.glavsoft.viewer.Viewer; | |
9 import com.glavsoft.viewer.cli.Parser; | |
10 import com.glavsoft.viewer.swing.ParametersHandler; | |
11 import com.glavsoft.viewer.swing.SwingViewerWindow; | |
12 import com.glavsoft.viewer.swing.SwingViewerWindowFactory; | |
13 | |
14 import alice.codesegment.CodeSegment; | |
15 import alice.datasegment.CommandType; | |
16 import alice.datasegment.Receiver; | |
17 | |
18 public class ReceiveServerInitMessage extends CodeSegment { | |
19 | |
20 private Receiver info = ids.create(CommandType.PEEK); | |
21 | |
22 | |
23 public ReceiveServerInitMessage(){ | |
24 info.setKey("ServerInitMessage"); | |
25 } | |
26 | |
27 public void run() { | |
28 | |
29 Parser parser = new Parser(); | |
30 ParametersHandler.completeParserOptions(parser); | |
31 if (parser.isSet(ParametersHandler.ARG_HELP)) { | |
32 System.exit(0); | |
33 } | |
34 Viewer viewer = new Viewer(parser); | |
35 SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(true, false, viewer); | |
36 ProtocolSettings settings = ProtocolSettings.getDefaultSettings(); | |
37 Protocol context = new Protocol(null, null, null, settings); | |
38 | |
39 ServerInitMessage serverInitMessage = info.asClass(ServerInitMessage.class); | |
40 context.setPixelFormat(serverInitMessage.getPixelFormat()); | |
41 context.setFbWidth(serverInitMessage.getFrameBufferWidth()); | |
42 context.setFbHeight(serverInitMessage.getFrameBufferHeight()); | |
43 context.setRemoteDesktopName(serverInitMessage.getName()); | |
44 | |
45 SwingViewerWindow viewerWindow = viewerWindowFactory.createViewerWindow(context, settings, viewer.getUiSettings(), null, null); | |
46 IRepaintController repaintController = viewerWindow.getSurface(); | |
47 Renderer renderer = repaintController.createRenderer(null, 1280, 800, context.getPixelFormat()); | |
48 | |
49 } | |
50 | |
51 } |