annotate src/main/java/com/glavsoft/rfb/client/FramebufferUpdateRequestMessage.java @ 61:d9cf08c6415c

During implementation change screen.
author Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
date Tue, 31 Dec 2013 09:13:07 +0900
parents 433c79184c05
children a931be447973
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1 // Copyright (C) 2010, 2011, 2012, 2013 GlavSoft LLC.
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 // All rights reserved.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 //-------------------------------------------------------------------------
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // This file is part of the TightVNC software. Please visit our Web site:
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // http://www.tightvnc.com/
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 // This program is free software; you can redistribute it and/or modify
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 // it under the terms of the GNU General Public License as published by
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 // the Free Software Foundation; either version 2 of the License, or
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 // (at your option) any later version.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 // This program is distributed in the hope that it will be useful,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 // GNU General Public License for more details.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 // You should have received a copy of the GNU General Public License along
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 // with this program; if not, write to the Free Software Foundation, Inc.,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 //-------------------------------------------------------------------------
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 package com.glavsoft.rfb.client;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
55
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
27 import java.util.Timer;
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
28 import java.util.TimerTask;
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
29
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 import com.glavsoft.exceptions.TransportException;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 import com.glavsoft.transport.Writer;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 public class FramebufferUpdateRequestMessage implements ClientToServerMessage {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 private final boolean incremental;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 private final int height;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 private final int width;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 private final int y;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 private final int x;
55
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
40
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
41 private boolean sendFullScreenFlag;
56
one
parents: 55
diff changeset
42
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 public FramebufferUpdateRequestMessage(int x, int y, int width,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 int height, boolean incremental) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 this.x = x;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 this.y = y;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 this.width = width;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 this.height = height;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 this.incremental = incremental;
56
one
parents: 55
diff changeset
50 // sendFullScreenRequest();
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 public void send(Writer writer) throws TransportException {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 writer.writeByte(FRAMEBUFFER_UPDATE_REQUEST);
55
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
56 if(sendFullScreenFlag) {
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
57 writer.writeByte(0);
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
58 sendFullScreenFlag = false;
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
59 } else {
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
60 writer.writeByte(incremental ? 1 : 0);
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
61 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 writer.writeInt16(x);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 writer.writeInt16(y);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 writer.writeInt16(width);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 writer.writeInt16(height);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 writer.flush();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 public String toString() {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 return "FramebufferUpdateRequestMessage: [x: " + x + " y: " + y
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 + " width: " + width + " height: " + height +
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 " incremental: " + incremental + "]";
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 }
55
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
75
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
76 public void sendFullScreenRequest() {
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
77 int sendFullScreenTimer = 5 * 1000;
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
78 TimerTask tt = new TimerTask() {
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
79 @Override
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
80 public void run() {
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
81 sendFullScreenFlag = true;
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
82 }
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
83 };
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
84 Timer timer = new Timer();
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
85 timer.schedule(tt, 0, sendFullScreenTimer);
9fdb8ff88497 change parameter.
one
parents: 0
diff changeset
86 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 }