diff --git a/flutter_hbb/lib/model.dart b/flutter_hbb/lib/model.dart index 2760654bd..7d4986be7 100644 --- a/flutter_hbb/lib/model.dart +++ b/flutter_hbb/lib/model.dart @@ -159,12 +159,14 @@ class FfiModel with ChangeNotifier { } void handleSwitchDisplay(Map evt) { + var old = _pi.currentDisplay; _pi.currentDisplay = int.parse(evt['display']); _display.x = double.parse(evt['x']); _display.y = double.parse(evt['y']); _display.width = int.parse(evt['width']); _display.height = int.parse(evt['height']); - FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y); + if (old != _pi.currentDisplay) + FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y); notifyListeners(); } diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index 8ffd1d0ac..b6b64a6c8 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -35,8 +35,7 @@ class _RemotePageState extends State { var _drag = false; var _right = false; var _scroll = false; - var _arrows = false; - var _more = false; + var _more = true; var _fn = false; final FocusNode _focusNode = FocusNode(); var _showEdit = true; @@ -354,7 +353,8 @@ class _RemotePageState extends State { (String text, void Function() onPressed, [bool active, IconData icon]) { return ButtonTheme( padding: EdgeInsets.symmetric( - vertical: 6, horizontal: 11), //adds padding inside the button + vertical: icon != null ? 3 : 6, + horizontal: 6), //adds padding inside the button materialTapTargetSize: MaterialTapTargetSize .shrinkWrap, //limits the touch area to the button area minWidth: 0, //wraps child's width @@ -366,7 +366,7 @@ class _RemotePageState extends State { ), color: active == true ? MyTheme.accent80 : null, child: icon != null - ? Icon(icon, color: Colors.white) + ? Icon(icon, size: 17, color: Colors.white) : Text(text, style: TextStyle(color: Colors.white, fontSize: 11)), onPressed: onPressed)); @@ -415,25 +415,12 @@ class _RemotePageState extends State { }, FFI.command), ]; final keys = [ - wrap( - 'Arrows', - () => setState(() { - setState(() { - _arrows = !_arrows; - if (_arrows) { - _fn = false; - _more = false; - } - }); - }), - _arrows), wrap( 'Fn', () => setState( () { _fn = !_fn; if (_fn) { - _arrows = false; _more = false; } }, @@ -445,28 +432,12 @@ class _RemotePageState extends State { () { _more = !_more; if (_more) { - _arrows = false; _fn = false; } }, ), _more), ]; - final arrows = [ - SizedBox(width: 9999), - wrap('', () { - FFI.inputKey('VK_LEFT'); - }, false, Icons.keyboard_arrow_left), - wrap('', () { - FFI.inputKey('VK_UP'); - }, false, Icons.keyboard_arrow_up), - wrap('', () { - FFI.inputKey('VK_DOWN'); - }, false, Icons.keyboard_arrow_down), - wrap('', () { - FFI.inputKey('VK_RIGHT'); - }, false, Icons.keyboard_arrow_right), - ]; final fn = [ SizedBox(width: 9999), ]; @@ -499,6 +470,35 @@ class _RemotePageState extends State { wrap('PgDown', () { FFI.inputKey('VK_NEXT'); }), + SizedBox(width: 9999), + wrap('', () { + FFI.inputKey('VK_LEFT'); + }, false, Icons.keyboard_arrow_left), + wrap('', () { + FFI.inputKey('VK_UP'); + }, false, Icons.keyboard_arrow_up), + wrap('', () { + FFI.inputKey('VK_DOWN'); + }, false, Icons.keyboard_arrow_down), + wrap('', () { + FFI.inputKey('VK_RIGHT'); + }, false, Icons.keyboard_arrow_right), + wrap('Ctrl+C', () { + var old = FFI.ctrl; + FFI.ctrl = true; + FFI.inputKey( + 'VK_C', + ); + FFI.ctrl = old; + }), + wrap('Ctrl+S', () { + var old = FFI.ctrl; + FFI.ctrl = true; + FFI.inputKey( + 'VK_S', + ); + FFI.ctrl = old; + }), ]; return Container( color: Color(0xAA000000), @@ -509,11 +509,7 @@ class _RemotePageState extends State { runSpacing: 4, children: [SizedBox(width: 9999)] + (keyboard - ? modifiers + - keys + - (_arrows ? arrows : []) + - (_fn ? fn : []) + - (_more ? more : []) + ? modifiers + keys + (_fn ? fn : []) + (_more ? more : []) : mouse + modifiers), )); }