Commit 7825b9ee authored by Chris Gordon's avatar Chris Gordon Committed by Joel Martin

Added support for native iOS and Android keyboards.

Tested with Safari on iPad for iOS and Asus Transformer for Android.
parent 46c62117
......@@ -64,6 +64,7 @@ load: function(target) {
html += ' id="VNC_mouse_button2" value="M" onclick="UI.setMouseButton(2);"';
html += ' ><input type="button" class="VNC_status_button"';
html += ' id="VNC_mouse_button4" value="R" onclick="UI.setMouseButton(4);">';
html += ' <input type="button" id="showKeyboard" onclick="showkeyboard()" value="Keyboard" />';
html += ' </span></nobr></div></td>';
// Settings drop-down menu
......@@ -122,6 +123,7 @@ load: function(target) {
html += ' <canvas id="VNC_canvas" width="640px" height="20px">';
html += ' Canvas not supported.';
html += ' </canvas>';
html += '<input id="keyboardinput" style="border:none;" type="text" onKeyDown="onKeyDown(event);"/>';
html += '</div>';
html += '<br><br>';
html += '<div id="VNC_clipboard">';
......@@ -472,3 +474,40 @@ clipSend: function() {
}
};
/*
Functions for use of mobile devices native keyboards
Added by Chris Gordon
http://www.chrisgordon.com.au
Date: 23/08/2011
*/
function showkeyboard(){
//Get Current Scroll Position of Browser
var scrollx = (document.all)?document.body.scrollLeft:window.pageXOffset;
var scrolly = (document.all)?document.body.scrollTop:window.pageYOffset;
//Stop browser zooming on textbox when focus is set.
zoomDisable();
//Focus on hidden textbox to bring up native keyboard.
document.getElementById('keyboardinput').focus();
//Set scroll position of browser to the same position it was prior to focus.
scroll(scrollx,scrolly);
//Renable user zooming.
zoomEnable();
}
function zoomDisable(){
//Change viewport meta data to disable zooming.
$('head meta[name=viewport]').remove();
$('head').prepend('<meta name="viewport" content="user-scalable=0" />');
}
function zoomEnable(){
//Change viewport meta data to enable user zooming.
$('head meta[name=viewport]').remove();
$('head').prepend('<meta name="viewport" content="user-scalable=1" />');
}
......@@ -10,15 +10,16 @@
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link rel="stylesheet" href="include/plain.css">
<link rel="alternate stylesheet" href="include/black.css" TITLE="Black">
<!--
<script type='text/javascript'
<script type='text/javascript'
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
-->
<script src="include/vnc.js"></script>
<script src="include/ui.js"></script>
</head>
<body>
<body onKeyDown="onKeyDown(event);">
<div id='vnc'>Loading</div>
<script>
......
......@@ -19,7 +19,7 @@
<script src="include/vnc.js"></script>
</head>
<body style="margin: 0px;">
<body style="margin: 0px;" onKeyDown="onKeyDown(event);">
<div id="VNC_screen">
<div id="VNC_status_bar" class="VNC_status_bar" style="margin-top: 0px;">
<table border=0 width="100%"><tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment