Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apps/desktop-gpui/src/picker_probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn run(main: WindowHandle<MainWindow>, cx: &mut App) {
let mut mode = cx.update(|cx| probe_mode(label, cx));
mode["overlayInactiveBeforeActivation"] = inactive_before.into();
let screen = screenshot(&output, label, cx).await;
mode["backdrop"] = probe_backdrop(&output, label, screen.as_ref(), cx).await;
mode["backdrop"] = probe_backdrop(&output, label, kind, screen.as_ref(), cx).await;
modes.push(mode);
if kind == TargetType::Window {
window_arrangement = Some(probe_window_arrangement(&output, cx).await);
Expand Down Expand Up @@ -372,12 +372,14 @@ fn mean_difference(
async fn probe_backdrop(
output: &std::ffi::OsStr,
label: &str,
kind: TargetType,
screen: Option<&image::DynamicImage>,
cx: &mut AsyncApp,
) -> serde_json::Value {
if !crate::overlay_backdrop::SUPPORTED {
return serde_json::json!({ "skipped": "no capture without the overlay here" });
}
let expected = crate::target_overlay::backdrop_suits(Some(kind));
// The overlay over the display `screen` shows, so the two compare the
// same desktop.
let primary = scap_targets::Display::primary().id();
Expand All @@ -393,6 +395,13 @@ async fn probe_backdrop(
.ok()
.flatten()
});
if !expected {
return serde_json::json!({
"expected": false,
"present": image.is_some(),
"passed": image.is_none(),
});
}
let Some(image) = image else {
return serde_json::json!({ "present": false, "passed": false });
};
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop-gpui/src/target_overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ fn more_area_ratios() -> Vec<(u32, u32)> {
/// so a capture under their panes showed through it as hard-edged blocks;
/// there the panes sit on the fallback fill, as they do where no capture
/// is possible.
fn backdrop_suits(mode: Option<TargetType>) -> bool {
pub(crate) fn backdrop_suits(mode: Option<TargetType>) -> bool {
match mode {
None => false,
Some(TargetType::Display | TargetType::Window) => !cfg!(windows),
Expand Down
Loading