-
-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lock objc to 0.1.7. Fix remaining libc pointer errors with casts. Fix warnings in cursor example. #655
Conversation
Build was successful on nightly osx, stable linux and two of the windows builds. Each of the others seem to have either timed out due to cargo hanging on an update or crashed in some unrelated process 🎉 |
Ahhhh, despite this change working for glutin, users will likely still run into problems downstream as the cocoa crate also depends on objc, in turn creating an objc version conflict. For example, when I try to build conrod (with the local working glutin version) I get:
Which doesn't seem to get fixed no matter how many times I 😕 |
@mitchmindtree, sorry again that the objc update has contributed to this mess :/ It's not the most elegant, but one way to sidestep this issue would be to replace all uses of diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 2b4b5e5..1e5000b 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -81,7 +81,7 @@ impl WindowDelegate {
extern fn window_should_close(this: &Object, _: Sel, _: id) -> BOOL {
unsafe {
- let state: *mut libc::c_void = *this.get_ivar("glutinState");
+ let state: usize = *this.get_ivar("glutinState");
let state = state as *mut DelegateState;
(*state).pending_events.lock().unwrap().push_back(Closed);
}
@@ -90,7 +90,7 @@ impl WindowDelegate {
extern fn window_did_resize(this: &Object, _: Sel, _: id) {
unsafe {
- let state: *mut libc::c_void = *this.get_ivar("glutinState");
+ let state: usize = *this.get_ivar("glutinState");
let state = &mut *(state as *mut DelegateState);
let _: () = msg_send![*state.context, update];
@@ -109,7 +109,7 @@ impl WindowDelegate {
// TODO: center the cursor if the window had mouse grab when it
// lost focus
- let state: *mut libc::c_void = *this.get_ivar("glutinState");
+ let state: usize = *this.get_ivar("glutinState");
let state = state as *mut DelegateState;
(*state).pending_events.lock().unwrap().push_back(Focused(true));
}
@@ -117,7 +117,7 @@ impl WindowDelegate {
extern fn window_did_resign_key(this: &Object, _: Sel, _: id) {
unsafe {
- let state: *mut libc::c_void = *this.get_ivar("glutinState");
+ let state: usize = *this.get_ivar("glutinState");
let state = state as *mut DelegateState;
(*state).pending_events.lock().unwrap().push_back(Focused(false));
}
@@ -143,7 +143,7 @@ impl WindowDelegate {
window_did_resign_key as extern fn(&Object, Sel, id));
// Store internal state as user data
- decl.add_ivar::<*mut libc::c_void>("glutinState");
+ decl.add_ivar::<usize>("glutinState");
delegate_class = decl.register();
});
@@ -160,7 +160,7 @@ impl WindowDelegate {
unsafe {
let delegate = IdRef::new(msg_send![WindowDelegate::class(), new]);
- (&mut **delegate).set_ivar("glutinState", state_ptr as *mut libc::c_void);
+ (&mut **delegate).set_ivar("glutinState", state_ptr as usize);
let _: () = msg_send![*state.window, setDelegate:*delegate];
WindowDelegate { state: state, _this: delegate } That way a mismatch between the libc versions in glutin and objc doesn't cause any errors. |
Or just use Rust allows writing EDIT: I just realized that glutin could be fixed right now by using |
I'm not sure
|
@SSheldon all good! It can be easy to overlook breakages sometimes especially when it's just in a version increment heh. I tried building this again locally, however a wild #656 appeared. I don't have a windows system available to me atm so I'm unable to address this. I did however try just updating |
Ok, let's merge this. |
Lock objc to 0.1.7. Fix remaining libc pointer errors with casts. Fix warnings in cursor example.
This fixes #654