From 3d3811b8f30e82d8e4474575fc0c31bb6cd08195 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sat, 5 Aug 2023 09:49:22 +0700 Subject: [PATCH] Disable the "Disable touch controller" setting on non-touchable devices --- better-xcloud.user.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/better-xcloud.user.js b/better-xcloud.user.js index 8c8306e..6c7f9d8 100644 --- a/better-xcloud.user.js +++ b/better-xcloud.user.js @@ -665,7 +665,7 @@ class Preferences { }, }, [Preferences.USE_DESKTOP_CODEC]: { - 'label': 'Force high-quality codec (if supported)', + 'label': 'Force high-quality codec', 'default': false, }, [Preferences.PREFER_IPV6_SERVER]: { @@ -1878,6 +1878,14 @@ function injectSettingsButton($parent) { $control.disabled = true; $control.title = 'Your browser doesn\'t support this feature'; $control.style.cursor = 'help'; + } else if (settingId === Preferences.STREAM_HIDE_TOUCH_CONTROLLER) { + // Disable this setting for non-touchable devices + if (!('ontouchstart'in window) && navigator.maxTouchPoints === 0) { + $control.checked = false; + $control.disabled = true; + $control.title = 'Your device doesn\'t have touch support'; + $control.style.cursor = 'help'; + } } }