From f620259bc59dc18e91653918cdb513626a3af8dd Mon Sep 17 00:00:00 2001 From: samhed Date: Mon, 25 Apr 2016 16:38:23 +0200 Subject: [PATCH] Force clipping mode in Safari on all platforms --- include/ui.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/ui.js b/include/ui.js index 425e5a3b..cfdedb3a 100644 --- a/include/ui.js +++ b/include/ui.js @@ -35,6 +35,7 @@ var UI; keyboardVisible: false, isTouchDevice: false, + isSafari: false, rememberedClipSetting: null, lastKeyboardinput: null, defaultKeyboardinputLen: 100, @@ -137,12 +138,12 @@ var UI; UI.setBarPosition(); } ); - var isSafari = (navigator.userAgent.indexOf('Safari') != -1 && - navigator.userAgent.indexOf('Chrome') == -1); + UI.isSafari = (navigator.userAgent.indexOf('Safari') != -1 && + navigator.userAgent.indexOf('Chrome') == -1); // Only show the button if fullscreen is properly supported // * Safari doesn't support alphanumerical input while in fullscreen - if (!isSafari && + if (!UI.isSafari && (document.documentElement.requestFullscreen || document.documentElement.mozRequestFullScreen || document.documentElement.webkitRequestFullscreen || @@ -942,7 +943,12 @@ var UI; var resizeElem = $D('noVNC_resize'); var connected = UI.rfb && UI.rfb_state === 'normal'; - if (resizeElem.value === 'downscale' || resizeElem.value === 'scale') { + if (UI.isSafari) { + // Safari auto-hides the scrollbars which makes them + // impossible to use in most cases + UI.setViewClip(true); + $D('noVNC_clip').disabled = true; + } else if (resizeElem.value === 'downscale' || resizeElem.value === 'scale') { // Disable clipping if we are scaling UI.setViewClip(false); $D('noVNC_clip').disabled = true;