summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2022-12-23 16:59:32 +0100
committerPierre Ossman <ossman@cendio.se>2022-12-27 12:50:57 +0100
commit5de478d6e7b70c080a4a64ec6deb590c773ca416 (patch)
treebb9b57185bb86faf1fda559f4e039873099cbea7
parent12a7c6f0de0ca51126c9a7292669c03f483049e0 (diff)
downloadnovnc-5de478d6e7b70c080a4a64ec6deb590c773ca416.tar.gz
Restrict forced panning to known bad platforms
Let's not punish systems that implement overlay scrollbars in a functional way. The only current example is Firefox on Windows 11 and on Linux.
-rw-r--r--app/ui.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/app/ui.js b/app/ui.js
index c277eea..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";
@@ -1326,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 {