summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gpu_display/src/gpu_display_wl.rs12
-rw-r--r--gpu_display/src/gpu_display_x.rs11
-rw-r--r--gpu_display/src/lib.rs18
3 files changed, 39 insertions, 2 deletions
diff --git a/gpu_display/src/gpu_display_wl.rs b/gpu_display/src/gpu_display_wl.rs
index 3e1fe92..04ddb54 100644
--- a/gpu_display/src/gpu_display_wl.rs
+++ b/gpu_display/src/gpu_display_wl.rs
@@ -12,7 +12,7 @@ mod dwl;
 
 use dwl::*;
 
-use crate::{DisplayT, GpuDisplayError, GpuDisplayFramebuffer};
+use crate::{DisplayT, EventDevice, GpuDisplayError, GpuDisplayFramebuffer};
 
 use std::cell::Cell;
 use std::collections::HashMap;
@@ -341,6 +341,16 @@ impl DisplayT for DisplayWl {
             None => debug_assert!(false, "invalid surface_id {}", surface_id),
         }
     }
+
+    fn import_event_device(&mut self, _event_device: EventDevice) -> Result<u32, GpuDisplayError> {
+        Err(GpuDisplayError::Unsupported)
+    }
+    fn release_event_device(&mut self, _event_device_id: u32) {
+        // unsupported
+    }
+    fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32) {
+        // unsupported
+    }
 }
 
 impl AsRawFd for DisplayWl {
diff --git a/gpu_display/src/gpu_display_x.rs b/gpu_display/src/gpu_display_x.rs
index 837a151..1df7fc2 100644
--- a/gpu_display/src/gpu_display_x.rs
+++ b/gpu_display/src/gpu_display_x.rs
@@ -22,7 +22,7 @@ use std::rc::Rc;
 
 use libc::{shmat, shmctl, shmdt, shmget, IPC_CREAT, IPC_PRIVATE, IPC_RMID};
 
-use crate::{DisplayT, GpuDisplayError, GpuDisplayFramebuffer};
+use crate::{DisplayT, EventDevice, GpuDisplayError, GpuDisplayFramebuffer};
 
 use data_model::VolatileSlice;
 
@@ -638,6 +638,15 @@ impl DisplayT for DisplayX {
     fn set_position(&mut self, surface_id: u32, x: u32, y: u32) {
         // unsupported
     }
+    fn import_event_device(&mut self, _event_device: EventDevice) -> Result<u32, GpuDisplayError> {
+        Err(GpuDisplayError::Unsupported)
+    }
+    fn release_event_device(&mut self, _event_device_id: u32) {
+        // unsupported
+    }
+    fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32) {
+        // unsupported
+    }
 }
 
 impl AsRawFd for DisplayX {
diff --git a/gpu_display/src/lib.rs b/gpu_display/src/lib.rs
index 5c243d6..8cc018a 100644
--- a/gpu_display/src/lib.rs
+++ b/gpu_display/src/lib.rs
@@ -155,6 +155,9 @@ trait DisplayT: AsRawFd {
     fn flip_to(&mut self, surface_id: u32, import_id: u32);
     fn close_requested(&self, surface_id: u32) -> bool;
     fn set_position(&mut self, surface_id: u32, x: u32, y: u32);
+    fn import_event_device(&mut self, event_device: EventDevice) -> Result<u32, GpuDisplayError>;
+    fn release_event_device(&mut self, event_device_id: u32);
+    fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32);
 }
 
 /// A connection to the compositor and associated collection of state.
@@ -291,6 +294,21 @@ impl GpuDisplay {
     pub fn set_position(&mut self, surface_id: u32, x: u32, y: u32) {
         self.inner.set_position(surface_id, x, y)
     }
+
+    pub fn import_event_device(
+        &mut self,
+        event_device: EventDevice,
+    ) -> Result<u32, GpuDisplayError> {
+        self.inner.import_event_device(event_device)
+    }
+
+    pub fn release_event_device(&mut self, event_device_id: u32) {
+        self.inner.release_event_device(event_device_id)
+    }
+
+    pub fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32) {
+        self.inner.attach_event_device(surface_id, event_device_id);
+    }
 }
 
 impl AsRawFd for GpuDisplay {