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