fix is x11, on conn

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-10-21 13:10:51 +08:00
parent aa3c58917b
commit b3948910ff
7 changed files with 36 additions and 43 deletions

View File

@@ -4,8 +4,11 @@ use scrap::{is_cursor_embedded, set_map_err, Capturer, Display, Frame, TraitCapt
use std::io;
use std::process::{Command, Output};
use crate::client::{
SCRAP_OTHER_VERSION_OR_X11_REQUIRED, SCRAP_UBUNTU_HIGHER_REQUIRED, SCRAP_X11_REQUIRED,
use crate::{
client::{
SCRAP_OTHER_VERSION_OR_X11_REQUIRED, SCRAP_UBUNTU_HIGHER_REQUIRED, SCRAP_X11_REQUIRED,
},
platform::linux::is_x11,
};
lazy_static::lazy_static! {
@@ -96,7 +99,7 @@ pub(super) async fn ensure_inited() -> ResultType<()> {
}
pub(super) fn is_inited() -> Option<Message> {
if scrap::is_x11() {
if is_x11() {
None
} else {
if *CAP_DISPLAY_INFO.read().unwrap() == 0 {
@@ -133,7 +136,7 @@ fn get_max_desktop_resolution() -> Option<String> {
}
pub(super) async fn check_init() -> ResultType<()> {
if !scrap::is_x11() {
if !is_x11() {
let mut minx = 0;
let mut maxx = 0;
let mut miny = 0;
@@ -246,7 +249,7 @@ pub(super) fn get_primary() -> ResultType<usize> {
}
pub fn clear() {
if scrap::is_x11() {
if is_x11() {
return;
}
let mut write_lock = CAP_DISPLAY_INFO.write().unwrap();
@@ -261,7 +264,7 @@ pub fn clear() {
}
pub(super) fn get_capturer() -> ResultType<super::video_service::CapturerInfo> {
if scrap::is_x11() {
if is_x11() {
bail!("Do not call this function if not wayland");
}
let addr = *CAP_DISPLAY_INFO.read().unwrap();