Re: bug in gtk_signal_emit_by_name
- From: Owen Taylor <otaylor redhat com>
- To: briot gnat com
- Cc: gtk-devel-list redhat com
- Subject: Re: bug in gtk_signal_emit_by_name
- Date: 20 Jul 1999 08:07:25 -0400
briot@gnat.com writes:
> Hi,
>
> One of the users of GtkAda as reported a bug in gtk_signal_emit_by_name.
> Here is a small test case that reproduces the problem.
> Note that apparently the bug is specific to "expose_event", since it does not
> appear with other events like "leave".
> Let me know if I should report this bug to another mailing list.
I'm sure that the maintainers of GtkAda are aware that
all GTK+ signals handlers do not have the same signature. ;-)
The prototype for expose_event (and any other event)
is:
gint
expose_event_handler (GtkWidget *widget, GdkEventExpose *event, gpointer data);
So, you need to correspondingly call:
gint return_val;
gtk_signal_emit_by_name (GTK_OBJECT (widget), "expose_event",
event, &return_val);
Of course, one almost certainly should be using
gtk_widget_event() instead. Or probably calling
gtk_widget_draw() or gtk_widget_queue_draw()...
Regards,
Owen
> Emmanuel
>
> /* Compile with :
> gcc `gtk-config --cflags` project2.c `gtk-config --libs`
>
> This program core dumps when the button is pressed...
> This seems to be because of "expose_event". It works with for instance
> "leave".
> */
>
> #include <gtk/gtk.h>
> #include <stdio.h>
>
> void
> on_clicked (GtkObject* obj, GtkDrawingArea draw)
> {
> printf ("on_clicked\n");
> gtk_signal_emit_by_name ((GtkObject*)obj, "expose_event");
> printf ("leave\n");
> }
>
> int
> main (int argc, char *argv[])
> {
> GtkWindow* win;
> GtkButton* button1;
>
> gtk_set_locale();
> gtk_init (&argc, &argv);
>
> win = (GtkWindow*) gtk_window_new (GTK_WINDOW_TOPLEVEL);
> button1 = (GtkButton*) gtk_button_new_with_label ("button1");
> gtk_container_add ((GtkContainer*)win, (GtkWidget*) button1);
>
> (void) gtk_signal_connect ((GtkObject*)button1,
> "clicked",
> (GtkSignalFunc)&on_clicked,
> (gpointer)button1);
>
> gtk_widget_show_all ((GtkWidget*)win);
> gtk_main ();
> return 1;
> }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]