use std::marker::PhantomData;
use libc::{int32_t, uint32_t};
use wlroots_sys::{wlr_xwayland_surface_hints, wlr_xwayland_surface_size_hints};
use xwayland;
pub struct Hints<'surface> {
hints: *mut wlr_xwayland_surface_hints,
phantom: PhantomData<&'surface xwayland::surface::Surface>
}
pub struct SizeHints<'surface> {
hints: *mut wlr_xwayland_surface_size_hints,
phantom: PhantomData<&'surface xwayland::surface::Surface>
}
impl<'surface> Hints<'surface> {
pub(crate) unsafe fn from_ptr(hints: *mut wlr_xwayland_surface_hints) -> Self {
Hints { hints,
phantom: PhantomData }
}
pub fn flags(&self) -> uint32_t {
unsafe { (*self.hints).flags }
}
pub fn input(&self) -> uint32_t {
unsafe { (*self.hints).input }
}
pub fn initial_state(&self) -> int32_t {
unsafe { (*self.hints).initial_state }
}
pub unsafe fn icon_pixmap(&self) -> u32 {
(*self.hints).icon_pixmap
}
pub unsafe fn icon_window(&self) -> u32 {
(*self.hints).icon_window
}
pub fn icon_coords(&self) -> (int32_t, int32_t) {
unsafe { ((*self.hints).icon_x, (*self.hints).icon_y) }
}
pub unsafe fn icon_mask(&self) -> u32 {
(*self.hints).icon_mask
}
pub unsafe fn window_group(&self) -> u32 {
(*self.hints).window_group
}
}
impl<'surface> SizeHints<'surface> {
pub(crate) unsafe fn from_ptr(hints: *mut wlr_xwayland_surface_size_hints) -> Self {
SizeHints { hints,
phantom: PhantomData }
}
pub fn flags(&self) -> uint32_t {
unsafe { (*self.hints).flags }
}
pub fn coords(&self) -> (int32_t, int32_t) {
unsafe { ((*self.hints).x, (*self.hints).y) }
}
pub fn dimensions(&self) -> (int32_t, int32_t) {
unsafe { ((*self.hints).width, (*self.hints).height) }
}
pub fn min_dimensions(&self) -> (int32_t, int32_t) {
unsafe { ((*self.hints).min_width, (*self.hints).min_height) }
}
pub fn max_dimensions(&self) -> (int32_t, int32_t) {
unsafe { ((*self.hints).max_width, (*self.hints).max_height) }
}
pub fn inc_dimensions(&self) -> (int32_t, int32_t) {
unsafe { ((*self.hints).width_inc, (*self.hints).height_inc) }
}
pub fn base_dimensions(&self) -> (int32_t, int32_t) {
unsafe { ((*self.hints).base_width, (*self.hints).base_height) }
}
pub fn min_aspect_num(&self) -> int32_t {
unsafe { (*self.hints).min_aspect_num }
}
pub fn min_aspect_den(&self) -> int32_t {
unsafe { (*self.hints).min_aspect_den }
}
pub fn max_aspect_num(&self) -> int32_t {
unsafe { (*self.hints).max_aspect_num }
}
pub fn max_aspect_den(&self) -> int32_t {
unsafe { (*self.hints).max_aspect_den }
}
pub fn win_gravity(&self) -> uint32_t {
unsafe { (*self.hints).win_gravity }
}
}