gdk/event_owner_change.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5/// Generated when the owner of a selection changes. On X11, this
6/// information is only available if the X server supports the XFIXES
7/// extension.
8#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
9pub struct EventOwnerChange(crate::Event);
10
11event_wrapper!(EventOwnerChange, GdkEventOwnerChange);
12event_subtype!(EventOwnerChange, ffi::GDK_OWNER_CHANGE);
13
14impl EventOwnerChange {
15 #[doc(alias = "get_owner")]
16 pub fn owner(&self) -> Option<crate::Window> {
17 unsafe { from_glib_none(self.as_ref().owner) }
18 }
19
20 #[doc(alias = "get_reason")]
21 pub fn reason(&self) -> crate::OwnerChange {
22 unsafe { from_glib(self.as_ref().reason) }
23 }
24
25 #[doc(alias = "get_selection")]
26 pub fn selection(&self) -> crate::Atom {
27 unsafe { from_glib_none(self.as_ref().selection as *mut _) }
28 }
29
30 #[doc(alias = "get_time")]
31 pub fn time(&self) -> u32 {
32 self.as_ref().time
33 }
34
35 #[doc(alias = "get_selection_time")]
36 pub fn selection_time(&self) -> u32 {
37 self.as_ref().selection_time
38 }
39}