1use std::{
2 fmt::Debug,
3 hash::{Hash, Hasher},
4};
5
6use uuid::Uuid;
7use wayland_backend::client::ObjectId;
8
9use crate::{Bounds, DevicePixels, DisplayId, PlatformDisplay};
10
11#[derive(Debug, Clone)]
12pub(crate) struct WaylandDisplay {
13 /// The ID of the wl_output object
14 pub id: ObjectId,
15 pub bounds: Bounds<DevicePixels>,
16}
17
18impl Hash for WaylandDisplay {
19 fn hash<H: Hasher>(&self, state: &mut H) {
20 self.id.hash(state);
21 }
22}
23
24impl PlatformDisplay for WaylandDisplay {
25 fn id(&self) -> DisplayId {
26 DisplayId(self.id.protocol_id())
27 }
28
29 fn uuid(&self) -> anyhow::Result<Uuid> {
30 Err(anyhow::anyhow!("Display UUID is not supported on Wayland"))
31 }
32
33 fn bounds(&self) -> Bounds<DevicePixels> {
34 self.bounds
35 }
36}