Skip to content

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

fix build linux

dignowa32e74024233
diff --git a/src/core_main.rs b/src/core_main.rs
index e7bb4d0f6..f1669d36b 100644
--- a/src/core_main.rs
+++ b/src/core_main.rs
@@ -1,4 +1,4 @@
-#[cfg(not(any(target_os = "android", target_os = "ios")))]
+#[cfg(windows)]
use crate::client::translate;
#[cfg(not(debug_assertions))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
diff --git a/src/server/display_service.rs b/src/server/display_service.rs
index a6d744694..878526872 100644
--- a/src/server/display_service.rs
+++ b/src/server/display_service.rs
@@ -151,7 +151,7 @@ fn displays_to_msg(displays: Vec<DisplayInfo>) -> Message {
}
fn check_get_displays_changed_msg() -> Option<Message> {
- check_update_displays(try_get_displays().ok()?);
+ check_update_displays(&try_get_displays().ok()?);
let displays = SYNC_DISPLAYS.lock().unwrap().get_update_sync_displays()?;
Some(displays_to_msg(displays))
}
@@ -225,9 +225,14 @@ pub(super) fn get_original_resolution(
.into()
}
+#[cfg(target_os = "linux")]
+pub(super) fn get_sync_displays() -> Vec<DisplayInfo> {
+ SYNC_DISPLAYS.lock().unwrap().displays.clone()
+}
+
// Display to DisplayInfo
// The DisplayInfo is be sent to the peer.
-fn check_update_displays(all: Vec<Display>) {
+pub(super) fn check_update_displays(all: &Vec<Display>) {
let displays = all
.iter()
.map(|d| {
@@ -264,7 +269,7 @@ pub async fn update_get_sync_displays() -> ResultType<Vec<DisplayInfo>> {
return super::wayland::get_displays().await;
}
}
- check_update_displays(try_get_displays()?);
+ check_update_displays(&try_get_displays()?);
Ok(SYNC_DISPLAYS.lock().unwrap().displays.clone())
}
diff --git a/src/server/video_service.rs b/src/server/video_service.rs
index ca5204c78..25b08bb3e 100644
--- a/src/server/video_service.rs
+++ b/src/server/video_service.rs
@@ -407,7 +407,7 @@ fn run(vs: VideoService) -> ResultType<()> {
#[cfg(target_os = "linux")]
super::wayland::ensure_inited()?;
#[cfg(target_os = "linux")]
- let wayland_call_on_ret = SimpleCallOnReturn {
+ let _wayland_call_on_ret = SimpleCallOnReturn {
b: true,
f: Box::new(|| {
super::wayland::clear();
diff --git a/src/server/wayland.rs b/src/server/wayland.rs
index f26b27b20..2be67bc32 100644
--- a/src/server/wayland.rs
+++ b/src/server/wayland.rs
@@ -84,7 +84,6 @@ impl TraitCapturer for CapturerPtr {
struct CapDisplayInfo {
rects: Vec<((i32, i32), usize, usize)>,
displays: Vec<DisplayInfo>,
- num: usize,
primary: usize,
current: usize,
capturer: CapturerPtr,
@@ -146,7 +145,8 @@ pub(super) async fn check_init() -> ResultType<()> {
let num = all.len();
let primary = super::display_service::get_primary_2(&all);
let current = primary;
- let mut displays = super::display_service::to_display_info(&all);
+ super::display_service::check_update_displays(&all);
+ let mut displays = super::display_service::get_sync_displays();
for display in displays.iter_mut() {
display.cursor_embedded = is_cursor_embedded();
}
@@ -173,12 +173,15 @@ pub(super) async fn check_init() -> ResultType<()> {
Some(result) if !result.is_empty() => {
let resolution: Vec<&str> = result.split(" ").collect();
let w: i32 = resolution[0].parse().unwrap_or(origin.0 + width as i32);
- let h: i32 = resolution[2].trim_end_matches(",").parse().unwrap_or(origin.1 + height as i32);
+ let h: i32 = resolution[2]
+ .trim_end_matches(",")
+ .parse()
+ .unwrap_or(origin.1 + height as i32);
(w, h)
}
- _ => (origin.0 + width as i32, origin.1 + height as i32)
+ _ => (origin.0 + width as i32, origin.1 + height as i32),
};
-
+
minx = 0;
maxx = max_width;
miny = 0;
@@ -191,7 +194,6 @@ pub(super) async fn check_init() -> ResultType<()> {
let cap_display_info = Box::into_raw(Box::new(CapDisplayInfo {
rects,
displays,
- num,
primary,
current,
capturer,
@@ -273,7 +275,6 @@ pub(super) fn get_capturer() -> ResultType<super::video_service::CapturerInfo> {
origin: rect.0,
width: rect.1,
height: rect.2,
- ndisplay: cap_display_info.num,
current: cap_display_info.current,
privacy_mode_id: 0,
_capturer_privacy_mode_id: 0,
diff --git a/src/tray.rs b/src/tray.rs
index 7b05be101..221a8a7fe 100644
--- a/src/tray.rs
+++ b/src/tray.rs
@@ -1,9 +1,12 @@
-use crate::{client::translate, ipc::Data};
-use hbb_common::{allow_err, log, tokio};
-use std::{
- sync::{Arc, Mutex},
- time::Duration,
-};
+use crate::client::translate;
+#[cfg(windows)]
+use crate::ipc::Data;
+#[cfg(windows)]
+use hbb_common::tokio;
+use hbb_common::{allow_err, log};
+use std::sync::{Arc, Mutex};
+#[cfg(windows)]
+use std::time::Duration;
pub fn start_tray() {
allow_err!(make_tray());