Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
8a837006
Commit
8a837006
authored
Jun 10, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More dynamic encoding list handling.
parent
c3d28aab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
31 deletions
+34
-31
vnc.js
vnc.js
+34
-31
No files found.
vnc.js
View file @
8a837006
...
@@ -56,15 +56,15 @@ RFB = {
...
@@ -56,15 +56,15 @@ RFB = {
*/
*/
clipboardFocus
:
false
,
clipboardFocus
:
false
,
// In preference order
encodings
:
[
encodings
:
[
1
,
// COPYRECT, should always be first
[
'COPYRECT'
,
0x01
,
'display_copy_rect'
],
0x17
,
// TIGHT_PNG
[
'TIGHT_PNG'
,
0x17
,
'display_tight_png'
],
Math
.
pow
(
2
,
32
)
-
32
,
// JPEG quality pseudo-encoding
[
'HEXTILE'
,
0x05
,
'display_hextile'
],
5
,
// HEXTILE
[
'RRE'
,
0x02
,
'display_rre'
],
2
,
// RRE
[
'RAW'
,
0x00
,
'display_raw'
],
0
// RAW
[
'JPEG quality'
,
Math
.
pow
(
2
,
32
)
-
32
,
'set_jpeg_quality'
],
],
[
'DesktopSize'
,
Math
.
pow
(
2
,
32
)
-
223
,
'set_desktopsize'
]
],
setUpdateState
:
function
(
externalUpdateState
)
{
setUpdateState
:
function
(
externalUpdateState
)
{
RFB
.
externalUpdateState
=
externalUpdateState
;
RFB
.
externalUpdateState
=
externalUpdateState
;
...
@@ -85,6 +85,7 @@ setPassword: function(passwd) {
...
@@ -85,6 +85,7 @@ setPassword: function(passwd) {
},
},
load
:
function
()
{
load
:
function
()
{
var
i
;
//console.log(">> load");
//console.log(">> load");
/* Load web-socket-js if no builtin WebSocket support */
/* Load web-socket-js if no builtin WebSocket support */
...
@@ -108,6 +109,13 @@ load: function () {
...
@@ -108,6 +109,13 @@ load: function () {
}
}
}
}
// Populate encoding lookup tables
RFB
.
encHandlers
=
{};
RFB
.
encNames
=
{};
for
(
i
=
0
;
i
<
RFB
.
encodings
.
length
;
i
++
)
{
RFB
.
encHandlers
[
RFB
.
encodings
[
i
][
1
]]
=
RFB
[
RFB
.
encodings
[
i
][
2
]];
RFB
.
encNames
[
RFB
.
encodings
[
i
][
1
]]
=
RFB
.
encodings
[
i
][
0
];
}
//console.log("<< load");
//console.log("<< load");
},
},
...
@@ -189,6 +197,9 @@ RQ_reorder : [], // Receive Queue re-order list
...
@@ -189,6 +197,9 @@ RQ_reorder : [], // Receive Queue re-order list
RQ_seq_num
:
0
,
// Expected sequence number
RQ_seq_num
:
0
,
// Expected sequence number
SQ
:
""
,
// Send Queue
SQ
:
""
,
// Send Queue
encHandlers
:
{},
encNames
:
{},
// Frame buffer update state
// Frame buffer update state
FBU
:
{
FBU
:
{
rects
:
0
,
rects
:
0
,
...
@@ -495,33 +506,25 @@ normal_msg: function () {
...
@@ -495,33 +506,25 @@ normal_msg: function () {
// Debug:
// Debug:
/*
/*
msg = "FramebufferUpdate rects:" + FBU.rects +
if (RFB.encNames[FBU.encoding]) {
" encoding:" + FBU.encoding
msg = "FramebufferUpdate rects:" + FBU.rects;
switch (FBU.encoding) {
msg += " encoding:" + FBU.encoding;
case 0: msg += "(RAW)"; break;
msg += "(" + RFB.encNames[FBU.encoding] + ")";
case 1: msg += "(COPYRECT)"; break;
msg += ", RQ.length: " + RQ.length;
case 2: msg += "(RRE)"; break;
console.log(msg);
case 5: msg += "(HEXTILE)"; break;
} else {
case 7: msg += "(TIGHT_PNG)"; break;
default:
RFB.updateState('failed',
RFB.updateState('failed',
"Disconnected: unsupported encoding " +
"Disconnected: unsupported encoding " +
FBU.encoding);
FBU.encoding);
return false;
return false;
}
}
msg += ", RQ.length: " + RQ.length
console.log(msg);
*/
*/
}
}
RFB
.
timing
.
last_fbu
=
(
new
Date
()).
getTime
();
RFB
.
timing
.
last_fbu
=
(
new
Date
()).
getTime
();
switch
(
FBU
.
encoding
)
{
case
0
:
ret
=
RFB
.
display_raw
();
break
;
// Raw
ret
=
RFB
.
encHandlers
[
FBU
.
encoding
]();
case
1
:
ret
=
RFB
.
display_copy_rect
();
break
;
// CopyRect
case
2
:
ret
=
RFB
.
display_rre
();
break
;
// RRE
case
5
:
ret
=
RFB
.
display_hextile
();
break
;
// hextile
case
7
:
ret
=
RFB
.
display_tight_png
();
break
;
// tight_png
}
now
=
(
new
Date
()).
getTime
();
now
=
(
new
Date
()).
getTime
();
RFB
.
timing
.
cur_fbu
+=
(
now
-
RFB
.
timing
.
last_fbu
);
RFB
.
timing
.
cur_fbu
+=
(
now
-
RFB
.
timing
.
last_fbu
);
if
(
FBU
.
rects
===
0
)
{
if
(
FBU
.
rects
===
0
)
{
...
@@ -970,7 +973,7 @@ clientEncodings: function () {
...
@@ -970,7 +973,7 @@ clientEncodings: function () {
arr
.
push16
(
RFB
.
encodings
.
length
);
// encoding count
arr
.
push16
(
RFB
.
encodings
.
length
);
// encoding count
for
(
i
=
0
;
i
<
RFB
.
encodings
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
RFB
.
encodings
.
length
;
i
++
)
{
arr
.
push32
(
RFB
.
encodings
[
i
]);
arr
.
push32
(
RFB
.
encodings
[
i
]
[
1
]
);
}
}
console
.
log
(
"<< setEncodings: "
+
arr
);
console
.
log
(
"<< setEncodings: "
+
arr
);
return
arr
;
return
arr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment