annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
a73b8a20e233 create another viewer window
one
parents:
diff changeset
1 package jp.ac.u_ryukyu.alicevnc;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
2
a73b8a20e233 create another viewer window
one
parents:
diff changeset
3 import com.glavsoft.drawing.Renderer;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
4 import com.glavsoft.rfb.IRepaintController;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
5 import com.glavsoft.rfb.encoding.ServerInitMessage;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
6 import com.glavsoft.rfb.protocol.Protocol;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
7 import com.glavsoft.rfb.protocol.ProtocolSettings;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
8 import com.glavsoft.viewer.Viewer;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
9 import com.glavsoft.viewer.cli.Parser;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
10 import com.glavsoft.viewer.swing.ParametersHandler;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
11 import com.glavsoft.viewer.swing.SwingViewerWindow;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
12 import com.glavsoft.viewer.swing.SwingViewerWindowFactory;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
13
a73b8a20e233 create another viewer window
one
parents:
diff changeset
14 import alice.codesegment.CodeSegment;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
15 import alice.datasegment.CommandType;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
16 import alice.datasegment.Receiver;
a73b8a20e233 create another viewer window
one
parents:
diff changeset
17
a73b8a20e233 create another viewer window
one
parents:
diff changeset
18 public class ReceiveServerInitMessage extends CodeSegment {
a73b8a20e233 create another viewer window
one
parents:
diff changeset
19
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents: 1
diff changeset
20 private Receiver info = ids.create(CommandType.TAKE);
1
a73b8a20e233 create another viewer window
one
parents:
diff changeset
21
a73b8a20e233 create another viewer window
one
parents:
diff changeset
22
a73b8a20e233 create another viewer window
one
parents:
diff changeset
23 public ReceiveServerInitMessage(){
a73b8a20e233 create another viewer window
one
parents:
diff changeset
24 info.setKey("ServerInitMessage");
a73b8a20e233 create another viewer window
one
parents:
diff changeset
25 }
a73b8a20e233 create another viewer window
one
parents:
diff changeset
26
a73b8a20e233 create another viewer window
one
parents:
diff changeset
27 public void run() {
a73b8a20e233 create another viewer window
one
parents:
diff changeset
28
a73b8a20e233 create another viewer window
one
parents:
diff changeset
29 Parser parser = new Parser();
a73b8a20e233 create another viewer window
one
parents:
diff changeset
30 ParametersHandler.completeParserOptions(parser);
a73b8a20e233 create another viewer window
one
parents:
diff changeset
31 if (parser.isSet(ParametersHandler.ARG_HELP)) {
a73b8a20e233 create another viewer window
one
parents:
diff changeset
32 System.exit(0);
a73b8a20e233 create another viewer window
one
parents:
diff changeset
33 }
a73b8a20e233 create another viewer window
one
parents:
diff changeset
34 Viewer viewer = new Viewer(parser);
a73b8a20e233 create another viewer window
one
parents:
diff changeset
35 SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(true, false, viewer);
a73b8a20e233 create another viewer window
one
parents:
diff changeset
36 ProtocolSettings settings = ProtocolSettings.getDefaultSettings();
a73b8a20e233 create another viewer window
one
parents:
diff changeset
37 Protocol context = new Protocol(null, null, null, settings);
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents: 1
diff changeset
38 //context.createMessageQueue(); // need clear Queue
1
a73b8a20e233 create another viewer window
one
parents:
diff changeset
39 ServerInitMessage serverInitMessage = info.asClass(ServerInitMessage.class);
a73b8a20e233 create another viewer window
one
parents:
diff changeset
40 context.setPixelFormat(serverInitMessage.getPixelFormat());
a73b8a20e233 create another viewer window
one
parents:
diff changeset
41 context.setFbWidth(serverInitMessage.getFrameBufferWidth());
a73b8a20e233 create another viewer window
one
parents:
diff changeset
42 context.setFbHeight(serverInitMessage.getFrameBufferHeight());
a73b8a20e233 create another viewer window
one
parents:
diff changeset
43 context.setRemoteDesktopName(serverInitMessage.getName());
a73b8a20e233 create another viewer window
one
parents:
diff changeset
44
a73b8a20e233 create another viewer window
one
parents:
diff changeset
45 SwingViewerWindow viewerWindow = viewerWindowFactory.createViewerWindow(context, settings, viewer.getUiSettings(), null, null);
a73b8a20e233 create another viewer window
one
parents:
diff changeset
46 IRepaintController repaintController = viewerWindow.getSurface();
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents: 1
diff changeset
47 Renderer renderer = repaintController.createRenderer(null, serverInitMessage.getFrameBufferWidth(), serverInitMessage.getFrameBufferHeight(), context.getPixelFormat());
e046eb8a3ac1 succeed to repaint another viewer
YU
parents: 1
diff changeset
48 RenderAndControllerHolder holder = new RenderAndControllerHolder(renderer, repaintController);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents: 1
diff changeset
49 ods.put("Holder", holder);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents: 1
diff changeset
50
e046eb8a3ac1 succeed to repaint another viewer
YU
parents: 1
diff changeset
51 new ReceiveUpdateRectangle();
1
a73b8a20e233 create another viewer window
one
parents:
diff changeset
52 }
a73b8a20e233 create another viewer window
one
parents:
diff changeset
53
a73b8a20e233 create another viewer window
one
parents:
diff changeset
54 }