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
cabecf89
Commit
cabecf89
authored
Jan 19, 2011
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
canvas.js: prevent Opera keyboard event bubbling.
Issue #8:
https://github.com/kanaka/noVNC/issues#issue/8
parent
b43c9838
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
22 deletions
+33
-22
canvas.js
include/canvas.js
+33
-22
No files found.
include/canvas.js
View file @
cabecf89
...
@@ -291,6 +291,17 @@ function onKeyUp(e) {
...
@@ -291,6 +291,17 @@ function onKeyUp(e) {
return
false
;
return
false
;
}
}
function
onKeyPress
(
e
)
{
//Util.Debug("keypress: " + e.charCode);
if
(
!
conf
.
focused
)
{
return
true
;
}
// Stop keypress events. Necessary for Opera because stopping
// keydown and keyup events still results in a keypress event.
Util
.
stopEvent
(
e
);
return
false
;
}
function
onMouseDisable
(
e
)
{
function
onMouseDisable
(
e
)
{
var
evt
,
pos
;
var
evt
,
pos
;
if
(
!
conf
.
focused
)
{
if
(
!
conf
.
focused
)
{
...
@@ -328,6 +339,7 @@ that.start = function(keyPressFunc, mouseButtonFunc, mouseMoveFunc) {
...
@@ -328,6 +339,7 @@ that.start = function(keyPressFunc, mouseButtonFunc, mouseMoveFunc) {
Util
.
addEvent
(
conf
.
focusContainer
,
'keydown'
,
onKeyDown
);
Util
.
addEvent
(
conf
.
focusContainer
,
'keydown'
,
onKeyDown
);
Util
.
addEvent
(
conf
.
focusContainer
,
'keyup'
,
onKeyUp
);
Util
.
addEvent
(
conf
.
focusContainer
,
'keyup'
,
onKeyUp
);
Util
.
addEvent
(
conf
.
focusContainer
,
'keypress'
,
onKeyPress
);
Util
.
addEvent
(
c
,
'mousedown'
,
onMouseDown
);
Util
.
addEvent
(
c
,
'mousedown'
,
onMouseDown
);
Util
.
addEvent
(
c
,
'mouseup'
,
onMouseUp
);
Util
.
addEvent
(
c
,
'mouseup'
,
onMouseUp
);
Util
.
addEvent
(
c
,
'mousemove'
,
onMouseMove
);
Util
.
addEvent
(
c
,
'mousemove'
,
onMouseMove
);
...
@@ -341,6 +353,27 @@ that.start = function(keyPressFunc, mouseButtonFunc, mouseMoveFunc) {
...
@@ -341,6 +353,27 @@ that.start = function(keyPressFunc, mouseButtonFunc, mouseMoveFunc) {
Util
.
Debug
(
"<< Canvas.start"
);
Util
.
Debug
(
"<< Canvas.start"
);
};
};
that
.
stop
=
function
()
{
var
c
=
conf
.
target
;
Util
.
removeEvent
(
conf
.
focusContainer
,
'keydown'
,
onKeyDown
);
Util
.
removeEvent
(
conf
.
focusContainer
,
'keyup'
,
onKeyUp
);
Util
.
removeEvent
(
conf
.
focusContainer
,
'keypress'
,
onKeyPress
);
Util
.
removeEvent
(
c
,
'mousedown'
,
onMouseDown
);
Util
.
removeEvent
(
c
,
'mouseup'
,
onMouseUp
);
Util
.
removeEvent
(
c
,
'mousemove'
,
onMouseMove
);
Util
.
removeEvent
(
c
,
(
Util
.
Engine
.
gecko
)
?
'DOMMouseScroll'
:
'mousewheel'
,
onMouseWheel
);
/* Work around right and middle click browser behaviors */
Util
.
removeEvent
(
conf
.
focusContainer
,
'click'
,
onMouseDisable
);
Util
.
removeEvent
(
conf
.
focusContainer
.
body
,
'contextmenu'
,
onMouseDisable
);
// Turn off cursor rendering
if
(
conf
.
cursor_uri
)
{
c
.
style
.
cursor
=
"default"
;
}
};
that
.
rescale
=
function
(
factor
)
{
that
.
rescale
=
function
(
factor
)
{
var
c
,
tp
,
x
,
y
,
var
c
,
tp
,
x
,
y
,
properties
=
[
'transform'
,
'WebkitTransform'
,
'MozTransform'
,
null
];
properties
=
[
'transform'
,
'WebkitTransform'
,
'MozTransform'
,
null
];
...
@@ -394,26 +427,6 @@ that.clear = function() {
...
@@ -394,26 +427,6 @@ that.clear = function() {
//conf.ctx.globalCompositeOperation = "copy";
//conf.ctx.globalCompositeOperation = "copy";
};
};
that
.
stop
=
function
()
{
var
c
=
conf
.
target
;
Util
.
removeEvent
(
conf
.
focusContainer
,
'keydown'
,
onKeyDown
);
Util
.
removeEvent
(
conf
.
focusContainer
,
'keyup'
,
onKeyUp
);
Util
.
removeEvent
(
c
,
'mousedown'
,
onMouseDown
);
Util
.
removeEvent
(
c
,
'mouseup'
,
onMouseUp
);
Util
.
removeEvent
(
c
,
'mousemove'
,
onMouseMove
);
Util
.
removeEvent
(
c
,
(
Util
.
Engine
.
gecko
)
?
'DOMMouseScroll'
:
'mousewheel'
,
onMouseWheel
);
/* Work around right and middle click browser behaviors */
Util
.
removeEvent
(
conf
.
focusContainer
,
'click'
,
onMouseDisable
);
Util
.
removeEvent
(
conf
.
focusContainer
.
body
,
'contextmenu'
,
onMouseDisable
);
// Turn off cursor rendering
if
(
conf
.
cursor_uri
)
{
c
.
style
.
cursor
=
"default"
;
}
};
that
.
flush
=
function
()
{
that
.
flush
=
function
()
{
var
old_val
;
var
old_val
;
//Util.Debug(">> flush");
//Util.Debug(">> flush");
...
@@ -706,9 +719,7 @@ function changeCursor(target, pixels, mask, hotx, hoty, w, h, cmap) {
...
@@ -706,9 +719,7 @@ function changeCursor(target, pixels, mask, hotx, hoty, w, h, cmap) {
}
}
url
=
"data:image/x-icon;base64,"
+
Base64
.
encode
(
cur
);
url
=
"data:image/x-icon;base64,"
+
Base64
.
encode
(
cur
);
Util
.
Info
(
url
);
target
.
style
.
cursor
=
"url("
+
url
+
") "
+
hotx
+
" "
+
hoty
+
", default"
;
target
.
style
.
cursor
=
"url("
+
url
+
") "
+
hotx
+
" "
+
hoty
+
", default"
;
//conf.target.style.cursor = "url(" + url + "), default";
//Util.Debug("<< changeCursor, cur.length: " + cur.length);
//Util.Debug("<< changeCursor, cur.length: " + cur.length);
};
};
...
...
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