Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Move trampolines #122

Merged
merged 2 commits into from
Jun 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/auto/pixbuf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
}

fn connect_area_prepared<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn area_prepared_trampoline<P, F: Fn(&P) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, f: glib_sys::gpointer)
where P: IsA<PixbufLoader>
{
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"area-prepared\0".as_ptr() as *const _,
Expand All @@ -143,6 +149,12 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
}

fn connect_area_updated<F: Fn(&Self, i32, i32, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn area_updated_trampoline<P, F: Fn(&P, i32, i32, i32, i32) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, x: libc::c_int, y: libc::c_int, width: libc::c_int, height: libc::c_int, f: glib_sys::gpointer)
where P: IsA<PixbufLoader>
{
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast(), x, y, width, height)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"area-updated\0".as_ptr() as *const _,
Expand All @@ -151,6 +163,12 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
}

fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn closed_trampoline<P, F: Fn(&P) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, f: glib_sys::gpointer)
where P: IsA<PixbufLoader>
{
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"closed\0".as_ptr() as *const _,
Expand All @@ -159,6 +177,12 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
}

fn connect_size_prepared<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn size_prepared_trampoline<P, F: Fn(&P, i32, i32) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, width: libc::c_int, height: libc::c_int, f: glib_sys::gpointer)
where P: IsA<PixbufLoader>
{
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast(), width, height)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"size-prepared\0".as_ptr() as *const _,
Expand All @@ -167,30 +191,6 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
}
}

unsafe extern "C" fn area_prepared_trampoline<P, F: Fn(&P) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, f: glib_sys::gpointer)
where P: IsA<PixbufLoader> {
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast())
}

unsafe extern "C" fn area_updated_trampoline<P, F: Fn(&P, i32, i32, i32, i32) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, x: libc::c_int, y: libc::c_int, width: libc::c_int, height: libc::c_int, f: glib_sys::gpointer)
where P: IsA<PixbufLoader> {
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast(), x, y, width, height)
}

unsafe extern "C" fn closed_trampoline<P, F: Fn(&P) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, f: glib_sys::gpointer)
where P: IsA<PixbufLoader> {
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast())
}

unsafe extern "C" fn size_prepared_trampoline<P, F: Fn(&P, i32, i32) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufLoader, width: libc::c_int, height: libc::c_int, f: glib_sys::gpointer)
where P: IsA<PixbufLoader> {
let f: &F = &*(f as *const F);
f(&PixbufLoader::from_glib_borrow(this).unsafe_cast(), width, height)
}

impl fmt::Display for PixbufLoader {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "PixbufLoader")
Expand Down
9 changes: 4 additions & 5 deletions src/auto/pixbuf_simple_anim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ impl PixbufSimpleAnim {
}

pub fn connect_property_loop_notify<F: Fn(&PixbufSimpleAnim) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_loop_trampoline<F: Fn(&PixbufSimpleAnim) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufSimpleAnim, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::loop\0".as_ptr() as *const _,
Expand All @@ -56,11 +60,6 @@ impl PixbufSimpleAnim {
}
}

unsafe extern "C" fn notify_loop_trampoline<F: Fn(&PixbufSimpleAnim) + 'static>(this: *mut gdk_pixbuf_sys::GdkPixbufSimpleAnim, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}

impl fmt::Display for PixbufSimpleAnim {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "PixbufSimpleAnim")
Expand Down
2 changes: 1 addition & 1 deletion src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 44bbff0)
Generated by gir (https://github.com/gtk-rs/gir @ 1dbb0ee)
from gir-files (https://github.com/gtk-rs/gir-files @ 617a344)