Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

open multi windows, add remote toolbar option

dignowf1d3a553d172
diff --git a/flutter/lib/common/widgets/toolbar.dart b/flutter/lib/common/widgets/toolbar.dart
index ebaff8954..757a03fec 100644
--- a/flutter/lib/common/widgets/toolbar.dart
+++ b/flutter/lib/common/widgets/toolbar.dart
@@ -535,5 +535,20 @@ Future<List<TToggleMenu>> toolbarDisplayToggle(
child: Text(translate('Show displays as individual windows'))));
}
+ final screenList = await getScreenRectList();
+ if (useTextureRender && pi.isSupportMultiDisplay && screenList.length > 1) {
+ final value = bind.sessionGetUseAllMyDisplaysForTheRemoteSession(
+ sessionId: ffi.sessionId) ==
+ 'Y';
+ v.add(TToggleMenu(
+ value: value,
+ onChanged: (value) {
+ if (value == null) return;
+ bind.sessionSetUseAllMyDisplaysForTheRemoteSession(
+ sessionId: sessionId, value: value ? 'Y' : '');
+ },
+ child: Text(translate('Use all my displays for the remote session'))));
+ }
+
return v;
}
diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dart
index 8a562f5a1..9f0a5b56f 100644
--- a/flutter/lib/consts.dart
+++ b/flutter/lib/consts.dart
@@ -66,7 +66,7 @@ const String kPointerEventKindTouch = "touch";
const String kPointerEventKindMouse = "mouse";
const String kKeyShowDisplaysAsIndividualWindows = 'displays_as_individual_windows';
-const String kKeyUseAllMyMonitorsWhenConnecting = 'use_all_my_monitors_when_connecting';
+const String kKeyUseAllMyDisplaysForTheRemoteSession = 'use_all_my_displays_for_the_remote_session';
const String kKeyShowMonitorsToolbar = 'show_monitors_toolbar';
// the executable name of the portable version
diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart
index 42c75a70a..416cbaa5e 100644
--- a/flutter/lib/desktop/pages/desktop_setting_page.dart
+++ b/flutter/lib/desktop/pages/desktop_setting_page.dart
@@ -1325,7 +1325,7 @@ class _DisplayState extends State<_Display> {
children.add(otherRow('Show displays as individual windows',
kKeyShowDisplaysAsIndividualWindows));
children.add(otherRow('Use all my displays for the remote session',
- kKeyUseAllMyMonitorsWhenConnecting));
+ kKeyUseAllMyDisplaysForTheRemoteSession));
}
return _Card(title: 'Other Default Options', children: children);
}
diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart
index 127410761..fb2b96d62 100644
--- a/flutter/lib/models/model.dart
+++ b/flutter/lib/models/model.dart
@@ -705,13 +705,13 @@ class FfiModel with ChangeNotifier {
notifyListeners();
if (!isCache) {
- tryUseAllMyDisplaysWhenConnecting(peerId);
+ tryUseAllMyDisplaysForTheRemoteSession(peerId);
}
}
- tryUseAllMyDisplaysWhenConnecting(String peerId) async {
- if (bind.mainGetUserDefaultOption(
- key: kKeyUseAllMyMonitorsWhenConnecting) !=
+ tryUseAllMyDisplaysForTheRemoteSession(String peerId) async {
+ if (bind.sessionGetUseAllMyDisplaysForTheRemoteSession(
+ sessionId: sessionId) !=
'Y') {
return;
}
diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs
index 09f5a3f35..82867ad73 100644
--- a/libs/hbb_common/src/config.rs
+++ b/libs/hbb_common/src/config.rs
@@ -291,11 +291,11 @@ pub struct PeerConfig {
)]
pub displays_as_individual_windows: String,
#[serde(
- default = "PeerConfig::default_use_all_my_monitors_when_connecting",
- deserialize_with = "PeerConfig::deserialize_use_all_my_monitors_when_connecting",
+ default = "PeerConfig::default_use_all_my_displays_for_the_remote_session",
+ deserialize_with = "PeerConfig::deserialize_use_all_my_displays_for_the_remote_session",
skip_serializing_if = "String::is_empty"
)]
- pub use_all_my_monitors_when_connecting: String,
+ pub use_all_my_displays_for_the_remote_session: String,
#[serde(
default,
@@ -341,7 +341,7 @@ impl Default for PeerConfig {
view_only: Default::default(),
reverse_mouse_wheel: Self::default_reverse_mouse_wheel(),
displays_as_individual_windows: Self::default_displays_as_individual_windows(),
- use_all_my_monitors_when_connecting: Self::default_use_all_my_monitors_when_connecting(
+ use_all_my_displays_for_the_remote_session: Self::default_use_all_my_displays_for_the_remote_session(
),
custom_resolutions: Default::default(),
options: Self::default_options(),
@@ -1165,9 +1165,9 @@ impl PeerConfig {
UserDefaultConfig::read().get("displays_as_individual_windows")
);
serde_field_string!(
- default_use_all_my_monitors_when_connecting,
- deserialize_use_all_my_monitors_when_connecting,
- UserDefaultConfig::read().get("use_all_my_monitors_when_connecting")
+ default_use_all_my_displays_for_the_remote_session,
+ deserialize_use_all_my_displays_for_the_remote_session,
+ UserDefaultConfig::read().get("use_all_my_displays_for_the_remote_session")
);
fn default_custom_image_quality() -> Vec<i32> {
diff --git a/src/client.rs b/src/client.rs
index c2cdfc1e9..da4559c99 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1218,14 +1218,14 @@ impl LoginConfigHandler {
self.save_config(config);
}
- /// Save "use_all_my_monitors_when_connecting" ("", "Y") to the current config.
+ /// Save "use_all_my_displays_for_the_remote_session" ("", "Y") to the current config.
///
/// # Arguments
///
- /// * `value` - The "use_all_my_monitors_when_connecting" value ("", "Y").
- pub fn save_use_all_my_monitors_when_connecting(&mut self, value: String) {
+ /// * `value` - The "use_all_my_displays_for_the_remote_session" value ("", "Y").
+ pub fn save_use_all_my_displays_for_the_remote_session(&mut self, value: String) {
let mut config = self.load_config();
- config.use_all_my_monitors_when_connecting = value;
+ config.use_all_my_displays_for_the_remote_session = value;
self.save_config(config);
}
diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs
index 19b83590c..fda3247b9 100644
--- a/src/flutter_ffi.rs
+++ b/src/flutter_ffi.rs
@@ -355,19 +355,19 @@ pub fn session_set_displays_as_individual_windows(session_id: SessionID, value:
}
}
-pub fn session_get_use_all_my_monitors_when_connecting(
+pub fn session_get_use_all_my_displays_for_the_remote_session(
session_id: SessionID,
) -> SyncReturn<Option<String>> {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
- SyncReturn(Some(session.get_use_all_my_monitors_when_connecting()))
+ SyncReturn(Some(session.get_use_all_my_displays_for_the_remote_session()))
} else {
SyncReturn(None)
}
}
-pub fn session_set_use_all_my_monitors_when_connecting(session_id: SessionID, value: String) {
+pub fn session_set_use_all_my_displays_for_the_remote_session(session_id: SessionID, value: String) {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
- session.save_use_all_my_monitors_when_connecting(value);
+ session.save_use_all_my_displays_for_the_remote_session(value);
}
}
diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs
index 37e933927..991691886 100644
--- a/src/ui_session_interface.rs
+++ b/src/ui_session_interface.rs
@@ -240,8 +240,8 @@ impl<T: InvokeUiSession> Session<T> {
self.lc.read().unwrap().displays_as_individual_windows.clone()
}
- pub fn get_use_all_my_monitors_when_connecting(&self) -> String {
- self.lc.read().unwrap().use_all_my_monitors_when_connecting.clone()
+ pub fn get_use_all_my_displays_for_the_remote_session(&self) -> String {
+ self.lc.read().unwrap().use_all_my_displays_for_the_remote_session.clone()
}
pub fn save_reverse_mouse_wheel(&self, value: String) {
@@ -252,8 +252,8 @@ impl<T: InvokeUiSession> Session<T> {
self.lc.write().unwrap().save_displays_as_individual_windows(value);
}
- pub fn save_use_all_my_monitors_when_connecting(&self, value: String) {
- self.lc.write().unwrap().save_use_all_my_monitors_when_connecting(value);
+ pub fn save_use_all_my_displays_for_the_remote_session(&self, value: String) {
+ self.lc.write().unwrap().save_use_all_my_displays_for_the_remote_session(value);
}
pub fn save_view_style(&self, value: String) {