gpui: Make screen capture dependency optional (#32937)
Add `screen-capture` feature to gpui to enable screen capture support. The motivation for this is to make dependencies on scap / x11 / xcb optional. Release Notes: - N/A --------- Co-authored-by: Michael Sloan <michael@zed.dev>
This commit is contained in:
parent
6d09f3fa40
commit
9dc3ac9657
12 changed files with 73 additions and 33 deletions
|
@ -25,6 +25,7 @@ mod test;
|
|||
mod windows;
|
||||
|
||||
#[cfg(all(
|
||||
feature = "screen-capture",
|
||||
any(target_os = "linux", target_os = "freebsd"),
|
||||
any(feature = "wayland", feature = "x11"),
|
||||
))]
|
||||
|
@ -176,10 +177,28 @@ pub(crate) trait Platform: 'static {
|
|||
None
|
||||
}
|
||||
|
||||
#[cfg(feature = "screen-capture")]
|
||||
fn is_screen_capture_supported(&self) -> bool;
|
||||
#[cfg(not(feature = "screen-capture"))]
|
||||
fn is_screen_capture_supported(&self) -> bool {
|
||||
false
|
||||
}
|
||||
#[cfg(feature = "screen-capture")]
|
||||
fn screen_capture_sources(
|
||||
&self,
|
||||
) -> oneshot::Receiver<Result<Vec<Box<dyn ScreenCaptureSource>>>>;
|
||||
#[cfg(not(feature = "screen-capture"))]
|
||||
fn screen_capture_sources(
|
||||
&self,
|
||||
) -> oneshot::Receiver<anyhow::Result<Vec<Box<dyn ScreenCaptureSource>>>> {
|
||||
let (sources_tx, sources_rx) = oneshot::channel();
|
||||
sources_tx
|
||||
.send(Err(anyhow::anyhow!(
|
||||
"gpui was compiled without the screen-capture feature"
|
||||
)))
|
||||
.ok();
|
||||
sources_rx
|
||||
}
|
||||
|
||||
fn open_window(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue