summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2019-01-09 13:20:29 +0100
committerSamuel Mannehed <samuel@cendio.se>2019-01-09 14:59:22 +0100
commitef64917a9091a9a12e8245099d6b0b0fbac2f6e5 (patch)
treeec017eaeab6b69aaaf5f6ed2efc433f8c9214b22
parent47b3eac82bb01518a39a7c69d0e409b3d2812aa1 (diff)
downloadnovnc-scrollbarsfortouch.tar.gz
Only disable scrollbars on Android and iOSscrollbarsfortouch
Previously scrollbars were disabled on all touch devices. This meant that they were disabled on Windows when touch was detected. Windows does in fact have useful scrollbars even in touch mode. Fixes Issue #1172
-rw-r--r--app/ui.js7
-rw-r--r--core/util/browser.js4
2 files changed, 8 insertions, 3 deletions
diff --git a/app/ui.js b/app/ui.js
index 4e4aec7..a045bca 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -8,7 +8,8 @@
import * as Log from '../core/util/logging.js';
import _, { l10n } from './localization.js';
-import { isTouchDevice, isSafari, dragThreshold } from '../core/util/browser.js';
+import { isTouchDevice, isSafari, isIOS, isAndroid, dragThreshold }
+ from '../core/util/browser.js';
import { setCapture, getPointerEvent } from '../core/util/events.js';
import KeyTable from "../core/input/keysym.js";
import keysyms from "../core/input/keysymdef.js";
@@ -1243,8 +1244,8 @@ const UI = {
// Can't be clipping if viewport is scaled to fit
UI.forceSetting('view_clip', false);
UI.rfb.clipViewport = false;
- } else if (isTouchDevice) {
- // Touch devices usually have shit scrollbars
+ } else if (isIOS() || isAndroid()) {
+ // iOS and Android usually have shit scrollbars
UI.forceSetting('view_clip', true);
UI.rfb.clipViewport = true;
} else {
diff --git a/core/util/browser.js b/core/util/browser.js
index 088997b..026a31a 100644
--- a/core/util/browser.js
+++ b/core/util/browser.js
@@ -64,6 +64,10 @@ export function isIOS() {
!!(/ipod/i).exec(navigator.platform));
}
+export function isAndroid() {
+ return navigator && !!(/android/i).exec(navigator.userAgent);
+}
+
export function isSafari() {
return navigator && (navigator.userAgent.indexOf('Safari') !== -1 &&
navigator.userAgent.indexOf('Chrome') === -1);