summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/ui.js27
-rw-r--r--app/webutil.js4
2 files changed, 24 insertions, 7 deletions
diff --git a/app/ui.js b/app/ui.js
index ff0f176..c1f6776 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, hasScrollbarGutter, dragThreshold }
+import { isTouchDevice, isMac, isIOS, isAndroid, isChromeOS, isSafari,
+ hasScrollbarGutter, dragThreshold }
from '../core/util/browser.js';
import { setCapture, getPointerEvent } from '../core/util/events.js';
import KeyTable from "../core/input/keysym.js";
@@ -1049,6 +1050,7 @@ const UI = {
UI.rfb.addEventListener("serververification", UI.serverVerify);
UI.rfb.addEventListener("credentialsrequired", UI.credentials);
UI.rfb.addEventListener("securityfailure", UI.securityFailed);
+ UI.rfb.addEventListener("clippingviewport", UI.updateViewDrag);
UI.rfb.addEventListener("capabilities", UI.updatePowerButton);
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
UI.rfb.addEventListener("bell", UI.bell);
@@ -1325,13 +1327,25 @@ const UI = {
const scaling = UI.getSetting('resize') === 'scale';
+ // Some platforms have overlay scrollbars that are difficult
+ // to use in our case, which means we have to force panning
+ // FIXME: Working scrollbars can still be annoying to use with
+ // touch, so we should ideally be able to have both
+ // panning and scrollbars at the same time
+
+ let brokenScrollbars = false;
+
+ if (!hasScrollbarGutter) {
+ if (isIOS() || isAndroid() || isMac() || isChromeOS()) {
+ brokenScrollbars = true;
+ }
+ }
+
if (scaling) {
// Can't be clipping if viewport is scaled to fit
UI.forceSetting('view_clip', false);
UI.rfb.clipViewport = false;
- } else if (!hasScrollbarGutter) {
- // Some platforms have scrollbars that are difficult
- // to use in our case, so we always use our own panning
+ } else if (brokenScrollbars) {
UI.forceSetting('view_clip', true);
UI.rfb.clipViewport = true;
} else {
@@ -1362,7 +1376,8 @@ const UI = {
const viewDragButton = document.getElementById('noVNC_view_drag_button');
- if (!UI.rfb.clipViewport && UI.rfb.dragViewport) {
+ if ((!UI.rfb.clipViewport || !UI.rfb.clippingViewport) &&
+ UI.rfb.dragViewport) {
// We are no longer clipping the viewport. Make sure
// viewport drag isn't active when it can't be used.
UI.rfb.dragViewport = false;
@@ -1379,6 +1394,8 @@ const UI = {
} else {
viewDragButton.classList.add("noVNC_hidden");
}
+
+ viewDragButton.disabled = !UI.rfb.clippingViewport;
},
/* ------^-------
diff --git a/app/webutil.js b/app/webutil.js
index d42b7f2..084c69f 100644
--- a/app/webutil.js
+++ b/app/webutil.js
@@ -32,7 +32,7 @@ export function initLogging(level) {
export function getQueryVar(name, defVal) {
"use strict";
const re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
- match = ''.concat(document.location.href, window.location.hash).match(re);
+ match = ''.concat(document.location.href, window.location.hash).match(re);
if (typeof defVal === 'undefined') { defVal = null; }
if (match) {
@@ -46,7 +46,7 @@ export function getQueryVar(name, defVal) {
export function getHashVar(name, defVal) {
"use strict";
const re = new RegExp('.*[&#]' + name + '=([^&]*)'),
- match = document.location.hash.match(re);
+ match = document.location.hash.match(re);
if (typeof defVal === 'undefined') { defVal = null; }
if (match) {