mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-02-17 22:11:30 +08:00
feat, trackpad speed (#11680)
* feat, trackpad speed Signed-off-by: fufesou <linlong1266@gmail.com> * comments Signed-off-by: fufesou <linlong1266@gmail.com> * Trackpad speed, user default value Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -76,7 +76,9 @@ class DesktopSettingPage extends StatefulWidget {
|
||||
if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled())
|
||||
SettingsTabKey.plugin,
|
||||
if (!bind.isDisableAccount()) SettingsTabKey.account,
|
||||
if (isWindows && bind.mainGetBuildinOption(key: kOptionHideRemotePrinterSetting) != 'Y') SettingsTabKey.printer,
|
||||
if (isWindows &&
|
||||
bind.mainGetBuildinOption(key: kOptionHideRemotePrinterSetting) != 'Y')
|
||||
SettingsTabKey.printer,
|
||||
SettingsTabKey.about,
|
||||
];
|
||||
|
||||
@@ -1602,6 +1604,7 @@ class _DisplayState extends State<_Display> {
|
||||
scrollStyle(context),
|
||||
imageQuality(context),
|
||||
codec(context),
|
||||
if (isDesktop) trackpadSpeed(context),
|
||||
if (!isWeb) privacyModeImpl(context),
|
||||
other(context),
|
||||
]).marginOnly(bottom: _kListViewBottomMargin);
|
||||
@@ -1689,6 +1692,26 @@ class _DisplayState extends State<_Display> {
|
||||
]);
|
||||
}
|
||||
|
||||
Widget trackpadSpeed(BuildContext context) {
|
||||
final initSpeed = (int.tryParse(
|
||||
bind.mainGetUserDefaultOption(key: kKeyTrackpadSpeed)) ??
|
||||
kDefaultTrackpadSpeed);
|
||||
final curSpeed = SimpleWrapper(initSpeed);
|
||||
void onDebouncer(int v) {
|
||||
bind.mainSetUserDefaultOption(
|
||||
key: kKeyTrackpadSpeed, value: v.toString());
|
||||
// It's better to notify all sessions that the default speed is changed.
|
||||
// But it may also be ok to take effect in the next connection.
|
||||
}
|
||||
|
||||
return _Card(title: 'Default trackpad speed', children: [
|
||||
TrackpadSpeedWidget(
|
||||
value: curSpeed,
|
||||
onDebouncer: onDebouncer,
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget codec(BuildContext context) {
|
||||
onChanged(String value) async {
|
||||
await bind.mainSetUserDefaultOption(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/common/widgets/audio_input.dart';
|
||||
import 'package:flutter_hbb/common/widgets/dialog.dart';
|
||||
import 'package:flutter_hbb/common/widgets/toolbar.dart';
|
||||
import 'package:flutter_hbb/models/chat_model.dart';
|
||||
import 'package:flutter_hbb/models/state_model.dart';
|
||||
@@ -1594,10 +1595,28 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
viewMode(),
|
||||
Divider(),
|
||||
...toolbarToggles(),
|
||||
...mouseSpeed(),
|
||||
...mobileActions(),
|
||||
]);
|
||||
}
|
||||
|
||||
mouseSpeed() {
|
||||
final speedWidgets = [];
|
||||
final sessionId = ffi.sessionId;
|
||||
if (isDesktop) {
|
||||
if (ffi.ffiModel.keyboard) {
|
||||
final enabled = !ffi.ffiModel.viewOnly;
|
||||
final trackpad = MenuButton(
|
||||
child: Text(translate('Trackpad speed')).paddingOnly(left: 26.0),
|
||||
onPressed: enabled ? () => trackpadSpeedDialog(sessionId, ffi) : null,
|
||||
ffi: ffi,
|
||||
);
|
||||
speedWidgets.add(trackpad);
|
||||
}
|
||||
}
|
||||
return speedWidgets;
|
||||
}
|
||||
|
||||
keyboardMode() {
|
||||
return futureBuilder(future: () async {
|
||||
return await bind.sessionGetKeyboardMode(sessionId: ffi.sessionId) ??
|
||||
|
||||
Reference in New Issue
Block a user