From f3d10dd420c53c546c389683944c5bd77fb0e7e7 Mon Sep 17 00:00:00 2001 From: fufesou Date: Wed, 27 Jul 2022 06:34:27 -0700 Subject: [PATCH] fix build without wayland feature Signed-off-by: fufesou --- Cargo.lock | 6 +++--- libs/scrap/src/common/linux.rs | 9 ++------- libs/scrap/src/common/mod.rs | 6 ++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8f235f6f..2d9ac2cac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -319,9 +319,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitvec" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1489fcb93a5bb47da0462ca93ad252ad6af2145cce58d10d46a83931ba9f016b" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", @@ -2212,7 +2212,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hwcodec" version = "0.1.0" -source = "git+https://github.com/21pages/hwcodec#890204e0703a3d361fc7a45f035fe75c0575bb1d" +source = "git+https://github.com/21pages/hwcodec#91d1cd327c88490f917457072aeef0676ddb2be7" dependencies = [ "bindgen", "cc", diff --git a/libs/scrap/src/common/linux.rs b/libs/scrap/src/common/linux.rs index 866fb851a..3efcdb054 100644 --- a/libs/scrap/src/common/linux.rs +++ b/libs/scrap/src/common/linux.rs @@ -54,14 +54,9 @@ pub enum Display { WAYLAND(wayland::Display), } -#[inline] -pub fn is_x11() -> bool { - "x11" == hbb_common::platform::linux::get_display_server() -} - impl Display { pub fn primary() -> io::Result { - Ok(if is_x11() { + Ok(if super::is_x11() { Display::X11(x11::Display::primary()?) } else { Display::WAYLAND(wayland::Display::primary()?) @@ -69,7 +64,7 @@ impl Display { } pub fn all() -> io::Result> { - Ok(if is_x11() { + Ok(if super::is_x11() { x11::Display::all()? .drain(..) .map(|x| Display::X11(x)) diff --git a/libs/scrap/src/common/mod.rs b/libs/scrap/src/common/mod.rs index 4a9ade58d..8ee22ada6 100644 --- a/libs/scrap/src/common/mod.rs +++ b/libs/scrap/src/common/mod.rs @@ -59,3 +59,9 @@ pub trait TraitCapturer { #[cfg(windows)] fn set_gdi(&mut self) -> bool; } + +#[cfg(x11)] +#[inline] +pub fn is_x11() -> bool { + "x11" == hbb_common::platform::linux::get_display_server() +}