Skip to content

Commit 57a1114

Browse files
mangolioufcwu
authored andcommitted
toolbar with scale and quality.
1 parent 6174fa3 commit 57a1114

File tree

10 files changed

+454
-38
lines changed

10 files changed

+454
-38
lines changed

noVNC/custom.css

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
.custom_toolbar {
2+
position: absolute;
3+
width: 52px;
4+
height: 99.5%;
5+
top: 0px;
6+
left: -65px;
7+
z-index: 100;
8+
padding: 2px;
9+
background-color: #EEEEEE;
10+
box-shadow: 1px 0 5px #000000;
11+
}
12+
13+
.custom_toolbar_divider1 {
14+
width: 40px;
15+
height: 1px;
16+
margin: 5px;
17+
background-color: #000;
18+
opacity: 0.1;
19+
}
20+
21+
.custom_toolbar_divider2 {
22+
width: 40px;
23+
height: 1px;
24+
margin: 5px;
25+
background-color: #000;
26+
opacity: 0.0;
27+
}
28+
29+
.custom_toolbar_clicker {
30+
position: absolute;
31+
width: 43px;
32+
height: 36px;
33+
margin-top: -2px;
34+
margin-left: 54px;
35+
line-height: 60px;
36+
text-align: center;
37+
opacity: 1.0;
38+
cursor: pointer;
39+
background-repeat: no-repeat;
40+
background-position: center;
41+
background-image: url(images/pop_more.png);
42+
}
43+
44+
.custom_toolbar_btn {
45+
width: 40px;
46+
height: 20px;
47+
48+
font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
49+
font-size: 13px;
50+
line-height: 20px;
51+
text-align: center;
52+
margin: 15px 5px 15px 5px;
53+
54+
border: 1px solid #bbbbbb;
55+
border-radius: 4px;
56+
color: #33444E;
57+
background-color: #EEEEEE;
58+
box-shadow: 0px 0px 3px #bbbbbb;
59+
cursor: pointer;
60+
}
61+
62+
.custom_toolbar_btn_hover {
63+
-webkit-box-shadow: inset 0px 0px 5px 2px rgba(0,0,0,0.3);
64+
-moz-box-shadow: inset 0px 0px 5px 2px rgba(0,0,0,0.3);
65+
box-shadow: inset 0px 0px 5px 2px rgba(0,0,0,0.3);
66+
}
67+
68+
.custom_toolbar_btn_selected {
69+
background-color: #bfbfbf;
70+
}
71+
72+
.custom_mask {
73+
top: 0px;
74+
left: 0px;
75+
display: none;;
76+
position: absolute;
77+
background-color: #000;
78+
opacity: 0.5;
79+
z-index: 200;
80+
}
81+
82+
.custom_pause_icon {
83+
background-repeat: no-repeat;
84+
background-position: center;
85+
background-image: url("images/pause.png");
86+
}
87+
88+
.custom_resume_icon {
89+
background-repeat: no-repeat;
90+
background-position: center;
91+
background-image: url("images/resume.png");
92+
}
93+
94+
.custom_scale_icon {
95+
background-repeat: no-repeat;
96+
background-position: center;
97+
background-image: url("images/scale.png");
98+
}
99+
100+
.custom_not_scale_icon {
101+
background-repeat: no-repeat;
102+
background-position: center;
103+
background-image: url("images/not_scale.png");
104+
}
105+
106+
.custom_quality_icon {
107+
margin: 3px 0px 0px 8px;
108+
width: 24px;
109+
height: 14px;
110+
border-radius: 12px;
111+
color: #fff;
112+
background-color: #4d4d4d;
113+
font-size: 12px;
114+
line-height: 14px;
115+
font-weight: bolder;
116+
}

noVNC/images/not_scale.png

401 Bytes
Loading

noVNC/images/pause.png

2.76 KB
Loading

noVNC/images/pop_less.png

1.11 KB
Loading

noVNC/images/pop_more.png

1.1 KB
Loading

noVNC/images/resume.png

2.89 KB
Loading

noVNC/images/scale.png

1.22 KB
Loading

noVNC/include/rfb.js

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,6 @@ var RFB;
3535
this._rfb_tightvnc = false;
3636
this._rfb_xvp_ver = 0;
3737

38-
// In preference order
39-
this._encodings = [
40-
['COPYRECT', 0x01 ],
41-
['TIGHT', 0x07 ],
42-
['TIGHT_PNG', -260 ],
43-
['HEXTILE', 0x05 ],
44-
['RRE', 0x02 ],
45-
['RAW', 0x00 ],
46-
['DesktopSize', -223 ],
47-
['Cursor', -239 ],
48-
49-
// Psuedo-encoding settings
50-
//['JPEG_quality_lo', -32 ],
51-
['JPEG_quality_med', -26 ],
52-
//['JPEG_quality_hi', -23 ],
53-
//['compress_lo', -255 ],
54-
['compress_hi', -247 ],
55-
['last_rect', -224 ],
56-
['xvp', -309 ],
57-
['ExtendedDesktopSize', -308 ]
58-
];
59-
6038
this._encHandlers = {};
6139
this._encNames = {};
6240
this._encStats = {};
@@ -131,7 +109,6 @@ var RFB;
131109
'wsProtocols': ['binary', 'base64'], // Protocols to use in the WebSocket connection
132110
'repeaterID': '', // [UltraVNC] RepeaterID to connect to
133111
'viewportDrag': false, // Move the viewport on mouse drags
134-
135112
// Callback functions
136113
'onUpdateState': function () { }, // onUpdateState(rfb, state, oldstate, statusMsg): state update/change
137114
'onPasswordRequired': function () { }, // onPasswordRequired(rfb): VNC password is required
@@ -144,6 +121,53 @@ var RFB;
144121
'onXvpInit': function () { }, // onXvpInit(version): XVP extensions active for this connection
145122
});
146123

124+
try{
125+
// Use my custom 'jpeg_quality'.
126+
this._encodings = [
127+
// ['COPYRECT', 0x01 ],
128+
['TIGHT', 0x07 ],
129+
['TIGHT_PNG', -260 ],
130+
['HEXTILE', 0x05 ],
131+
['RRE', 0x02 ],
132+
['RAW', 0x00 ],
133+
['DesktopSize', -223 ],
134+
['Cursor', -239 ],
135+
136+
// Psuedo-encoding settings
137+
['JPEG_quality_lo', -32 + jpeg_quality ],
138+
// ['JPEG_quality_med', -28 ],
139+
// ['JPEG_quality_hi', -23 ],
140+
// ['compress_lo', -255 ],
141+
['compress_hi', -247 ],
142+
['last_rect', -224 ],
143+
['xvp', -309 ],
144+
['ExtendedDesktopSize', -308 ]
145+
];
146+
}
147+
catch(e){
148+
// If my custom 'jpeg_quality' is not defined, just use default setting.
149+
this._encodings = [
150+
['COPYRECT', 0x01 ],
151+
['TIGHT', 0x07 ],
152+
['TIGHT_PNG', -260 ],
153+
['HEXTILE', 0x05 ],
154+
['RRE', 0x02 ],
155+
['RAW', 0x00 ],
156+
['DesktopSize', -223 ],
157+
['Cursor', -239 ],
158+
159+
// Psuedo-encoding settings
160+
//['JPEG_quality_lo', -32 ],
161+
['JPEG_quality_med', -26 ],
162+
//['JPEG_quality_hi', -23 ],
163+
//['compress_lo', -255 ],
164+
['compress_hi', -247 ],
165+
['last_rect', -224 ],
166+
['xvp', -309 ],
167+
['ExtendedDesktopSize', -308 ]
168+
];
169+
}
170+
147171
// main setup
148172
Util.Debug(">> RFB.constructor");
149173

noVNC/include/util.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,16 @@ Util.getEventPosition = function (e, obj, scale) {
468468
var realy = docY - pos.y;
469469
var x = Math.max(Math.min(realx, pos.width - 1), 0);
470470
var y = Math.max(Math.min(realy, pos.height - 1), 0);
471-
return {'x': x / scale, 'y': y / scale, 'realx': realx / scale, 'realy': realy / scale};
471+
472+
try{
473+
// Use my custom 'Scale' rate.
474+
return {'x': x / Scale.x, 'y': y / Scale.y, 'realx': realx / Scale.x, 'realy': realy / Scale.y};
475+
}
476+
catch(e){
477+
// If my custom 'Scale' is not defined, just use default 'scale'.
478+
return {'x': x / scale, 'y': y / scale, 'realx': realx / scale, 'realy': realy / scale};
479+
}
480+
472481
};
473482

474483

0 commit comments

Comments
 (0)