mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-10 18:06:01 +02:00
fix: android, back function (#10843)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
965cc6af26
commit
2e89a33210
2 changed files with 25 additions and 2 deletions
|
@ -35,10 +35,15 @@ import hbb.MessageOuterClass.KeyEvent
|
|||
import hbb.MessageOuterClass.KeyboardMode
|
||||
import hbb.KeyEventConverter
|
||||
|
||||
// const val BUTTON_UP = 2
|
||||
// const val BUTTON_BACK = 0x08
|
||||
|
||||
const val LEFT_DOWN = 9
|
||||
const val LEFT_MOVE = 8
|
||||
const val LEFT_UP = 10
|
||||
const val RIGHT_UP = 18
|
||||
// (BUTTON_BACK << 3) | BUTTON_UP
|
||||
const val BACK_UP = 66
|
||||
const val WHEEL_BUTTON_DOWN = 33
|
||||
const val WHEEL_BUTTON_UP = 34
|
||||
const val WHEEL_DOWN = 523331
|
||||
|
@ -142,6 +147,11 @@ class InputService : AccessibilityService() {
|
|||
return
|
||||
}
|
||||
|
||||
if (mask == BACK_UP) {
|
||||
performGlobalAction(GLOBAL_ACTION_BACK)
|
||||
return
|
||||
}
|
||||
|
||||
// long WHEEL_BUTTON_DOWN -> GLOBAL_ACTION_RECENTS
|
||||
if (mask == WHEEL_BUTTON_DOWN) {
|
||||
timer.purge()
|
||||
|
|
|
@ -18,7 +18,7 @@ import '../common.dart';
|
|||
import '../consts.dart';
|
||||
|
||||
/// Mouse button enum.
|
||||
enum MouseButtons { left, right, wheel }
|
||||
enum MouseButtons { left, right, wheel, back }
|
||||
|
||||
const _kMouseEventDown = 'mousedown';
|
||||
const _kMouseEventUp = 'mouseup';
|
||||
|
@ -155,6 +155,8 @@ extension ToString on MouseButtons {
|
|||
return 'right';
|
||||
case MouseButtons.wheel:
|
||||
return 'wheel';
|
||||
case MouseButtons.back:
|
||||
return 'back';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1426,7 +1428,18 @@ class InputModel {
|
|||
}
|
||||
}
|
||||
|
||||
void onMobileBack() => tap(MouseButtons.right);
|
||||
void onMobileBack() {
|
||||
final minBackButtonVersion = "1.3.8";
|
||||
final peerVersion =
|
||||
parent.target?.ffiModel.pi.version ?? minBackButtonVersion;
|
||||
var btn = MouseButtons.back;
|
||||
// For compatibility with old versions
|
||||
if (versionCmp(peerVersion, minBackButtonVersion) < 0) {
|
||||
btn = MouseButtons.right;
|
||||
}
|
||||
tap(btn);
|
||||
}
|
||||
|
||||
void onMobileHome() => tap(MouseButtons.wheel);
|
||||
Future<void> onMobileApps() async {
|
||||
sendMouse('down', MouseButtons.wheel);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue