From 5abe42f66cd907e876360aa9a4090d9b25076346 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 26 Aug 2024 10:37:35 +0800 Subject: [PATCH 1/2] not run get window focus if no multiple displays (#9174) Signed-off-by: 21pages --- src/server/input_service.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 2f9b86480a2c..06ab61a25c0f 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -385,6 +385,9 @@ fn run_cursor(sp: MouseCursorService, state: &mut StateCursor) -> ResultType<()> fn run_window_focus(sp: EmptyExtraFieldService, state: &mut StateWindowFocus) -> ResultType<()> { let displays = super::display_service::get_sync_displays(); + if displays.len() <= 1 { + return Ok(()); + } let disp_idx = crate::get_focused_display(displays); if let Some(disp_idx) = disp_idx.map(|id| id as i32) { if state.is_changed(disp_idx) { From 4b4fd94f3eb463346e2171fff211fbf43da08cb8 Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:13:11 +0800 Subject: [PATCH 2/2] feat: web v2 keyboard (#9175) Signed-off-by: fufesou --- flutter/lib/common.dart | 3 +++ flutter/lib/consts.dart | 1 + .../lib/desktop/widgets/kb_layout_type_chooser.dart | 3 ++- flutter/lib/native/common.dart | 4 ++++ flutter/lib/web/bridge.dart | 13 ++++++++++++- flutter/lib/web/common.dart | 7 +++++++ 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 078bda8a420d..fa1ea11b5951 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -50,6 +50,9 @@ final isLinux = isLinux_; final isDesktop = isDesktop_; final isWeb = isWeb_; final isWebDesktop = isWebDesktop_; +final isWebOnWindows = isWebOnWindows_; +final isWebOnLinux = isWebOnLinux_; +final isWebOnMacOs = isWebOnMacOS_; var isMobile = isAndroid || isIOS; var version = ''; int androidVersion = 0; diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dart index a5414dd0db02..edc7f427853e 100644 --- a/flutter/lib/consts.dart +++ b/flutter/lib/consts.dart @@ -32,6 +32,7 @@ const String kPeerPlatformWindows = "Windows"; const String kPeerPlatformLinux = "Linux"; const String kPeerPlatformMacOS = "Mac OS"; const String kPeerPlatformAndroid = "Android"; +const String kPeerPlatformWebDesktop = "WebDesktop"; const double kScrollbarThickness = 12.0; diff --git a/flutter/lib/desktop/widgets/kb_layout_type_chooser.dart b/flutter/lib/desktop/widgets/kb_layout_type_chooser.dart index 7828dd4a0ec6..0984eea5801c 100644 --- a/flutter/lib/desktop/widgets/kb_layout_type_chooser.dart +++ b/flutter/lib/desktop/widgets/kb_layout_type_chooser.dart @@ -178,8 +178,9 @@ String getLocalPlatformForKBLayoutType(String peerPlatform) { localPlatform = kPeerPlatformWindows; } else if (isLinux) { localPlatform = kPeerPlatformLinux; + } else if (isWebOnWindows || isWebOnLinux) { + localPlatform = kPeerPlatformWebDesktop; } - // to-do: web desktop support ? return localPlatform; } diff --git a/flutter/lib/native/common.dart b/flutter/lib/native/common.dart index d3888a245d10..96d5bd6e82ac 100644 --- a/flutter/lib/native/common.dart +++ b/flutter/lib/native/common.dart @@ -11,3 +11,7 @@ final isWebDesktop_ = false; final isDesktop_ = Platform.isWindows || Platform.isMacOS || Platform.isLinux; String get screenInfo_ => ''; + +final isWebOnWindows_ = false; +final isWebOnLinux_ = false; +final isWebOnMacOS_ = false; diff --git a/flutter/lib/web/bridge.dart b/flutter/lib/web/bridge.dart index 5f6f5adef876..8327bdd0ab13 100644 --- a/flutter/lib/web/bridge.dart +++ b/flutter/lib/web/bridge.dart @@ -234,7 +234,7 @@ class RustdeskImpl { } String getLocalKbLayoutType({dynamic hint}) { - throw js.context.callMethod('getByName', ['option:local', 'kb_layout']); + return js.context.callMethod('getByName', ['option:local', 'kb_layout']); } Future setLocalKbLayoutType( @@ -415,6 +415,17 @@ class RustdeskImpl { ])); } + Future sessionHandleFlutterRawKeyEvent( + {required UuidValue sessionId, + required String name, + required int platformCode, + required int positionCode, + required int lockModes, + required bool downOrUp, + dynamic hint}) { + throw UnimplementedError(); + } + void sessionEnterOrLeave( {required UuidValue sessionId, required bool enter, dynamic hint}) { throw UnimplementedError(); diff --git a/flutter/lib/web/common.dart b/flutter/lib/web/common.dart index 93b53f948021..0f3a996816d5 100644 --- a/flutter/lib/web/common.dart +++ b/flutter/lib/web/common.dart @@ -1,4 +1,5 @@ import 'dart:js' as js; +import 'dart:html' as html; final isAndroid_ = false; final isIOS_ = false; @@ -11,3 +12,9 @@ final isWebDesktop_ = !js.context.callMethod('isMobile'); final isDesktop_ = false; String get screenInfo_ => js.context.callMethod('getByName', ['screen_info']); + +final _userAgent = html.window.navigator.userAgent.toLowerCase(); + +final isWebOnWindows_ = _userAgent.contains('win'); +final isWebOnLinux_ = _userAgent.contains('linux'); +final isWebOnMacOS_ = _userAgent.contains('mac');