gdk/
event_owner_change.rs

1// Copyright 2016, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use gdk_sys;
6use glib::translate::*;
7
8#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
9pub struct EventOwnerChange(::Event);
10
11event_wrapper!(EventOwnerChange, GdkEventOwnerChange);
12event_subtype!(EventOwnerChange, gdk_sys::GDK_OWNER_CHANGE);
13
14impl EventOwnerChange {
15    pub fn get_owner(&self) -> Option<::Window> {
16        unsafe { from_glib_none(self.as_ref().owner) }
17    }
18
19    pub fn get_reason(&self) -> ::OwnerChange {
20        from_glib(self.as_ref().reason)
21    }
22
23    pub fn get_selection(&self) -> ::Atom {
24        unsafe { from_glib_none(self.as_ref().selection as *mut _) }
25    }
26
27    pub fn get_time(&self) -> u32 {
28        self.as_ref().time
29    }
30
31    pub fn get_selection_time(&self) -> u32 {
32        self.as_ref().selection_time
33    }
34}