I want to retriev开发者_如何学Pythone the position of mouse pointer in webkit's webview widget. So I tried to connect it like this.
gtk_signal_connect (GTK_OBJECT (gtk_widget_get_toplevel(web_view)), "motion-notify-event",
(GtkSignalFunc) motion_notify_event, NULL);
But the callback functions gets never called when mouse moves or any other time. The same experiment works with gtkentry. Any idea on what might be going wrong?
I'm not sure, but you can try adding GDK_POINTER_MOTION_MASK
to the webview's accepted events using gtk_widget_add_events()
.
PS. Don't use gtk_signal_connect
; it's old and will be removed in GTK 3. You should connect your signal like this:
g_signal_connect(gtk_widget_get_toplevel(web_view), "motion-notify-event", G_CALLBACK(motion_notify_event), NULL);
精彩评论