diff options
Diffstat (limited to 'gpu_display/src/lib.rs')
-rw-r--r-- | gpu_display/src/lib.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gpu_display/src/lib.rs b/gpu_display/src/lib.rs index 07358a0..dccf1c7 100644 --- a/gpu_display/src/lib.rs +++ b/gpu_display/src/lib.rs @@ -171,6 +171,7 @@ trait DisplayT: AsRawFd { /// descriptor. When the connection is readable, `dispatch_events` can be called to process it. pub struct GpuDisplay { inner: Box<dyn DisplayT>, + is_x: bool, } impl GpuDisplay { @@ -183,7 +184,7 @@ impl GpuDisplay { None => gpu_display_x::DisplayX::open_display(None)?, }; let inner = Box::new(display); - Ok(GpuDisplay { inner }) + Ok(GpuDisplay { inner, is_x: true }) } #[cfg(not(feature = "x"))] Err(GpuDisplayError::Unsupported) @@ -198,13 +199,18 @@ impl GpuDisplay { None => gpu_display_wl::DisplayWl::new(None)?, }; let inner = Box::new(display); - Ok(GpuDisplay { inner }) + Ok(GpuDisplay { inner, is_x: false }) } pub fn open_stub() -> Result<GpuDisplay, GpuDisplayError> { let display = gpu_display_stub::DisplayStub::new()?; let inner = Box::new(display); - Ok(GpuDisplay { inner }) + Ok(GpuDisplay { inner, is_x: false }) + } + + /// Return whether this display is an X display + pub fn is_x(&self) -> bool { + self.is_x } /// Imports a dmabuf to the compositor for use as a surface buffer and returns a handle to it. |