diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/tty.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 392a038a..a96eb064 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -1537,7 +1537,15 @@ impl Tty { #[cfg(feature = "xdp-gnome-screencast")] pub fn primary_gbm_device(&self) -> Option<GbmDevice<DrmDeviceFd>> { - self.devices.get(&self.primary_node).map(|d| d.gbm.clone()) + // Try to find a device corresponding to the primary render node. + let device = self + .devices + .values() + .find(|d| d.render_node == self.primary_render_node); + // Otherwise, try to get the device corresponding to the primary node. + let device = device.or_else(|| self.devices.get(&self.primary_node)); + + Some(device?.gbm.clone()) } pub fn set_monitors_active(&mut self, active: bool) { |
