1use gdk_sys;
6use glib::translate::*;
7use glib_sys;
8use Gravity;
9
10#[derive(Clone, Copy, Debug, PartialEq)]
11#[repr(C)]
12pub struct Geometry {
13 pub min_width: i32,
14 pub min_height: i32,
15 pub max_width: i32,
16 pub max_height: i32,
17 pub base_width: i32,
18 pub base_height: i32,
19 pub width_inc: i32,
20 pub height_inc: i32,
21 pub min_aspect: f64,
22 pub max_aspect: f64,
23 pub win_gravity: Gravity,
24}
25
26#[doc(hidden)]
27impl<'a> ToGlibPtr<'a, *const gdk_sys::GdkGeometry> for Geometry {
28 type Storage = &'a Self;
29
30 #[inline]
31 fn to_glib_none(&'a self) -> Stash<'a, *const gdk_sys::GdkGeometry, Self> {
32 let ptr: *const Geometry = &*self;
33 Stash(ptr as *const gdk_sys::GdkGeometry, self)
34 }
35}
36
37#[doc(hidden)]
38impl<'a> ToGlibPtrMut<'a, *mut gdk_sys::GdkGeometry> for Geometry {
39 type Storage = &'a mut Self;
40
41 #[inline]
42 fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut gdk_sys::GdkGeometry, Self> {
43 let ptr: *mut Geometry = &mut *self;
44 StashMut(ptr as *mut gdk_sys::GdkGeometry, self)
45 }
46}
47
48#[doc(hidden)]
49impl FromGlibPtrNone<*const gdk_sys::GdkGeometry> for Geometry {
50 unsafe fn from_glib_none(ptr: *const gdk_sys::GdkGeometry) -> Self {
51 *(ptr as *const Geometry)
52 }
53}
54
55#[doc(hidden)]
56impl FromGlibPtrNone<*mut gdk_sys::GdkGeometry> for Geometry {
57 unsafe fn from_glib_none(ptr: *mut gdk_sys::GdkGeometry) -> Self {
58 *(ptr as *mut Geometry)
59 }
60}
61
62#[doc(hidden)]
63impl FromGlibPtrFull<*mut gdk_sys::GdkGeometry> for Geometry {
64 #[inline]
65 unsafe fn from_glib_full(ptr: *mut gdk_sys::GdkGeometry) -> Self {
66 let geom = *(ptr as *mut Geometry);
67 glib_sys::g_free(ptr as *mut _);
68 geom
69 }
70}