Mercurial > hg > Applications > TreeVNC
annotate src/main/java/com/glavsoft/rfb/client/FramebufferUpdateRequestMessage.java @ 449:d5bcae14c2cd
reuse FrameUpdateRequest for all code
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 19 Jun 2016 17:53:13 +0900 |
parents | 344a35b7c47f |
children | aa3822daf75a |
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 |
448
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
27 import com.glavsoft.exceptions.TransportException; |
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
28 import com.glavsoft.transport.Writer; |
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
29 |
55 | 30 import java.util.Timer; |
31 import java.util.TimerTask; | |
32 | |
0
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 int height; |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 private final int width; |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 private final int y; |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 private final int x; |
55 | 39 |
40 private boolean sendFullScreenFlag; | |
56 | 41 |
0
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 public FramebufferUpdateRequestMessage(int x, int y, int width, |
448
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
43 int height, boolean fullScreen) { |
0
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 this.x = x; |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 this.y = y; |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 this.width = width; |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 this.height = height; |
448
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
48 this.sendFullScreenFlag = fullScreen; |
56 | 49 // sendFullScreenRequest(); |
0
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 } |
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 @Override |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 public void send(Writer writer) throws TransportException { |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 writer.writeByte(FRAMEBUFFER_UPDATE_REQUEST); |
55 | 55 if(sendFullScreenFlag) { |
56 writer.writeByte(0); | |
57 sendFullScreenFlag = false; | |
58 } else { | |
255 | 59 writer.writeByte(1); |
55 | 60 } |
0
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 writer.writeInt16(x); |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 writer.writeInt16(y); |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 writer.writeInt16(width); |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 writer.writeInt16(height); |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 writer.flush(); |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 } |
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 @Override |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 public String toString() { |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 return "FramebufferUpdateRequestMessage: [x: " + x + " y: " + y |
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 + " width: " + width + " height: " + height + |
448
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
72 " fullScreen: " + sendFullScreenFlag + "]"; |
0
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 } |
448
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
74 |
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
75 /** |
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
76 * start send full screen request timer |
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
77 * it is periodically executed |
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
78 * there is no way to stop this |
344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
255
diff
changeset
|
79 */ |
55 | 80 public void sendFullScreenRequest() { |
449
d5bcae14c2cd
reuse FrameUpdateRequest for all code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
448
diff
changeset
|
81 int sendFullScreenTimer = 50 * 1000; |
55 | 82 TimerTask tt = new TimerTask() { |
83 @Override | |
84 public void run() { | |
85 sendFullScreenFlag = true; | |
86 } | |
87 }; | |
88 Timer timer = new Timer(); | |
89 timer.schedule(tt, 0, sendFullScreenTimer); | |
90 } | |
0
4689cc86d6cb
create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 } |