Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: correct desktop platform build guards

Richie McIlroy5f5e2161887f
diff --git a/apps/desktop-gpui/src/recording.rs b/apps/desktop-gpui/src/recording.rs
index baaf4231d..814c612c5 100644
--- a/apps/desktop-gpui/src/recording.rs
+++ b/apps/desktop-gpui/src/recording.rs
@@ -18,7 +18,7 @@ use cap_recording::{
sources::screen_capture::ScreenCaptureTarget,
studio_recording,
};
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "linux", windows))]
use futures_util::FutureExt as _;
use kameo::{Actor, actor::ActorRef};
@@ -545,6 +545,7 @@ async fn finish_windows_failed_capture(
}
impl ActiveRecording {
+ #[cfg(any(target_os = "linux", windows))]
pub fn done_fut(&self) -> cap_recording::DoneFut {
match &self.handle {
Handle::Studio(handle) => handle.done_fut(),
diff --git a/apps/desktop/src-tauri/src/clean_capture.rs b/apps/desktop/src-tauri/src/clean_capture.rs
index 79e613247..fc970f997 100644
--- a/apps/desktop/src-tauri/src/clean_capture.rs
+++ b/apps/desktop/src-tauri/src/clean_capture.rs
@@ -655,6 +655,7 @@ pub fn schedule_overlay_reveal(window: &WebviewWindow, generation: u32, focus: b
});
}
+#[cfg(not(target_os = "macos"))]
pub fn schedule_overlay_focus(window: &WebviewWindow, generation: u32) {
let handle = window.clone();
let _ = window.run_on_main_thread(move || {
diff --git a/apps/desktop/src-tauri/src/hotkeys.rs b/apps/desktop/src-tauri/src/hotkeys.rs
index 950394e62..c669c185b 100644
--- a/apps/desktop/src-tauri/src/hotkeys.rs
+++ b/apps/desktop/src-tauri/src/hotkeys.rs
@@ -109,6 +109,7 @@ fn existing_clean_capture_stop(store: &HotkeysStore) -> Result<bool, String> {
Ok(existing_stop)
}
+#[cfg(target_os = "linux")]
pub(crate) fn reserve_clean_capture_stop(app: &AppHandle) -> Result<bool, String> {
let shortcut = clean_capture_shortcut();
let state = app.state::<HotkeysState>();
diff --git a/apps/desktop/src-tauri/src/linux_instant_camera.rs b/apps/desktop/src-tauri/src/linux_instant_camera.rs
index 1f2efed7f..6bb6fb93a 100644
--- a/apps/desktop/src-tauri/src/linux_instant_camera.rs
+++ b/apps/desktop/src-tauri/src/linux_instant_camera.rs
@@ -154,11 +154,13 @@ pub struct PresentationBroker {
pending: Arc<Mutex<Option<PendingPresentation>>>,
}
+#[cfg(target_os = "linux")]
struct PendingGuard {
pending: Arc<Mutex<Option<PendingPresentation>>>,
nonce: String,
}
+#[cfg(target_os = "linux")]
impl Drop for PendingGuard {
fn drop(&mut self) {
let mut pending = self.pending.lock().unwrap();
diff --git a/crates/recording/src/output_pipeline/core.rs b/crates/recording/src/output_pipeline/core.rs
index 6ab4c71ee..e6dff0223 100644
--- a/crates/recording/src/output_pipeline/core.rs
+++ b/crates/recording/src/output_pipeline/core.rs
@@ -1727,7 +1727,9 @@ pub(crate) struct PipelineBuildScope(Arc<PipelineBuildScopeInner>);
type CaptureCompletion = Shared<BoxFuture<'static, Result<(), String>>>;
struct ScopeError {
+ #[cfg(any(test, target_os = "linux", windows))]
message: String,
+ #[cfg(any(test, target_os = "linux", windows))]
uncertain: bool,
}
@@ -1978,7 +1980,9 @@ impl PipelineBuildScope {
}
if !self.0.committed.load(Ordering::Acquire) {
self.0.cleanup_errors.lock().unwrap().push(ScopeError {
+ #[cfg(any(test, target_os = "linux", windows))]
message: error,
+ #[cfg(any(test, target_os = "linux", windows))]
uncertain: true,
});
}
@@ -2027,7 +2031,9 @@ impl PipelineBuildScope {
}
if !self.is_committed() {
self.0.cleanup_errors.lock().unwrap().push(ScopeError {
+ #[cfg(any(test, target_os = "linux", windows))]
message: error,
+ #[cfg(any(test, target_os = "linux", windows))]
uncertain: !self.requires_joined_stop(),
});
}
diff --git a/crates/recording/src/sources/screen_capture/windows.rs b/crates/recording/src/sources/screen_capture/windows.rs
index 3168d7601..36d5d4483 100644
--- a/crates/recording/src/sources/screen_capture/windows.rs
+++ b/crates/recording/src/sources/screen_capture/windows.rs
@@ -425,8 +425,10 @@ pub struct VideoSource {
first_frame: Option<oneshot::Receiver<Result<(), String>>>,
}
+type SharedFirstScreenFrameSender = Arc<Mutex<Option<oneshot::Sender<Result<(), String>>>>>;
+
#[derive(Clone)]
-struct FirstScreenFrame(Arc<Mutex<Option<oneshot::Sender<Result<(), String>>>>>);
+struct FirstScreenFrame(SharedFirstScreenFrameSender);
impl FirstScreenFrame {
fn complete(&self, result: Result<(), String>) {