wayland cursor embeded

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-11-29 16:36:35 +08:00
parent e13e0ab18f
commit 4d044ca57a
18 changed files with 152 additions and 82 deletions

View File

@@ -40,6 +40,7 @@ message DisplayInfo {
int32 height = 4;
string name = 5;
bool online = 6;
bool cursor_embeded = 7;
}
message PortForward {
@@ -419,6 +420,7 @@ message SwitchDisplay {
sint32 y = 3;
int32 width = 4;
int32 height = 5;
bool cursor_embeded = 6;
}
message PermissionInfo {

View File

@@ -69,3 +69,19 @@ pub trait TraitCapturer {
pub fn is_x11() -> bool {
"x11" == hbb_common::platform::linux::get_display_server()
}
#[cfg(x11)]
#[inline]
pub fn is_cursor_embeded() -> bool {
if is_x11() {
x11::IS_CURSOR_EMBEDED
} else {
wayland::IS_CURSOR_EMBEDED
}
}
#[cfg(not(x11))]
#[inline]
pub fn is_cursor_embeded() -> bool {
false
}

View File

@@ -4,6 +4,8 @@ use std::{io, sync::RwLock, time::Duration};
pub struct Capturer(Display, Box<dyn Recorder>, bool, Vec<u8>);
pub const IS_CURSOR_EMBEDED: bool = true;
lazy_static::lazy_static! {
static ref MAP_ERR: RwLock<Option<fn(err: String)-> io::Error>> = Default::default();
}
@@ -66,7 +68,7 @@ impl Display {
}
pub fn all() -> io::Result<Vec<Display>> {
Ok(pipewire::get_capturables(false)
Ok(pipewire::get_capturables(true)
.map_err(map_err)?
.drain(..)
.map(|x| Display(x))

View File

@@ -3,6 +3,8 @@ use std::{io, ops, time::Duration};
pub struct Capturer(x11::Capturer);
pub const IS_CURSOR_EMBEDED: bool = true;
impl Capturer {
pub fn new(display: Display, yuv: bool) -> io::Result<Capturer> {
x11::Capturer::new(display.0, yuv).map(Capturer)