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
968431dd
Commit
968431dd
authored
Sep 17, 2013
by
samhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch input events to make the onscreen keyboard work in chrome on android.
parent
3cb89f5a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
6 deletions
+41
-6
ui.js
include/ui.js
+40
-5
vnc.html
vnc.html
+1
-1
No files found.
include/ui.js
View file @
968431dd
...
...
@@ -155,7 +155,8 @@ addMouseHandlers: function() {
$D
(
"noVNC_mouse_button2"
).
onclick
=
function
()
{
UI
.
setMouseButton
(
4
);
};
$D
(
"noVNC_mouse_button4"
).
onclick
=
function
()
{
UI
.
setMouseButton
(
0
);
};
$D
(
"showKeyboard"
).
onclick
=
UI
.
showKeyboard
;
//$D("keyboardinput").onkeydown = function (event) { onKeyDown(event); };
$D
(
"keyboardinput"
).
oninput
=
UI
.
keyInput
;
$D
(
"keyboardinput"
).
onblur
=
UI
.
keyInputBlur
;
$D
(
"sendCtrlAltDelButton"
).
onclick
=
UI
.
sendCtrlAltDel
;
...
...
@@ -701,17 +702,51 @@ setViewDrag: function(drag) {
// On touch devices, show the OS keyboard
showKeyboard
:
function
()
{
var
kbi
,
skb
,
l
;
kbi
=
$D
(
'keyboardinput'
);
skb
=
$D
(
'showKeyboard'
);
l
=
kbi
.
value
.
length
;
if
(
UI
.
keyboardVisible
===
false
)
{
$D
(
'keyboardinput'
).
focus
();
kbi
.
focus
();
kbi
.
setSelectionRange
(
l
,
l
);
// Move the caret to the end
UI
.
keyboardVisible
=
true
;
$D
(
'showKeyboard'
)
.
className
=
"noVNC_status_button_selected"
;
skb
.
className
=
"noVNC_status_button_selected"
;
}
else
if
(
UI
.
keyboardVisible
===
true
)
{
$D
(
'keyboardinput'
)
.
blur
();
$D
(
'showKeyboard'
)
.
className
=
"noVNC_status_button"
;
kbi
.
blur
();
skb
.
className
=
"noVNC_status_button"
;
UI
.
keyboardVisible
=
false
;
}
},
// When keypress events are left uncought, catch the input events from
// the keyboardinput element instead and send the corresponding key events.
keyInput
:
function
(
event
)
{
var
elem
,
input
,
len
;
elem
=
$D
(
'keyboardinput'
);
input
=
event
.
target
.
value
;
len
=
(
elem
.
selectionStart
>
input
.
length
)
?
elem
.
selectionStart
:
input
.
length
;
if
(
len
<
1
)
{
// something removed?
UI
.
rfb
.
sendKey
(
0xff08
);
// send BACKSPACE
}
else
if
(
len
>
1
)
{
// new input?
for
(
var
i
=
len
-
1
;
i
>
0
;
i
-=
1
)
{
// HTML does not consider trailing whitespaces as a part of the string
// and they are therefore undefined.
if
(
input
[
len
-
i
]
!==
undefined
)
{
UI
.
rfb
.
sendKey
(
input
.
charCodeAt
(
len
-
i
));
// send charCode
}
else
{
UI
.
rfb
.
sendKey
(
0x0020
);
// send SPACE
}
}
}
// In order to be able to delete text which has been written in
// another session there has to always be text in the
// keyboardinput element with which backspace can interact.
// We also need to reset the input field text to avoid overflow.
elem
.
value
=
"x"
;
},
keyInputBlur
:
function
()
{
$D
(
'showKeyboard'
).
className
=
"noVNC_status_button"
;
//Weird bug in iOS if you change keyboardVisible
...
...
vnc.html
View file @
968431dd
...
...
@@ -67,7 +67,7 @@
id=
"showKeyboard"
class=
"noVNC_status_button"
value=
"Keyboard"
title=
"Show Keyboard"
/>
<input
type=
"email"
autocapitalize=
"off"
autocorrect=
"off"
id=
"keyboardinput"
class=
""
/>
id=
"keyboardinput"
class=
""
value=
" "
/>
</div>
</div>
...
...
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