Closed hugopl closed 4 years ago
So adding overloads for after is the easy part.
Your example doesn't work because something seems to clobber the return value :( If you add false
into either proc inside the on_
wrapper method, it starts working. If you then do so much and assign the original value of the call to a local it breaks again. Can the calling conventions be so different for C functions and Crystal procs? :/
Ooh, found it. Crystal generates Bool
as i1
but gboolean
is i32
...
yeah, I got those crashes too.
In C we can connect signals using the macro
g_signal_connect_after
, that just connect the signal using the AFTER flag.This is useful to e.g. connect
focus-out-event
signal, so your code is ran after the default signal handlers and some GTK widgets get happy with this.My suggestion if to use a
after_
prefix to connect these signals, e.g. for GtkWidget focus-out-event we would haveon_focus_out_event
andafter_focus_out_event
.I tried to mimic this with current signals implementation but got no luck on my first tries:
This was trying to mimic this C code: