aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/x11')
-rw-r--r--src/x11/headless.rs9
-rw-r--r--src/x11/window/mod.rs22
-rw-r--r--src/x11/window/monitor.rs10
3 files changed, 21 insertions, 20 deletions
diff --git a/src/x11/headless.rs b/src/x11/headless.rs
index d13d1d0..7692832 100644
--- a/src/x11/headless.rs
+++ b/src/x11/headless.rs
@@ -14,8 +14,8 @@ fn with_c_str<F, T>(s: &str, f: F) -> T where F: FnOnce(*const i8) -> T {
pub struct HeadlessContext {
context: ffi::OSMesaContext,
buffer: Vec<u32>,
- width: uint,
- height: uint,
+ width: u32,
+ height: u32,
}
impl HeadlessContext {
@@ -25,7 +25,8 @@ impl HeadlessContext {
Ok(HeadlessContext {
width: dimensions.0,
height: dimensions.1,
- buffer: ::std::iter::repeat(unsafe { mem::uninitialized() }).take(dimensions.0 * dimensions.1).collect(),
+ buffer: ::std::iter::repeat(unsafe { mem::uninitialized() })
+ .take((dimensions.0 * dimensions.1) as usize).collect(),
context: unsafe {
let ctxt = ffi::OSMesaCreateContext(0x1908, ptr::null());
if ctxt.is_null() {
@@ -59,7 +60,7 @@ impl HeadlessContext {
::Api::OpenGl
}
- pub fn set_window_resize_callback(&mut self, _: Option<fn(uint, uint)>) {
+ pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
}
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 904bef9..5b70a19 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -169,7 +169,7 @@ impl Window {
return Err(OsError(format!("Could not find a suitable graphics mode")));
}
- modes
+ modes
};
let xf86_desk_mode = unsafe {
@@ -383,7 +383,7 @@ impl Window {
}
}
- fn get_geometry(&self) -> Option<(isize, isize, usize, usize)> {
+ fn get_geometry(&self) -> Option<(i32, i32, u32, u32)> {
unsafe {
use std::mem;
@@ -402,27 +402,27 @@ impl Window {
return None;
}
- Some((x as isize, y as isize, width as usize, height as usize))
+ Some((x as i32, y as i32, width as u32, height as u32))
}
}
- pub fn get_position(&self) -> Option<(isize, isize)> {
+ pub fn get_position(&self) -> Option<(i32, i32)> {
self.get_geometry().map(|(x, y, _, _)| (x, y))
}
- pub fn set_position(&self, x: isize, y: isize) {
+ pub fn set_position(&self, x: i32, y: i32) {
unsafe { ffi::XMoveWindow(self.x.display, self.x.window, x as libc::c_int, y as libc::c_int) }
}
- pub fn get_inner_size(&self) -> Option<(usize, usize)> {
+ pub fn get_inner_size(&self) -> Option<(u32, u32)> {
self.get_geometry().map(|(_, _, w, h)| (w, h))
}
- pub fn get_outer_size(&self) -> Option<(usize, usize)> {
+ pub fn get_outer_size(&self) -> Option<(u32, u32)> {
unimplemented!()
}
- pub fn set_inner_size(&self, _x: usize, _y: usize) {
+ pub fn set_inner_size(&self, _x: u32, _y: u32) {
unimplemented!()
}
@@ -476,14 +476,14 @@ impl Window {
let (current_width, current_height) = self.current_size.get();
if current_width != cfg_event.width || current_height != cfg_event.height {
self.current_size.set((cfg_event.width, cfg_event.height));
- events.push_back(Resized(cfg_event.width as usize, cfg_event.height as usize));
+ events.push_back(Resized(cfg_event.width as u32, cfg_event.height as u32));
}
},
ffi::MotionNotify => {
use events::Event::MouseMoved;
let event: &ffi::XMotionEvent = unsafe { mem::transmute(&xev) };
- events.push_back(MouseMoved((event.x as isize, event.y as isize)));
+ events.push_back(MouseMoved((event.x as i32, event.y as i32)));
},
ffi::KeyPress | ffi::KeyRelease => {
@@ -609,7 +609,7 @@ impl Window {
::Api::OpenGl
}
- pub fn set_window_resize_callback(&mut self, _: Option<fn(usize, usize)>) {
+ pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
pub fn set_cursor(&self, cursor: MouseCursor) {
diff --git a/src/x11/window/monitor.rs b/src/x11/window/monitor.rs
index 29c23c9..3c188b6 100644
--- a/src/x11/window/monitor.rs
+++ b/src/x11/window/monitor.rs
@@ -3,7 +3,7 @@ use std::collections::RingBuf;
use super::super::ffi;
use super::ensure_thread_init;
-pub struct MonitorID(pub usize);
+pub struct MonitorID(pub u32);
pub fn get_available_monitors() -> RingBuf<MonitorID> {
ensure_thread_init();
@@ -18,7 +18,7 @@ pub fn get_available_monitors() -> RingBuf<MonitorID> {
};
let mut monitors = RingBuf::new();
- monitors.extend(range(0, nb_monitors).map(|i| MonitorID(i as usize)));
+ monitors.extend(range(0, nb_monitors).map(|i| MonitorID(i as u32)));
monitors
}
@@ -34,7 +34,7 @@ pub fn get_primary_monitor() -> MonitorID {
primary_monitor
};
- MonitorID(primary_monitor as usize)
+ MonitorID(primary_monitor as u32)
}
impl MonitorID {
@@ -43,7 +43,7 @@ impl MonitorID {
Some(format!("Monitor #{}", screen_num))
}
- pub fn get_dimensions(&self) -> (usize, usize) {
+ pub fn get_dimensions(&self) -> (u32, u32) {
let dimensions = unsafe {
let display = ffi::XOpenDisplay(ptr::null());
let MonitorID(screen_num) = *self;
@@ -51,7 +51,7 @@ impl MonitorID {
let width = ffi::XWidthOfScreen(screen);
let height = ffi::XHeightOfScreen(screen);
ffi::XCloseDisplay(display);
- (width as usize, height as usize)
+ (width as u32, height as u32)
};
dimensions