mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
linux_wayland_support: dup detecting function of x11 or wayland
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -193,7 +193,7 @@ fn check_display_changed(
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
// wayland do not support changing display for now
|
||||
if scrap::is_wayland() {
|
||||
if !scrap::is_x11() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -369,7 +369,7 @@ impl DerefMut for CapturerInfo {
|
||||
fn get_capturer(use_yuv: bool) -> ResultType<CapturerInfo> {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if scrap::is_wayland() {
|
||||
if !scrap::is_x11() {
|
||||
return super::wayland::get_capturer();
|
||||
}
|
||||
}
|
||||
@@ -702,7 +702,7 @@ pub fn handle_one_frame_encoded(
|
||||
fn get_display_num() -> usize {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if scrap::is_wayland() {
|
||||
if !scrap::is_x11() {
|
||||
return if let Ok(n) = super::wayland::get_display_num() {
|
||||
n
|
||||
} else {
|
||||
@@ -745,7 +745,7 @@ pub(super) fn get_displays_2(all: &Vec<Display>) -> (usize, Vec<DisplayInfo>) {
|
||||
pub async fn get_displays() -> ResultType<(usize, Vec<DisplayInfo>)> {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if scrap::is_wayland() {
|
||||
if !scrap::is_x11() {
|
||||
return super::wayland::get_displays().await;
|
||||
}
|
||||
}
|
||||
@@ -774,7 +774,7 @@ pub fn refresh() {
|
||||
fn get_primary() -> usize {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if scrap::is_wayland() {
|
||||
if !scrap::is_x11() {
|
||||
return match super::wayland::get_primary() {
|
||||
Ok(n) => n,
|
||||
Err(_) => 0,
|
||||
|
||||
@@ -28,7 +28,7 @@ impl super::video_service::TraitCapturer for *mut Capturer {
|
||||
}
|
||||
|
||||
async fn check_init() -> ResultType<()> {
|
||||
if scrap::is_wayland() {
|
||||
if !scrap::is_x11() {
|
||||
let mut minx = 0;
|
||||
let mut maxx = 0;
|
||||
let mut miny = 0;
|
||||
@@ -96,7 +96,7 @@ async fn check_init() -> ResultType<()> {
|
||||
}
|
||||
|
||||
pub fn clear() {
|
||||
if !scrap::is_wayland() {
|
||||
if scrap::is_x11() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ pub(super) fn get_display_num() -> ResultType<usize> {
|
||||
}
|
||||
|
||||
pub(super) fn get_capturer() -> ResultType<super::video_service::CapturerInfo> {
|
||||
if !scrap::is_wayland() {
|
||||
if scrap::is_x11() {
|
||||
bail!("Do not call this function if not wayland");
|
||||
}
|
||||
let addr = *CAP_DISPLAY_INFO.read().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user