summaryrefslogtreecommitdiff
path: root/app/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/ui.js')
-rw-r--r--app/ui.js27
1 files changed, 22 insertions, 5 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;
},
/* ------^-------