combined mouse and button event in a drawing area


I have 2 problems with grabbing events in a widget : 

I set this first : 

gtk_widget_set_events (mainWindow, GDK_KEY_PRESS_MASK |

then I set those "signal-connect" functions : 

g_signal_connect (mainWindow, "key-press-event", G_CALLBACK (on_key_press),
g_signal_connect (mainWindow, "motion-notify-event", G_CALLBACK
(on_button_press), NULL);

2 problems :

1) my widget is a drawing area; the 2 signals are emited when I use the
mainWindow widget (that contains the drawingarea) but not the drawing area
widget in itself; I don't see where is the problem;

2) I use the GDK_BUTTON_MOTION_MASK option because I want the mouse motion
to be considered only when the mouse button is pressed; in my case, EVERY
mouse motion is reported... Note that when this drawing area widget was in a
independent window (and not the main window), this mouse motion issue didn't

Please any idea on how to solve this?

View this message in context:
Sent from the Gtk+ - General mailing list archive at

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