From 536f25f33c7e88f382671d1f690d4250e8278eb0 Mon Sep 17 00:00:00 2001 From: csf Date: Mon, 26 Sep 2022 16:52:23 +0800 Subject: [PATCH 1/2] fix mobile physical mouse wheel scroll --- flutter/lib/mobile/pages/remote_page.dart | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index e16035175..0673ce6f4 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -325,17 +325,13 @@ class _RemotePageState extends State { }, onPointerSignal: (e) { if (e is PointerScrollEvent) { - var dx = e.scrollDelta.dx; - var dy = e.scrollDelta.dy; - if (dx > 0) - dx = -1; - else if (dx < 0) dx = 1; - if (dy > 0) + var dy = 0; + if (e.scrollDelta.dy > 0) { dy = -1; - else if (dy < 0) dy = 1; - bind.sessionSendMouse( - id: widget.id, - msg: '{"type": "wheel", "x": "$dx", "y": "$dy"}'); + } else if (e.scrollDelta.dy < 0) { + dy = 1; + } + gFFI.scroll(dy); } }, child: MouseRegion( From 52c6e309ce4624f4ed8fcaf7fdef54deb1cd2f18 Mon Sep 17 00:00:00 2001 From: csf Date: Mon, 26 Sep 2022 18:10:54 +0800 Subject: [PATCH 2/2] 1. fix cm window size onToggle Chat. 2. no need to show remote info in cm chat_page. 3. hide Chat IconButton when client unauthorized 4. update lang --- flutter/lib/desktop/pages/server_page.dart | 17 +++++++++-------- flutter/lib/mobile/pages/chat_page.dart | 4 +++- flutter/lib/models/chat_model.dart | 6 +++--- src/lang/cn.rs | 1 + src/lang/cs.rs | 1 + src/lang/da.rs | 1 + src/lang/de.rs | 1 + src/lang/eo.rs | 1 + src/lang/es.rs | 1 + src/lang/fr.rs | 1 + src/lang/hu.rs | 1 + src/lang/id.rs | 1 + src/lang/it.rs | 1 + src/lang/ja.rs | 1 + src/lang/ko.rs | 1 + src/lang/kz.rs | 1 + src/lang/pl.rs | 1 + src/lang/pt_PT.rs | 1 + src/lang/ptbr.rs | 1 + src/lang/ru.rs | 1 + src/lang/sk.rs | 1 + src/lang/template.rs | 1 + src/lang/tr.rs | 1 + src/lang/tw.rs | 11 ++++++----- src/lang/vn.rs | 1 + 25 files changed, 42 insertions(+), 17 deletions(-) diff --git a/flutter/lib/desktop/pages/server_page.dart b/flutter/lib/desktop/pages/server_page.dart index 68d5c3b33..d6f3d7f16 100644 --- a/flutter/lib/desktop/pages/server_page.dart +++ b/flutter/lib/desktop/pages/server_page.dart @@ -310,14 +310,15 @@ class _CmHeaderState extends State<_CmHeader> ], ), ), - Offstage( - offstage: client.isFileTransfer, - child: IconButton( - onPressed: () => checkClickTime( - client.id, () => gFFI.chatModel.toggleCMChatPage(client.id)), - icon: Icon(Icons.message_outlined), - ), - ) + Consumer( + builder: (_, model, child) => Offstage( + offstage: !client.authorized || client.isFileTransfer, + child: IconButton( + onPressed: () => checkClickTime(client.id, + () => gFFI.chatModel.toggleCMChatPage(client.id)), + icon: Icon(Icons.message_outlined), + ), + )) ], ); } diff --git a/flutter/lib/mobile/pages/chat_page.dart b/flutter/lib/mobile/pages/chat_page.dart index 8ac5ce313..b7cf28c9d 100644 --- a/flutter/lib/mobile/pages/chat_page.dart +++ b/flutter/lib/mobile/pages/chat_page.dart @@ -62,6 +62,7 @@ class ChatPage extends StatelessWidget implements PageShape { inputOptions: InputOptions( sendOnEnter: true, inputDecoration: defaultInputDecoration( + hintText: "${translate('Write a message')}...", fillColor: Theme.of(context).backgroundColor), sendButtonBuilder: defaultSendButton( color: Theme.of(context) @@ -87,7 +88,8 @@ class ChatPage extends StatelessWidget implements PageShape { )), ); }), - chatModel.currentID == ChatModel.clientModeID + desktopType == DesktopType.cm || + chatModel.currentID == ChatModel.clientModeID ? SizedBox.shrink() : Padding( padding: EdgeInsets.all(12), diff --git a/flutter/lib/models/chat_model.dart b/flutter/lib/models/chat_model.dart index dbf5ac753..bdb3e9abf 100644 --- a/flutter/lib/models/chat_model.dart +++ b/flutter/lib/models/chat_model.dart @@ -166,12 +166,12 @@ class ChatModel with ChangeNotifier { if (_isShowChatPage) { _isShowChatPage = !_isShowChatPage; notifyListeners(); - await windowManager.setSize(Size(400, 600)); + await windowManager.setSize(Size(300, 400)); await windowManager.setAlignment(Alignment.topRight); } else { - await windowManager.setSize(Size(800, 600)); - await windowManager.center(); + await windowManager.setSize(Size(600, 400)); await Future.delayed(Duration(milliseconds: 100)); + await windowManager.setAlignment(Alignment.topRight); _isShowChatPage = !_isShowChatPage; notifyListeners(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 68667f693..9b1b06396 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "取消固定菜单栏"), ("Enable LAN Discovery", "允许局域网发现"), ("Deny LAN Discovery", "拒绝局域网发现"), + ("Write a message", "输入聊天消息"), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 545f7e5b2..b9d0fc16b 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Odepnout panel nabídek"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 2417f883f..9e864ecbc 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Frigør menulinjen"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 79faeb946..851e8e565 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Menüleiste lösen"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 015a2e09e..ad5e6c536 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Malfiksi menubreton"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 0ae6ee3ed..af696f6b7 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Desbloquear barra de menú"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index f2c2997de..935f5dab0 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Détacher la barre de menu"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index d835de69f..bf1c9c2fa 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Menüsor rögzítésének feloldása"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 975e15059..ed4e02e70 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Unpin menubar"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 972f29114..d9d5ba2fd 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Sblocca la barra dei menu"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 5bcc90cfe..bfbc87601 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "メニューバーのピン留めを外す"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index b46950b00..0d5f0771c 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "메뉴 모음 고정 해제"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index fb3ed1fbd..6d08d398b 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Мәзір жолағын босату"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 22cd2a3eb..0bf270bae 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Odepnij pasek menu"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 4010c4820..6ce9369a4 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Desenganxa la barra de menús"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index d452dbbb0..d149a2ac1 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", ""), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 5dd0118ce..ef1f21f73 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Открепить строку меню"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 07cffa239..16f543335 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Uvoľniť panel s ponukami"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index 97e65f2e2..d54ce431f 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", ""), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index d6920782a..c1ba55c72 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Menü çubuğunun sabitlemesini kaldır"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index efd225ba7..684b07e79 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -327,14 +327,14 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Account", "賬戶"), ("Theme", "主題"), ("Dark Theme", "暗黑主題"), - ("Dark", ""), - ("Light", ""), - ("Follow System", ""), + ("Dark", "黑暗"), + ("Light", "明亮"), + ("Follow System", "跟隨系統"), ("Enable hardware codec", "使用硬件編解碼"), ("Unlock Security Settings", "解鎖安全設置"), ("Enable Audio", "允許傳輸音頻"), - ("Temporary Password Length", "临时密码长度"), - ("Unlock Network Settings", "臨時密碼長度"), + ("Temporary Password Length", "臨時密碼長度"), + ("Unlock Network Settings", "解鎖網絡設置"), ("Server", "服務器"), ("Direct IP Access", "IP直接訪問"), ("Proxy", "代理"), @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "取消固定菜單欄"), ("Enable LAN Discovery", "允許局域網發現"), ("Deny LAN Discovery", "拒絕局域網發現"), + ("Write a message", "輸入聊天消息"), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index ef882f076..46beea4fb 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -351,5 +351,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Unpin menubar", "Bỏ ghim thanh menu"), ("Enable LAN Discovery", ""), ("Deny LAN Discovery", ""), + ("Write a message", ""), ].iter().cloned().collect(); }