signal-handlers return value gets lost!?
- From: Peter Lerner <peter lerner bnbt de>
- To: gtk-list redhat com
- Subject: signal-handlers return value gets lost!?
- Date: Tue, 10 Aug 1999 18:37:45 +0200
hi,
i've set up signal for my widget and provided
marshaller like that and there is no default
signal-handler for "my_signal" in the class struct.
my_signals[MYSIGNAL] =
gtk_signal_new ("my_signal",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidget, my_signal),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
static void
gtk_marshal_BOOL__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
GtkSignal_BOOL__POINTER rfunc;
gboolean *ret_val;
ret_val = GTK_RETLOC_BOOL (args[1]);
rfunc = (GtkSignal_BOOL__POINTER) func;
*ret_val = (*rfunc) (object,
GTK_VALUE_POINTER (args[0]),
func_data);
}
now in user code all i do is to connect this signal and
return FALSE from my callback.
gtk_signal_connect (GTK_OBJECT(my_widget), "my_signal", (GtkSignalFunc)
my_signal_callback, NULL);
static gboolean
my_signal_callback(GtkMyWidget *my_widget,
GdkEvent *event,
gpointer user_data)
{
....
if(test)
return TRUE
else
return FALSE;
}
then i have a problem ...
in the widgets implementation i emit "my_signal", and want to
evaluate the gboolean return value. but the return value is
always set to TRUE (=1) regardless of what the users callback
returns.
gtk_signal_emit(GTK_OBJECT(my_widget), my_signals[MYSIGNAL],
event, &ret_val);
printf("ret_val = %d\n", ret_val);
this always prints:
---
ret_val = 1
---
do i have trouble with the GTK_RUN_LAST type of running the
(non existent) default handler? i could not find out, even
reading back and forth havoc's great sample chapters.
i really would appreciate it if someone could give me hint.
mfg
peter lerner
--
There is no spoon!
- Neo, The Matrix
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]