aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml4
-rw-r--r--README.md4
-rw-r--r--src/api/cocoa/mod.rs18
3 files changed, 12 insertions, 14 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 00c1a3e..50f067f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -55,3 +55,7 @@ x11 = "*"
[target.x86_64-unknown-linux-gnu.dependencies]
osmesa-sys = "0.0.5"
x11 = "*"
+
+[target.arm-unknown-linux-gnueabihf.dependencies]
+osmesa-sys = "0.0.5"
+x11 = "*"
diff --git a/README.md b/README.md
index 4d2e5d4..935e110 100644
--- a/README.md
+++ b/README.md
@@ -67,10 +67,6 @@ Note that glutin aims at being a low-level brick in your rendering infrastructur
- To compile the examples for android, initialize the submodules, go to `deps/apk-builder/apk-builder` and run `cargo build`, then go back to `glutin` and call `ANDROID_HOME=/path/to/sdk NDK_HOME=/path/to/ndk NDK_STANDALONE=/path/to/standalone cargo test --no-run --target=arm-linux-androideabi`
-### Win32
-
- - You must call `glFlush` before `swap_buffers`, or else on Windows 8 nothing will be visible on the window
-
### X11
- The plan is that glutin tries to dynamically link-to and use wayland if possible. If it doesn't work, it will try xlib instead. If it doesn't work, it will try libcaca. This is work-in-progress.
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 620230f..a3c58f9 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -28,7 +28,7 @@ use core_foundation::base::TCFType;
use core_foundation::string::CFString;
use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName};
-use core_graphics::display::{CGMainDisplayID, CGDisplayPixelsHigh};
+use core_graphics::display::{CGAssociateMouseAndMouseCursorPosition, CGMainDisplayID, CGDisplayPixelsHigh};
use std::ffi::CStr;
use std::collections::VecDeque;
@@ -523,16 +523,10 @@ impl Window {
if let Some(cxt) = context.non_nil() {
let pf = {
- let getValues_forAttribute_forVirtualScreen_ = |fmt: id,
- vals: *mut GLint,
- attrib: NSOpenGLPixelFormatAttribute,
- screen: GLint| -> () {
- msg_send![fmt, getValues:vals forAttribute:attrib forVirtualScreen:screen]
- };
let get_attr = |attrib: NSOpenGLPixelFormatAttribute| -> i32 {
let mut value = 0;
- // TODO: Wait for servo/rust-cocoa/#85 to get merged
- /*NSOpenGLPixelFormat::*/getValues_forAttribute_forVirtualScreen_(
+
+ NSOpenGLPixelFormat::getValues_forAttribute_forVirtualScreen_(
*pixelformat,
&mut value,
attrib,
@@ -721,9 +715,12 @@ impl Window {
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
let cls = Class::get("NSCursor").unwrap();
+
+ // TODO: Check for errors.
match state {
CursorState::Normal => {
let _: () = unsafe { msg_send![cls, unhide] };
+ let _: i32 = unsafe { CGAssociateMouseAndMouseCursorPosition(true) };
Ok(())
},
CursorState::Hide => {
@@ -731,7 +728,8 @@ impl Window {
Ok(())
},
CursorState::Grab => {
- Err("Mouse grabbing is unimplemented".to_string())
+ let _: i32 = unsafe { CGAssociateMouseAndMouseCursorPosition(false) };
+ Ok(())
}
}
}