mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -742,6 +742,10 @@ impl Connection {
|
||||
res.set_peer_info(pi);
|
||||
} else {
|
||||
try_activate_screen();
|
||||
if let Some(msg_out) = super::video_service::is_inited_msg() {
|
||||
self.send(msg_out).await;
|
||||
}
|
||||
|
||||
match super::video_service::get_displays().await {
|
||||
Err(err) => {
|
||||
res.set_error(format!("Error: {}", err));
|
||||
|
||||
@@ -39,6 +39,12 @@ use std::{
|
||||
#[cfg(windows)]
|
||||
use virtual_display;
|
||||
|
||||
pub const SCRAP_UBUNTU_HIGHER_REQUIRED: &str = "Wayland requires Ubuntu 21.04 or higher version.";
|
||||
pub const SCRAP_OTHER_VERSION_OR_X11_REQUIRED: &str =
|
||||
"Wayland requires higher version of linux distro. Please try X11 desktop or change your OS.";
|
||||
pub const SCRAP_X11_REQUIRED: &str = "x11 expected";
|
||||
pub const SCRAP_X11_REF_URL: &str = "https://rustdesk.com/docs/en/manual/linux/#x11-required";
|
||||
|
||||
pub const NAME: &'static str = "video";
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@@ -569,7 +575,7 @@ fn run(sp: GenericService) -> ResultType<()> {
|
||||
{
|
||||
if !scrap::is_x11() {
|
||||
if would_block_count >= 100 {
|
||||
// For now, the user should choose and agree screen sharing agiain.
|
||||
// For now, the user should choose and agree screen sharing agiain.
|
||||
// to-do: Remember choice, attendless...
|
||||
super::wayland::release_resouce();
|
||||
bail!("Wayland capturer none 100 times, try restart captuere");
|
||||
@@ -747,6 +753,14 @@ pub(super) fn get_displays_2(all: &Vec<Display>) -> (usize, Vec<DisplayInfo>) {
|
||||
(*lock, displays)
|
||||
}
|
||||
|
||||
pub fn is_inited_msg() -> Option<Message> {
|
||||
#[cfg(target_os = "linux")]
|
||||
if !scrap::is_x11() {
|
||||
return super::wayland::is_inited();
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub async fn get_displays() -> ResultType<(usize, Vec<DisplayInfo>)> {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
|
||||
@@ -3,11 +3,9 @@ use hbb_common::{allow_err, platform::linux::DISTRO};
|
||||
use scrap::{set_map_err, Capturer, Display, Frame, TraitCapturer};
|
||||
use std::io;
|
||||
|
||||
pub const SCRAP_UBUNTU_HIGHER_REQUIRED: &str = "Wayland requires Ubuntu 21.04 or higher version.";
|
||||
pub const SCRAP_OTHER_VERSION_OR_X11_REQUIRED: &str =
|
||||
"Wayland requires higher version of linux distro. Please try X11 desktop or change your OS.";
|
||||
pub const SCRAP_X11_REQUIRED: &str = "X11 is required";
|
||||
pub const SCRAP_X11_REF_URL: &str = "https://rustdesk.com/docs/en/manual/linux/#x11-required";
|
||||
use super::video_service::{
|
||||
SCRAP_OTHER_VERSION_OR_X11_REQUIRED, SCRAP_UBUNTU_HIGHER_REQUIRED, SCRAP_X11_REQUIRED,
|
||||
};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref CAP_DISPLAY_INFO: RwLock<u64> = RwLock::new(0);
|
||||
@@ -26,7 +24,10 @@ fn map_err_scrap(err: String) -> io::Error {
|
||||
// std::process::exit(-1);
|
||||
// }
|
||||
|
||||
log::error!("REMOVE ME ===================================== wayland scrap error {}", &err);
|
||||
log::error!(
|
||||
"REMOVE ME ===================================== wayland scrap error {}",
|
||||
&err
|
||||
);
|
||||
|
||||
if DISTRO.name.to_uppercase() == "Ubuntu".to_uppercase() {
|
||||
if DISTRO.version_id < "21".to_owned() {
|
||||
@@ -93,6 +94,27 @@ pub(super) async fn ensure_inited() -> ResultType<()> {
|
||||
check_init().await
|
||||
}
|
||||
|
||||
pub(super) fn is_inited() -> Option<Message> {
|
||||
if scrap::is_x11() {
|
||||
None
|
||||
} else {
|
||||
if *CAP_DISPLAY_INFO.read().unwrap() == 0 {
|
||||
let mut msg_out = Message::new();
|
||||
let res = MessageBox {
|
||||
msgtype: "nook-nocancel-hasclose".to_owned(),
|
||||
title: "Wayland".to_owned(),
|
||||
text: "Please Select the screen to be shared(Operate on the peer side).".to_owned(),
|
||||
link: "".to_owned(),
|
||||
..Default::default()
|
||||
};
|
||||
msg_out.set_message_box(res);
|
||||
Some(msg_out)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn check_init() -> ResultType<()> {
|
||||
if !scrap::is_x11() {
|
||||
let mut minx = 0;
|
||||
|
||||
Reference in New Issue
Block a user