From 97aefe5f83e104eb27d0e8ac4dc08dad73e7315f Mon Sep 17 00:00:00 2001 From: samhed Date: Mon, 23 Sep 2013 11:48:16 +0200 Subject: [PATCH 1/2] Enables local cursor by default. --- include/ui.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ui.js b/include/ui.js index b933d312..35334cba 100644 --- a/include/ui.js +++ b/include/ui.js @@ -75,7 +75,7 @@ start: function(callback) { UI.initSetting('password', ''); UI.initSetting('encrypt', (window.location.protocol === "https:")); UI.initSetting('true_color', true); - UI.initSetting('cursor', false); + UI.initSetting('cursor', true); UI.initSetting('shared', true); UI.initSetting('view_only', false); UI.initSetting('connectTimeout', 2); @@ -356,8 +356,8 @@ toggleSettingsPanel: function() { if (UI.rfb.get_display().get_cursor_uri()) { UI.updateSetting('cursor'); } else { - UI.updateSetting('cursor', false); - $D('noVNC_cursor').disabled = true; + UI.updateSetting('cursor', true); + $D('noVNC_cursor').disabled = false; } UI.updateSetting('clip'); UI.updateSetting('shared'); @@ -518,8 +518,8 @@ updateVisualState: function() { UI.rfb.get_display().get_cursor_uri()) { $D('noVNC_cursor').disabled = connected; } else { - UI.updateSetting('cursor', false); - $D('noVNC_cursor').disabled = true; + UI.updateSetting('cursor', true); + $D('noVNC_cursor').disabled = false; } $D('noVNC_shared').disabled = connected; $D('noVNC_view_only').disabled = connected; From 9b9e741b8cc5ebdd2754f4103ef54db864a347b2 Mon Sep 17 00:00:00 2001 From: samhed Date: Tue, 24 Sep 2013 11:19:17 +0200 Subject: [PATCH 2/2] On touch devices the default should be to use a remote cursor. --- include/ui.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/ui.js b/include/ui.js index 35334cba..c3436dc6 100644 --- a/include/ui.js +++ b/include/ui.js @@ -24,6 +24,7 @@ connSettingsOpen : false, popupStatusOpen : false, clipboardOpen: false, keyboardVisible: false, +isTouchDevice: false, // Setup rfb object, load settings from browser storage, then call // UI.init to setup the UI/menus @@ -35,6 +36,8 @@ load: function (callback) { start: function(callback) { var html = '', i, sheet, sheets, llevels, port; + UI.isTouchDevice = 'ontouchstart' in document.documentElement; + // Stylesheet selection dropdown sheet = WebUtil.selectStylesheet(); sheets = WebUtil.getStylesheets(); @@ -75,7 +78,7 @@ start: function(callback) { UI.initSetting('password', ''); UI.initSetting('encrypt', (window.location.protocol === "https:")); UI.initSetting('true_color', true); - UI.initSetting('cursor', true); + UI.initSetting('cursor', !UI.isTouchDevice); UI.initSetting('shared', true); UI.initSetting('view_only', false); UI.initSetting('connectTimeout', 2); @@ -97,7 +100,7 @@ start: function(callback) { // }; // Show mouse selector buttons on touch screen devices - if ('ontouchstart' in document.documentElement) { + if (UI.isTouchDevice) { // Show mobile buttons $D('noVNC_mobile_buttons').style.display = "inline"; UI.setMouseButton(); @@ -356,8 +359,8 @@ toggleSettingsPanel: function() { if (UI.rfb.get_display().get_cursor_uri()) { UI.updateSetting('cursor'); } else { - UI.updateSetting('cursor', true); - $D('noVNC_cursor').disabled = false; + UI.updateSetting('cursor', !UI.isTouchDevice); + $D('noVNC_cursor').disabled = true; } UI.updateSetting('clip'); UI.updateSetting('shared'); @@ -518,8 +521,8 @@ updateVisualState: function() { UI.rfb.get_display().get_cursor_uri()) { $D('noVNC_cursor').disabled = connected; } else { - UI.updateSetting('cursor', true); - $D('noVNC_cursor').disabled = false; + UI.updateSetting('cursor', !UI.isTouchDevice); + $D('noVNC_cursor').disabled = true; } $D('noVNC_shared').disabled = connected; $D('noVNC_view_only').disabled = connected;