[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: how to emit a GDK_MOTION_NOTIFY event?
From:       Clemens Kirchgatterer <clemens () root ! at>
Date:       1999-07-13 9:26:09
[Download RAW message or body]

XinKai Wang wrote:
> 
> Clemens Kirchgatterer wrote:
> >
> > hi!
> >
> > i've got the following problem.
> >
> > i have connected a signal handler to an gnome_canvas_item like this:
> >
> >   gtk_signal_connect(GTK_OBJECT(item),
> >                      "event",
> >                      (GtkSignalFunc)item_event,
> >                      NULL);
> >
> > the function prototype of item_event is the following:
> >
> >   gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer
> > data);
> >
> > now i want my programm to emit the GDK_MOTION_NOTIFY event, so the code
> > in my
> > event handler gets called.
> >
> > i have tryed:
> >    gtk_signal_emit   (GTK_OBJECT(current_object),
> >                       GDK_MOTION_NOTIFY);
> > but all i got was:
> >   Gtk-CRITICAL **: file gtksignal.c: line 541 (gtk_signal_emit):
> > assertion `gtk_type_is_a
> >   (GTK_OBJECT_TYPE (object), signal->object_type)' failed.
> >
> > any suggestions?
> >
> > i hope it isn't a to dumb mistake. ;-)
> >
> 
> I have not used the GDK_MOTION_NOTIFY before, but are you sure it is
> a legal GTK signal? Which object it belongs to? And have you try
> gtk_signal_emit_by_name()? why do you use gtk_signal_emit()?


of course i'm not shure that all about. signals and events are still
frightning me a
little bit. ;-) 
but i think you are right, GDK_MOTION_NOTIFY isn't an event it is only
an event->type.
so i went back to the gtk-tutorial an tryed the following:

    if (current_object != NULL) {
      gtk_signal_emit_by_name       
(GTK_OBJECT(GNOME_CANVAS_POLYGON(current_object)),
                                      "motion-notify-event",
                                       NULL);
    }

but now the runtime error turned to:

Gtk-WARNING **: gtk_signal_emit_by_name(): could not find signal
"motion-notify-event"
in the `GnomeCanvasPolygon' class ancestry

do i have to generate an GdkEventMotion Object by hand
(filling it with all the members i need)
and call my eventhandler directly? (don't hope so!!!)

> struct _GdkEventMotion
>      {
>        GdkEventType type;
>        GdkWindow *window;
>        gint8 send_event;
>        guint32 time;
>        gdouble x;
>        gdouble y;
>        gdouble pressure;
>        gdouble xtilt;
>        gdouble ytilt;
>        guint state;
>        gint16 is_hint;
>        GdkInputSource source;
>        guint32 deviceid;
>        gdouble x_root, y_root;
>      };

warm regards ...
clemens


-- 
         To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
                       "unsubscribe" as the Subject.

	Mailing list concerns should be mailed to <listmaster@redhat.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic