Update for Rustc

This commit is contained in:
Pierre Krieger 2015-01-03 23:11:59 +01:00
parent ebe32bb2d8
commit 4c5e430dd3
12 changed files with 32 additions and 27 deletions

View file

@ -1241,7 +1241,7 @@ pub struct XSetWindowAttributes {
#[repr(C)]
pub struct XEvent {
pub type_: libc::c_int,
pad: [libc::c_long, ..24],
pad: [libc::c_long; 24],
}
#[repr(C)]
@ -1253,7 +1253,7 @@ pub struct XClientMessageEvent {
pub window: Window,
pub message_type: Atom,
pub format: libc::c_int,
pub l: [libc::c_long, ..5],
pub l: [libc::c_long; 5],
}
#[repr(C)]
@ -1435,7 +1435,7 @@ extern "C" {
res_class: *mut libc::c_char) -> XIM;
// TODO: this is a vararg function
//pub fn XCreateIC(im: XIM, ...) -> XIC;
//pub fn XCreateIC(im: XIM; .) -> XIC;
pub fn XCreateIC(im: XIM, a: *const libc::c_char, b: libc::c_long, c: *const libc::c_char,
d: Window, e: *const ()) -> XIC;
pub fn XDestroyIC(ic: XIC);

View file

@ -57,7 +57,7 @@ impl Drop for XWindow {
}
}
#[deriving(Clone)]
#[derive(Clone)]
pub struct WindowProxy {
x: Arc<XWindow>,
}
@ -302,6 +302,7 @@ impl Window {
// loading the extra GLX functions
let extra_functions = ffi::glx_extra::Glx::load_with(|addr| {
use std::c_str::ToCStr;
addr.with_c_str(|s| {
use libc;
ffi::glx::GetProcAddress(s as *const u8) as *const libc::c_void
@ -355,6 +356,7 @@ impl Window {
}
pub fn set_title(&self, title: &str) {
use std::c_str::ToCStr;
let c_title = title.to_c_str();
unsafe {
ffi::XStoreName(self.x.display, self.x.window, c_title.as_ptr());
@ -494,7 +496,7 @@ impl Window {
let written = unsafe {
use std::str;
let mut buffer: [u8, ..16] = [mem::uninitialized(), ..16];
let mut buffer: [u8; 16] = [mem::uninitialized(); 16];
let raw_ev: *mut ffi::XKeyEvent = event;
let count = ffi::Xutf8LookupString(self.x.ic, mem::transmute(raw_ev),
mem::transmute(buffer.as_mut_ptr()),