1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::WaylandSeat;
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
use {gdk::prelude::*, glib::translate::ToGlibPtr};
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
use wayland_client::{backend::ObjectId, protocol::wl_seat::WlSeat, Proxy};
impl WaylandSeat {
#[doc(alias = "gdk_wayland_seat_get_wl_seat")]
#[doc(alias = "get_wl_seat")]
#[cfg(any(feature = "wayland_crate", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "wayland_crate")))]
pub fn wl_seat(&self) -> Option<WlSeat> {
let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
unsafe {
let seat_ptr = ffi::gdk_wayland_seat_get_wl_seat(self.to_glib_none().0);
if seat_ptr.is_null() {
None
} else {
let cnx = display.connection();
let id = ObjectId::from_ptr(WlSeat::interface(), seat_ptr as *mut _).unwrap();
WlSeat::from_id(&cnx, id).ok()
}
}
}
}