diff --git a/src/capturable/autopilot.rs b/src/capturable/autopilot.rs deleted file mode 100644 index 3eb51d2..0000000 --- a/src/capturable/autopilot.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::boxed::Box; -use std::error::Error; - -use image_autopilot::GenericImageView; - -use crate::capturable::{Capturable, Geometry, Recorder}; - -#[derive(Clone)] -pub struct AutoPilotCapturable {} - -impl AutoPilotCapturable { - pub fn new() -> Self { - Self {} - } -} - -impl Capturable for AutoPilotCapturable { - fn name(&self) -> String { - "Desktop (autopilot)".into() - } - fn geometry(&self) -> Result> { - Ok(Geometry::Relative(0.0, 0.0, 1.0, 1.0)) - } - fn before_input(&mut self) -> Result<(), Box> { - Ok(()) - } - fn recorder(&self, _capture_cursor: bool) -> Result, Box> { - Ok(Box::new(RecorderAutoPilot::new())) - } -} - -pub struct RecorderAutoPilot { - img: Vec, -} - -impl RecorderAutoPilot { - pub fn new() -> Self { - Self { img: Vec::new() } - } -} - -impl Recorder for RecorderAutoPilot { - fn capture(&mut self) -> Result> { - let img = autopilot::bitmap::capture_screen()?.image; - let w = img.width() as usize; - let h = img.height() as usize; - self.img = img.into_rgb().into_raw(); - Ok(crate::video::PixelProvider::RGB(w, h, &self.img)) - } -} diff --git a/src/capturable/mod.rs b/src/capturable/mod.rs index a81f12d..2753485 100644 --- a/src/capturable/mod.rs +++ b/src/capturable/mod.rs @@ -1,5 +1,3 @@ -pub mod autopilot; - use std::boxed::Box; use std::error::Error; use tracing::warn; diff --git a/src/config.rs b/src/config.rs index b2b2687..6b2a717 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,4 @@ use std::net::IpAddr; -use std::str::FromStr; use std::{fs, path::PathBuf}; use clap::Parser; diff --git a/src/gui.rs b/src/gui.rs index 99bbfd4..70eb395 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -330,7 +330,7 @@ pub fn run(config: &Config, log_receiver: mpsc::Receiver) { image .write_to(&mut cursor, image::ImageFormat::Png) .unwrap(); - let png = fltk::image::PngImage::from_data(&buf).unwrap(); + let png = PngImage::from_data(&buf).unwrap(); qr_frame.set_image(Some(png)); }; diff --git a/src/main.rs b/src/main.rs index 4a04d6e..9b7f650 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,9 +78,9 @@ fn main() { if conf.no_gui { let mut weylus = crate::weylus::Weylus::new(); - weylus.start(&conf, |msg| { - if let crate::web::Web2UiMessage::UInputInaccessible = msg { - warn!(std::include_str!("strings/uinput_error.txt")); + weylus.start(&conf, |msg| match msg { + web::Web2UiMessage::UInputInaccessible => { + warn!(std::include_str!("strings/uinput_error.txt")) } }); #[cfg(unix)] diff --git a/src/protocol.rs b/src/protocol.rs index ecf452a..3c2fa1f 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -157,7 +157,4 @@ pub trait WeylusSender { pub trait WeylusReceiver: Iterator> { type Error: std::error::Error; - fn recv_message(&mut self) -> Option> { - self.next() - } } diff --git a/src/websocket.rs b/src/websocket.rs index 4fc470e..a80d6a4 100644 --- a/src/websocket.rs +++ b/src/websocket.rs @@ -2,7 +2,7 @@ use fastwebsockets::{FragmentCollectorRead, Frame, OpCode, WebSocket, WebSocketE use hyper::upgrade::Upgraded; use hyper_util::rt::TokioIo; use std::convert::Infallible; -use std::sync::mpsc::{RecvTimeoutError, SendError}; +use std::sync::mpsc::RecvTimeoutError; use std::sync::{mpsc, Arc}; use std::thread::{spawn, JoinHandle}; use std::time::{Duration, Instant};