use std::ptr;
use ffi;
use c_str::{ToCStr, FromCStr};
pub fn init() {
unsafe { ffi::gdk_init(ptr::null_mut(), ptr::null_mut()) }
}
pub fn get_display_arg_name() -> Option<String> {
let tmp = unsafe { ffi::gdk_get_display_arg_name() };
if tmp.is_null() {
None
} else {
unsafe { Some(FromCStr::from_raw_buf(tmp as *const u8)) }
}
}
pub fn notify_startup_complete() {
unsafe { ffi::gdk_notify_startup_complete() }
}
pub fn notify_startup_complete_with_id(startup_id: &str) {
unsafe {
ffi::gdk_notify_startup_complete_with_id(startup_id.with_c_str(|c_str| {
c_str
}))
}
}
pub fn set_allowed_backends(backends: &str) {
unsafe {
ffi::gdk_set_allowed_backends(backends.with_c_str(|c_str| {
c_str
}))
}
}
pub fn get_program_class() -> Option<String> {
let tmp = unsafe { ffi::gdk_get_program_class() };
if tmp.is_null() {
None
} else {
unsafe { Some(FromCStr::from_raw_buf(tmp as *const u8)) }
}
}
pub fn set_program_class(program_class: &str) {
unsafe {
ffi::gdk_set_program_class(program_class.with_c_str(|c_str| {
c_str
}))
}
}
pub fn flush() {
unsafe { ffi::gdk_flush() }
}
pub fn screen_width() -> i32 {
unsafe { ffi::gdk_screen_width() }
}
pub fn screen_height() -> i32 {
unsafe { ffi::gdk_screen_height() }
}
pub fn screen_width_mm() -> i32 {
unsafe { ffi::gdk_screen_width_mm() }
}
pub fn screen_height_mm() -> i32 {
unsafe { ffi::gdk_screen_height_mm() }
}
pub fn beep() {
unsafe { ffi::gdk_flush() }
}
pub fn error_trap_push() {
unsafe { ffi::gdk_error_trap_push() }
}
pub fn error_trap_pop() {
unsafe { ffi::gdk_error_trap_pop() }
}
pub fn error_trap_pop_ignored() {
unsafe { ffi::gdk_error_trap_pop_ignored() }
}