refact: option, touch mode, move to local (#13055)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-10-17 01:36:46 -04:00
committed by GitHub
parent 2fbc0625de
commit d0a360fd80
3 changed files with 16 additions and 7 deletions

View File

@@ -1107,9 +1107,20 @@ class FfiModel with ChangeNotifier {
if (isPeerAndroid) {
_touchMode = true;
} else {
_touchMode = await bind.sessionGetOption(
sessionId: sessionId, arg: kOptionTouchMode) !=
'';
// `kOptionTouchMode` is originally peer option, but it is moved to local option later.
// We check local option first, if not set, then check peer option.
// Because if local option is not empty:
// 1. User has set the touch mode explicitly.
// 2. The advanced option (custom client) is set.
// Then we choose to use the local option.
final optLocal = bind.mainGetLocalOption(key: kOptionTouchMode);
if (optLocal != '') {
_touchMode = optLocal == 'Y';
} else {
final optSession = await bind.sessionGetOption(
sessionId: sessionId, arg: kOptionTouchMode);
_touchMode = optSession != '';
}
}
if (isMobile) {
virtualMouseMode.loadOptions();