gdk/visual.rs
1// Copyright 2013-2015, 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 std::ptr;
7use std::slice;
8use Visual;
9
10impl Visual {
11 pub fn query_depths() -> Vec<i32> {
12 assert_initialized_main_thread!();
13 let mut ptr = ptr::null_mut();
14 let mut count = 0;
15
16 unsafe {
17 gdk_sys::gdk_query_depths(&mut ptr, &mut count);
18 Vec::from(slice::from_raw_parts(ptr as *const i32, count as usize))
19 }
20 }
21}