Motion event over pixmap.



Hello,

I am using the following function to load a bitmap file and display it inside a pixmap widget:

GtkWidget *image1;
image1 = gdk_pixbuf_new_from_file(file_name, &error);

The bitmap loads and displays fine but I would like to be ablle to track the position of the mouse pointer 
over the pixmap to do some data analisys.

    g_signal_connect ((gpointer) image1, "motion_notify_event",
                                  G_CALLBACK (on_image1_motion_notify_event),
                                  NULL);
    gtk_widget_set_events (image1, GDK_POINTER_MOTION_MASK);

The callback looks like such:

    gboolean
    on_image1_motion_notify_event          (GtkWidget       *widget,
                                                                   GdkEventMotion  *event,
                                                                   gpointer         user_data)
    {
       printf("in motion\n");
    
      return FALSE;
    }

Is it even posible to add motion events to pixmaps?

Thanks,
-Marco




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]