From a238b6a10a2c635a060543980d4fc70e3ef238c2 Mon Sep 17 00:00:00 2001 From: open-trade Date: Mon, 21 Dec 2020 21:52:20 +0800 Subject: [PATCH] improve enter os password --- flutter_hbb/lib/model.dart | 4 +-- flutter_hbb/lib/remote_page.dart | 22 ++++++++++++----- flutter_hbb/pubspec.lock | 42 ++++++++++++++++---------------- flutter_hbb/pubspec.yaml | 2 +- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/flutter_hbb/lib/model.dart b/flutter_hbb/lib/model.dart index 2ce9398e7..2760654bd 100644 --- a/flutter_hbb/lib/model.dart +++ b/flutter_hbb/lib/model.dart @@ -445,8 +445,8 @@ class CursorModel with ChangeNotifier { void updateDisplayOrigin(double x, double y) { _displayOriginX = x; _displayOriginY = y; - _x = x; - _y = y; + _x = x + 1; + _y = y + 1; FFI.moveMouse(x, y); FFI.canvasModel.resetOffset(); notifyListeners(); diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index 73ed7eed8..ff7b97ed7 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -751,7 +751,7 @@ void showOptions(BuildContext context) { }, () async => true, true, 0); } -void showActions(BuildContext context) async { +void showActions(BuildContext context) { final size = MediaQuery.of(context).size; final x = 120.0; final y = size.height; @@ -763,7 +763,6 @@ void showActions(BuildContext context) async { FFI.ffiModel.permissions['clipboard'] != false) { more.add(PopupMenuItem(child: Text('Paste'), value: 'paste')); } - var password = await getPassword(FFI.id); more.add(PopupMenuItem( child: Row( children: ([ @@ -804,10 +803,21 @@ void showActions(BuildContext context) async { } }(); } else if (value == 'enter_os_password') { - if (password != "") { - FFI.setByName('input_string', password); - FFI.inputKey('VK_RETURN'); - } + () async { + var password = await getPassword(FFI.id); + if (password != "") { + var x = FFI.cursorModel.x; + var y = FFI.cursorModel.y; + FFI.moveMouse(x + 3, y + 3); + await Future.delayed(Duration(milliseconds: 50)); + FFI.moveMouse(x, y); + await Future.delayed(Duration(milliseconds: 50)); + FFI.tap(true); + await Future.delayed(Duration(milliseconds: 300)); + FFI.setByName('input_string', password); + FFI.inputKey('VK_RETURN'); + } + }(); } }(); } diff --git a/flutter_hbb/pubspec.lock b/flutter_hbb/pubspec.lock index f343c67e1..caa914825 100644 --- a/flutter_hbb/pubspec.lock +++ b/flutter_hbb/pubspec.lock @@ -21,42 +21,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.3" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0-nullsafety.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.5" + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.5" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -84,7 +84,7 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.0" device_info: dependency: "direct main" description: @@ -105,7 +105,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0-nullsafety.1" ffi: dependency: "direct main" description: @@ -255,21 +255,21 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.3" + version: "0.6.2" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.3" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.6" + version: "1.3.0-nullsafety.3" nested: dependency: transitive description: @@ -290,7 +290,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.3" + version: "1.8.0-nullsafety.1" path_provider: dependency: "direct main" description: @@ -428,42 +428,42 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.4" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.6" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.6" + version: "0.2.19-nullsafety.2" tuple: dependency: "direct main" description: @@ -477,7 +477,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.5" + version: "1.3.0-nullsafety.3" url_launcher: dependency: "direct main" description: @@ -526,7 +526,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.5" + version: "2.1.0-nullsafety.3" wakelock: dependency: "direct main" description: @@ -577,5 +577,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.12.0-0.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.22.0 <2.0.0" diff --git a/flutter_hbb/pubspec.yaml b/flutter_hbb/pubspec.yaml index 77824d3b1..94fbdd592 100644 --- a/flutter_hbb/pubspec.yaml +++ b/flutter_hbb/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.1.0 +version: 1.1.1 environment: sdk: ">=2.7.0 <3.0.0"