wayland_bridge/
secure_output.rs1use crate::client::Client;
6use crate::compositor::Surface;
7use crate::object::{NewObjectExt, ObjectRef, RequestReceiver};
8use anyhow::Error;
9use fuchsia_wayland_core as wl;
10use zcr_secure_output_v1_server_protocol::{
11 ZcrSecureOutputV1, ZcrSecureOutputV1Request, ZcrSecurityV1, ZcrSecurityV1Request,
12};
13
14pub struct SecureOutput;
16
17impl SecureOutput {
18 pub fn new() -> Self {
20 SecureOutput
21 }
22}
23
24impl RequestReceiver<ZcrSecureOutputV1> for SecureOutput {
25 fn receive(
26 this: ObjectRef<Self>,
27 request: ZcrSecureOutputV1Request,
28 client: &mut Client,
29 ) -> Result<(), Error> {
30 match request {
31 ZcrSecureOutputV1Request::Destroy => {
32 client.delete_id(this.id())?;
33 }
34 ZcrSecureOutputV1Request::GetSecurity { id, surface } => {
35 id.implement(client, Security::new(surface))?;
36 }
37 }
38 Ok(())
39 }
40}
41
42struct Security {
43 _surface_ref: ObjectRef<Surface>,
44}
45
46impl Security {
47 pub fn new(surface: wl::ObjectId) -> Self {
48 Security { _surface_ref: surface.into() }
49 }
50}
51
52impl RequestReceiver<ZcrSecurityV1> for Security {
53 fn receive(
54 this: ObjectRef<Self>,
55 request: ZcrSecurityV1Request,
56 client: &mut Client,
57 ) -> Result<(), Error> {
58 match request {
59 ZcrSecurityV1Request::Destroy => {
60 client.delete_id(this.id())?;
61 }
62 ZcrSecurityV1Request::OnlyVisibleOnSecureOutput => {}
63 }
64 Ok(())
65 }
66}