improve capture error handling

This commit is contained in:
Ferdinand Schober
2024-07-10 09:00:43 +02:00
parent 6a4dd740c3
commit 110b37e26e
14 changed files with 296 additions and 216 deletions

View File

@@ -215,6 +215,13 @@ impl Window {
}
}
pub fn request_capture(&self) {
self.request(FrontendRequest::EnableCapture);
}
pub fn request_emulation(&self) {
self.request(FrontendRequest::EnableEmulation);
}
pub fn request_client_state(&self, client: &ClientObject) {
let handle = client.handle();
let event = FrontendRequest::GetState(handle);

View File

@@ -30,6 +30,10 @@ pub struct Window {
pub hostname_label: TemplateChild<Label>,
#[template_child]
pub toast_overlay: TemplateChild<ToastOverlay>,
#[template_child]
pub input_emulation_button: TemplateChild<Button>,
#[template_child]
pub input_capture_button: TemplateChild<Button>,
pub clients: RefCell<Option<gio::ListStore>>,
#[cfg(unix)]
pub stream: RefCell<Option<UnixStream>>,
@@ -100,6 +104,17 @@ impl Window {
self.port_edit_cancel.set_visible(false);
}
#[template_callback]
fn handle_emulation(&self) {
self.obj().request_emulation();
}
#[template_callback]
fn handle_capture(&self) {
log::info!("requesting capture");
self.obj().request_capture();
}
pub fn set_port(&self, port: u16) {
self.port.set(port);
if port == DEFAULT_PORT {