button number incorrect
- From: Brian Clark <bc viz tamu edu>
- To: gtk-app-devel-list gnome org
- Subject: button number incorrect
- Date: Sun, 5 Sep 2004 15:43:25 -0500
I'm in GTK 2, trying to get a mouse motion event to fire properly.
Specifically, I want the mouse motion event to fire only when the left
mouse button is pressed and the mouse is moved. The object I want
this to work over is an image, and I have put the image inside an event
box. But the button number is always 0, no matter what I do.
I have the following attached to the event box:
gtk_widget_add_events(posteventbox, GDK_BUTTON_RELEASE_MASK);
gtk_widget_add_events(posteventbox, GDK_BUTTON_PRESS_MASK);
gtk_widget_add_events(posteventbox, GDK_BUTTON1_MOTION_MASK);
//gtk_widget_add_events(posteventbox, GDK_BUTTON_MOTION_MASK);
I've tried it with the GDK_BUTTON_MOTION_MASK both commented out and
inserted.
The signal connect function is:
g_signal_connect ((gpointer) posteventbox, "motion_notify_event",
G_CALLBACK (on_histogram_button1_motion),
&original);
And the callback:
void on_histogram_button1_motion(GtkWidget *img, GdkEventButton *event,
gpointer user_data)
{
Image *theImage;
theImage = (Image*)user_data;
cout<< "Motion with button in histogram" << endl;
cout << "now at " << event->x << ", " << event->y << endl;
cout << "on button " << event->button << endl;
}
It works, in terms of tracking motion. When the mouse moves, it spews
the text, but the button is always 0, no matter what I do.
Any suggestions?
Thanks,
bc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]