Skip to content
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

Allow nullable trampolines with scope="call" #747

Merged
merged 1 commit into from
Apr 15, 2019

Conversation

EPashkin
Copy link
Member

Part of gtk-rs/gdk#287

changes only in gdk:

--- a/src/auto/seat.rs
+++ b/src/auto/seat.rs
@@ -91,7 +91,7 @@ impl Seat {
                 panic!("cannot get closure...")
             };
         }
-        let prepare_func = Some(prepare_func_func::<P> as _);
+        let prepare_func = if prepare_func_data.is_some() { Some(prepare_func_func::<P> as _) } else { None };
         let super_callback0: &Option<&mut dyn (FnMut(&Seat, &Window))> = &prepare_func_data;
         unsafe {
             from_glib(gdk_sys::gdk_seat_grab(self.to_glib_none().0, window.as_ref().to_glib_none().0, capabilities.to_glib(), owner_events.to_glib(), cursor.to_glib_none().0, event.to_glib_none().0, prepare_func, super_callback0 as *const _ as usize as *mut _))
--- a/src/auto/window.rs
+++ b/src/auto/window.rs
@@ -908,7 +908,7 @@ impl<O: IsA<Window>> WindowExt for O {
             };
             res.to_glib()
         }
-        let child_func = Some(child_func_func as _);
+        let child_func = if child_func_data.is_some() { Some(child_func_func as _) } else { None };
         let super_callback0: &Option<&mut dyn (FnMut(&Window) -> bool)> = &child_func_data;
         unsafe {
             gdk_sys::gdk_window_invalidate_maybe_recurse(self.as_ref().to_glib_none().0, region.to_glib_none().0, child_func, super_callback0 as *const _ as usize as *mut _);

@jangernert can you test this change just in case?

cc @GuillaumeGomez

@jangernert
Copy link

@EPashkin how would I test this?

@EPashkin
Copy link
Member Author

Clone gdk repo crate branch,
add changes to Seat::grab,
add Replace or Path to your local gdk copy to Cargo.toml in your project.

@GuillaumeGomez
Copy link
Member

Thanks! 👍

@sdroege
Copy link
Member

sdroege commented Apr 15, 2019

👍

Good that we didn't do a release yet, the callback fixes from before were apparently incomplete :)

@jangernert
Copy link

jangernert commented Apr 15, 2019

@EPashkin the patches only apply to master which then causes some dependency resolve problems when overwriting gdk with the patched master version.

edit:
adapted the first patch slightly for the crate branch. "Works for me"^TM

@EPashkin
Copy link
Member Author

@jangernert Thanks for checking

@EPashkin EPashkin merged commit 58cffd4 into gtk-rs:master Apr 15, 2019
@EPashkin EPashkin deleted the nullable_scope_call branch April 15, 2019 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants