aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Lesnikov <ozkriff@gmail.com>2015-01-13 15:21:36 +0300
committerAndrey Lesnikov <ozkriff@gmail.com>2015-01-13 16:23:30 +0300
commit5a4fee967a9f2d7d64edad09bf1f19a5c560032e (patch)
tree81526203a89160898dc8ee55472628012f2708b0
parentd11f63a749b73148defb43b670b8ef8206437194 (diff)
downloadglutin-5a4fee967a9f2d7d64edad09bf1f19a5c560032e.tar.gz
glutin-5a4fee967a9f2d7d64edad09bf1f19a5c560032e.zip
x11, android, win32: [ui]size, [u]int -> [ui]32
-rw-r--r--examples/window.rs4
-rw-r--r--src/android/mod.rs26
-rw-r--r--src/events.rs6
-rw-r--r--src/lib.rs28
-rw-r--r--src/win32/init.rs38
-rw-r--r--src/win32/mod.rs24
-rw-r--r--src/win32/monitor.rs14
-rw-r--r--src/x11/headless.rs9
-rw-r--r--src/x11/window/mod.rs22
-rw-r--r--src/x11/window/monitor.rs10
10 files changed, 91 insertions, 90 deletions
diff --git a/examples/window.rs b/examples/window.rs
index 11ab737..37966c4 100644
--- a/examples/window.rs
+++ b/examples/window.rs
@@ -13,7 +13,7 @@ android_start!(main);
fn main() { println!("This example requires glutin to be compiled with the `window` feature"); }
#[cfg(feature = "window")]
-fn resize_callback(width: uint, height: uint) {
+fn resize_callback(width: u32, height: u32) {
println!("Window resized to {}x{}", width, height);
}
@@ -21,7 +21,7 @@ fn resize_callback(width: uint, height: uint) {
fn main() {
let mut window = glutin::Window::new().unwrap();
window.set_title("A fantastic window!");
- window.set_window_resize_callback(Some(resize_callback as fn(uint, uint)));
+ window.set_window_resize_callback(Some(resize_callback as fn(u32, u32)));
unsafe { window.make_current() };
let context = support::load(&window);
diff --git a/src/android/mod.rs b/src/android/mod.rs
index 19f4870..f501420 100644
--- a/src/android/mod.rs
+++ b/src/android/mod.rs
@@ -3,7 +3,7 @@ extern crate android_glue;
use libc;
use std::ffi::{CString};
use std::sync::mpsc::{Receiver, channel};
-use {CreationError, Event, WindowBuilder, MouseCursor};
+use {CreationError, Event, MouseCursor};
use CreationError::OsError;
use events::ElementState::{Pressed, Released};
use events::Event::{MouseInput, MouseMoved};
@@ -39,13 +39,13 @@ impl MonitorID {
Some("Primary".to_string())
}
- pub fn get_dimensions(&self) -> (uint, uint) {
+ pub fn get_dimensions(&self) -> (u32, u32) {
unimplemented!()
}
}
#[cfg(feature = "headless")]
-pub struct HeadlessContext(int);
+pub struct HeadlessContext(i32);
#[cfg(feature = "headless")]
impl HeadlessContext {
@@ -190,31 +190,31 @@ impl Window {
pub fn hide(&self) {
}
- pub fn get_position(&self) -> Option<(int, int)> {
+ pub fn get_position(&self) -> Option<(i32, i32)> {
None
}
- pub fn set_position(&self, _x: int, _y: int) {
+ pub fn set_position(&self, _x: i32, _y: i32) {
}
- pub fn get_inner_size(&self) -> Option<(uint, uint)> {
+ pub fn get_inner_size(&self) -> Option<(u32, u32)> {
let native_window = unsafe { android_glue::get_native_window() };
if native_window.is_null() {
None
} else {
Some((
- unsafe { ffi::ANativeWindow_getWidth(native_window) } as uint,
- unsafe { ffi::ANativeWindow_getHeight(native_window) } as uint
+ unsafe { ffi::ANativeWindow_getWidth(native_window) } as u32,
+ unsafe { ffi::ANativeWindow_getHeight(native_window) } as u32
))
}
}
- pub fn get_outer_size(&self) -> Option<(uint, uint)> {
+ pub fn get_outer_size(&self) -> Option<(u32, u32)> {
self.get_inner_size()
}
- pub fn set_inner_size(&self, _x: uint, _y: uint) {
+ pub fn set_inner_size(&self, _x: u32, _y: u32) {
}
pub fn create_window_proxy(&self) -> WindowProxy {
@@ -233,7 +233,7 @@ impl Window {
events.push_back(MouseInput(Released, LeftMouseButton));
},
android_glue::Event::EventMove(x, y) => {
- events.push_back(MouseMoved((x as int, y as int)));
+ events.push_back(MouseMoved((x as i32, y as i32)));
},
},
Err(_) => {
@@ -278,10 +278,10 @@ impl Window {
::Api::OpenGlEs
}
- pub fn set_window_resize_callback(&mut self, _: Option<fn(uint, uint)>) {
+ pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
- pub fn set_cursor(&self, cursor: MouseCursor) {
+ pub fn set_cursor(&self, _: MouseCursor) {
}
}
diff --git a/src/events.rs b/src/events.rs
index 87f2cc8..34234b2 100644
--- a/src/events.rs
+++ b/src/events.rs
@@ -1,10 +1,10 @@
#[derive(Clone, Show, Copy)]
pub enum Event {
/// The size of the window has changed.
- Resized(usize, usize),
+ Resized(u32, u32),
/// The position of the window has changed.
- Moved(isize, isize),
+ Moved(i32, i32),
/// The window has been closed.
Closed,
@@ -23,7 +23,7 @@ pub enum Event {
/// The cursor has moved on the window.
///
/// The parameter are the (x,y) coords in pixels relative to the top-left corner of the window.
- MouseMoved((isize, isize)),
+ MouseMoved((i32, i32)),
/// A positive value indicates that the wheel was rotated forward, away from the user;
/// a negative value indicates that the wheel was rotated backward, toward the user.
diff --git a/src/lib.rs b/src/lib.rs
index a970b36..a23523e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -157,10 +157,10 @@ struct BuilderAttribs<'a> {
headless: bool,
strict: bool,
sharing: Option<&'a winimpl::Window>,
- dimensions: Option<(usize, usize)>,
+ dimensions: Option<(u32, u32)>,
title: String,
monitor: Option<winimpl::MonitorID>,
- gl_version: Option<(usize, usize)>,
+ gl_version: Option<(u32, u32)>,
gl_debug: bool,
vsync: bool,
visible: bool,
@@ -207,7 +207,7 @@ impl<'a> WindowBuilder<'a> {
/// Requests the window to be of specific dimensions.
///
/// Width and height are in pixels.
- pub fn with_dimensions(mut self, width: usize, height: usize) -> WindowBuilder<'a> {
+ pub fn with_dimensions(mut self, width: u32, height: u32) -> WindowBuilder<'a> {
self.attribs.dimensions = Some((width, height));
self
}
@@ -239,7 +239,7 @@ impl<'a> WindowBuilder<'a> {
///
/// Version is a (major, minor) pair. For example to request OpenGL 3.3
/// you would pass `(3, 3)`.
- pub fn with_gl_version(mut self, version: (usize, usize)) -> WindowBuilder<'a> {
+ pub fn with_gl_version(mut self, version: (u32, u32)) -> WindowBuilder<'a> {
self.attribs.gl_version = Some(version);
self
}
@@ -340,7 +340,7 @@ pub struct HeadlessRendererBuilder {
#[cfg(feature = "headless")]
impl HeadlessRendererBuilder {
/// Initializes a new `HeadlessRendererBuilder` with default values.
- pub fn new(width: usize, height: usize) -> HeadlessRendererBuilder {
+ pub fn new(width: u32, height: u32) -> HeadlessRendererBuilder {
HeadlessRendererBuilder {
attribs: BuilderAttribs {
headless: true,
@@ -354,7 +354,7 @@ impl HeadlessRendererBuilder {
///
/// Version is a (major, minor) pair. For example to request OpenGL 3.3
/// you would pass `(3, 3)`.
- pub fn with_gl_version(mut self, version: (usize, usize)) -> HeadlessRendererBuilder {
+ pub fn with_gl_version(mut self, version: (u32, u32)) -> HeadlessRendererBuilder {
self.attribs.gl_version = Some(version);
self
}
@@ -490,7 +490,7 @@ impl Window {
///
/// Returns `None` if the window no longer exists.
#[inline]
- pub fn get_position(&self) -> Option<(isize, isize)> {
+ pub fn get_position(&self) -> Option<(i32, i32)> {
self.window.get_position()
}
@@ -500,7 +500,7 @@ impl Window {
///
/// This is a no-op if the window has already been closed.
#[inline]
- pub fn set_position(&self, x: isize, y: isize) {
+ pub fn set_position(&self, x: i32, y: i32) {
self.window.set_position(x, y)
}
@@ -512,7 +512,7 @@ impl Window {
///
/// Returns `None` if the window no longer exists.
#[inline]
- pub fn get_inner_size(&self) -> Option<(usize, usize)> {
+ pub fn get_inner_size(&self) -> Option<(u32, u32)> {
self.window.get_inner_size()
}
@@ -523,7 +523,7 @@ impl Window {
///
/// Returns `None` if the window no longer exists.
#[inline]
- pub fn get_outer_size(&self) -> Option<(usize, usize)> {
+ pub fn get_outer_size(&self) -> Option<(u32, u32)> {
self.window.get_outer_size()
}
@@ -533,7 +533,7 @@ impl Window {
///
/// This is a no-op if the window has already been closed.
#[inline]
- pub fn set_inner_size(&self, x: usize, y: usize) {
+ pub fn set_inner_size(&self, x: u32, y: u32) {
self.window.set_inner_size(x, y)
}
@@ -612,7 +612,7 @@ impl Window {
/// operating systems) during resize operations. This can be used to repaint
/// during window resizing.
#[experimental]
- pub fn set_window_resize_callback(&mut self, callback: Option<fn(usize, usize)>) {
+ pub fn set_window_resize_callback(&mut self, callback: Option<fn(u32, u32)>) {
self.window.set_window_resize_callback(callback);
}
@@ -683,7 +683,7 @@ impl HeadlessContext {
}
#[experimental]
- pub fn set_window_resize_callback(&mut self, _: Option<fn(usize, usize)>) {
+ pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
}
@@ -760,7 +760,7 @@ impl MonitorID {
}
/// Returns the number of pixels currently displayed on the monitor.
- pub fn get_dimensions(&self) -> (usize, usize) {
+ pub fn get_dimensions(&self) -> (u32, u32) {
let &MonitorID(ref id) = self;
id.get_dimensions()
}
diff --git a/src/win32/init.rs b/src/win32/init.rs
index b88cfb2..7317c42 100644
--- a/src/win32/init.rs
+++ b/src/win32/init.rs
@@ -24,9 +24,9 @@ thread_local!(static WINDOW: Rc<RefCell<Option<(winapi::HWND, Sender<Event>)>>>
pub struct ContextHack(pub winapi::HGLRC);
unsafe impl Send for ContextHack {}
-pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: String,
+pub fn new_window(builder_dimensions: Option<(u32, u32)>, builder_title: String,
builder_monitor: Option<super::MonitorID>,
- builder_gl_version: Option<(uint, uint)>, builder_debug: bool,
+ builder_gl_version: Option<(u32, u32)>, builder_debug: bool,
builder_vsync: bool, builder_hidden: bool,
builder_sharelists: Option<ContextHack>, builder_multisampling: Option<u16>)
-> Result<Window, CreationError>
@@ -140,7 +140,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
if handle.is_null() {
use std::os;
tx.send(Err(OsError(format!("CreateWindowEx function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
return;
}
@@ -152,7 +152,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
let hdc = unsafe { winapi::GetDC(dummy_window) };
if hdc.is_null() {
tx.send(Err(OsError(format!("GetDC function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
unsafe { winapi::DestroyWindow(dummy_window); }
return;
}
@@ -180,7 +180,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
if pf_index == 0 {
tx.send(Err(OsError(format!("ChoosePixelFormat function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
unsafe { winapi::DestroyWindow(dummy_window); }
return;
}
@@ -189,7 +189,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
mem::size_of::<winapi::PIXELFORMATDESCRIPTOR>() as winapi::UINT, &mut output) } == 0
{
tx.send(Err(OsError(format!("DescribePixelFormat function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
unsafe { winapi::DestroyWindow(dummy_window); }
return;
}
@@ -201,7 +201,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
unsafe {
if winapi::SetPixelFormat(dummy_hdc, 1, &pixel_format) == 0 {
tx.send(Err(OsError(format!("SetPixelFormat function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
winapi::DestroyWindow(dummy_window);
return;
}
@@ -212,7 +212,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
let ctxt = unsafe { gl::wgl::CreateContext(dummy_hdc as *const libc::c_void) };
if ctxt.is_null() {
tx.send(Err(OsError(format!("wglCreateContext function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
unsafe { winapi::DestroyWindow(dummy_window); }
return;
}
@@ -271,7 +271,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
if handle.is_null() {
use std::os;
tx.send(Err(OsError(format!("CreateWindowEx function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
return;
}
@@ -283,7 +283,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
let hdc = unsafe { winapi::GetDC(real_window) };
if hdc.is_null() {
tx.send(Err(OsError(format!("GetDC function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
unsafe { winapi::DestroyWindow(real_window); }
return;
}
@@ -294,7 +294,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
unsafe {
if winapi::SetPixelFormat(hdc, 1, &pixel_format) == 0 {
tx.send(Err(OsError(format!("SetPixelFormat function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
winapi::DestroyWindow(real_window);
return;
}
@@ -339,7 +339,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
if ctxt.is_null() {
tx.send(Err(OsError(format!("OpenGL context creation failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
unsafe { winapi::DestroyWindow(real_window); }
return;
}
@@ -369,7 +369,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
let lib = unsafe { winapi::LoadLibraryW(name) };
if lib.is_null() {
tx.send(Err(OsError(format!("LoadLibrary function failed: {}",
- os::error_string(os::errno() as uint)))));
+ os::error_string(os::errno() as usize)))));
unsafe { gl::wgl::DeleteContext(context); }
unsafe { winapi::DestroyWindow(real_window); }
return;
@@ -475,16 +475,16 @@ extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
winapi::WM_SIZE => {
use events::Event::Resized;
- let w = winapi::LOWORD(lparam as winapi::DWORD) as uint;
- let h = winapi::HIWORD(lparam as winapi::DWORD) as uint;
+ let w = winapi::LOWORD(lparam as winapi::DWORD) as u32;
+ let h = winapi::HIWORD(lparam as winapi::DWORD) as u32;
send_event(window, Resized(w, h));
0
},
winapi::WM_MOVE => {
use events::Event::Moved;
- let x = winapi::LOWORD(lparam as winapi::DWORD) as i16 as int;
- let y = winapi::HIWORD(lparam as winapi::DWORD) as i16 as int;
+ let x = winapi::LOWORD(lparam as winapi::DWORD) as i32;
+ let y = winapi::HIWORD(lparam as winapi::DWORD) as i32;
send_event(window, Moved(x, y));
0
},
@@ -500,8 +500,8 @@ extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
winapi::WM_MOUSEMOVE => {
use events::Event::MouseMoved;
- let x = winapi::GET_X_LPARAM(lparam) as int;
- let y = winapi::GET_Y_LPARAM(lparam) as int;
+ let x = winapi::GET_X_LPARAM(lparam) as i32;
+ let y = winapi::GET_Y_LPARAM(lparam) as i32;
send_event(window, MouseMoved((x, y)));
diff --git a/src/win32/mod.rs b/src/win32/mod.rs
index 463d5fe..e6964b4 100644
--- a/src/win32/mod.rs
+++ b/src/win32/mod.rs
@@ -44,7 +44,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)>) {
}
}
@@ -131,7 +131,7 @@ impl Window {
}
/// See the docs in the crate root file.
- pub fn get_position(&self) -> Option<(int, int)> {
+ pub fn get_position(&self) -> Option<(i32, i32)> {
use std::mem;
let mut placement: winapi::WINDOWPLACEMENT = unsafe { mem::zeroed() };
@@ -142,11 +142,11 @@ impl Window {
}
let ref rect = placement.rcNormalPosition;
- Some((rect.left as int, rect.top as int))
+ Some((rect.left as i32, rect.top as i32))
}
/// See the docs in the crate root file.
- pub fn set_position(&self, x: int, y: int) {
+ pub fn set_position(&self, x: i32, y: i32) {
use libc;
unsafe {
@@ -157,7 +157,7 @@ impl Window {
}
/// See the docs in the crate root file.
- pub fn get_inner_size(&self) -> Option<(uint, uint)> {
+ pub fn get_inner_size(&self) -> Option<(u32, u32)> {
use std::mem;
let mut rect: winapi::RECT = unsafe { mem::uninitialized() };
@@ -166,13 +166,13 @@ impl Window {
}
Some((
- (rect.right - rect.left) as uint,
- (rect.bottom - rect.top) as uint
+ (rect.right - rect.left) as u32,
+ (rect.bottom - rect.top) as u32
))
}
/// See the docs in the crate root file.
- pub fn get_outer_size(&self) -> Option<(uint, uint)> {
+ pub fn get_outer_size(&self) -> Option<(u32, u32)> {
use std::mem;
let mut rect: winapi::RECT = unsafe { mem::uninitialized() };
@@ -181,13 +181,13 @@ impl Window {
}
Some((
- (rect.right - rect.left) as uint,
- (rect.bottom - rect.top) as uint
+ (rect.right - rect.left) as u32,
+ (rect.bottom - rect.top) as u32
))
}
/// See the docs in the crate root file.
- pub fn set_inner_size(&self, x: uint, y: uint) {
+ pub fn set_inner_size(&self, x: u32, y: u32) {
use libc;
unsafe {
@@ -283,7 +283,7 @@ impl Window {
::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)>) {
}
pub fn set_cursor(&self, cursor: MouseCursor) {
diff --git a/src/win32/monitor.rs b/src/win32/monitor.rs
index 4bc9cad..2078a52 100644
--- a/src/win32/monitor.rs
+++ b/src/win32/monitor.rs
@@ -17,10 +17,10 @@ pub struct MonitorID {
/// The position of the monitor in pixels on the desktop.
///
/// A window that is positionned at these coordinates will overlap the monitor.
- position: (uint, uint),
+ position: (u32, u32),
/// The current resolution in pixels on the monitor.
- dimensions: (uint, uint),
+ dimensions: (u32, u32),
}
/// Win32 implementation of the main `get_available_monitors` function.
@@ -32,7 +32,7 @@ pub fn get_available_monitors() -> RingBuf<MonitorID> {
// enumerating the devices is done by querying device 0, then device 1, then device 2, etc.
// until the query function returns null
- for id in iter::count(0u, 1) {
+ for id in iter::count(0u32, 1) {
// getting the DISPLAY_DEVICEW object of the current device
let output = {
let mut output: winapi::DISPLAY_DEVICEW = unsafe { mem::zeroed() };
@@ -72,9 +72,9 @@ pub fn get_available_monitors() -> RingBuf<MonitorID> {
}
let point: &winapi::POINTL = mem::transmute(&dev.union1);
- let position = (point.x as uint, point.y as uint);
+ let position = (point.x as u32, point.y as u32);
- let dimensions = (dev.dmPelsWidth as uint, dev.dmPelsHeight as uint);
+ let dimensions = (dev.dmPelsWidth as u32, dev.dmPelsHeight as u32);
(position, dimensions)
};
@@ -113,7 +113,7 @@ impl MonitorID {
}
/// See the docs if the crate root file.
- pub fn get_dimensions(&self) -> (uint, uint) {
+ pub fn get_dimensions(&self) -> (u32, u32) {
// TODO: retreive the dimensions every time this is called
self.dimensions
}
@@ -127,7 +127,7 @@ impl MonitorID {
/// This is a Win32-only function for `MonitorID` that returns the position of the
/// monitor on the desktop.
/// A window that is positionned at these coordinates will overlap the monitor.
- pub fn get_position(&self) -> (uint, uint) {
+ pub fn get_position(&self) -> (u32, u32) {
self.position
}
}
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