Skip to content

Commit

Permalink
[update] Sane error message on missing scrcpy.
Browse files Browse the repository at this point in the history
If invoking compositor doesn't implement ZwlrScreencopy, panic with a
sane error message.
  • Loading branch information
Shinyzenith committed May 14, 2022
1 parent e03feb5 commit 6b67b97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ pub fn capture_output_frame(
let frame_buffer_done = Rc::new(AtomicBool::new(false));

// Instantiating screencopy manager.
let screencopy_manager = globals.instantiate_exact::<ZwlrScreencopyManagerV1>(3)?;
let screencopy_manager = match globals.instantiate_exact::<ZwlrScreencopyManagerV1>(3) {
Ok(x) => x,
Err(e) => {
log::error!("Failed to create screencopy manager. Does your compositor implement ZwlrScreencopy?");
panic!("{:#?}", e);
}
};

// Instantiating the image frame.
let frame: Main<ZwlrScreencopyFrameV1>;
Expand Down

0 comments on commit 6b67b97

Please sign in to comment.