Re: Where'd my gtk+-1.2 mouse events go ?



Nix wrote:

Hi ! I have a drawing area inside a viewport inside a scrollwindow.  I
have set the followings on the drawing area:

 gtk_widget_set_events (GTK_WIDGET (drawing_area), GDK_EXPOSURE_MASK
                       | GDK_LEAVE_NOTIFY_MASK
                       | GDK_BUTTON_PRESS_MASK
                       | GDK_BUTTON_RELEASE_MASK
                       | GDK_KEY_PRESS_MASK
                       | GDK_POINTER_MOTION_MASK
                       | GDK_POINTER_MOTION_HINT_MASK);

This should give me unfettered access to all mouse and mouse motion
events.  That is, if I were to add a printf to the motion_notify
handler, when I move the mouse, it should dowse the terminal in printf
messages, right ?  Well, not in my case, for some reason.

I have printfs for button_press_event, motion_notify_event, and
button_release_event.  When the mouse enters the drawing area, it
generates exactly 1 (!) motion event.  If I depress the mouse button, it
generates 1 button_press_event (unsurprisingly).  If I then drag the
mouse, it once again generates exactly 1 motion event. Why only 1 ? This seems to work well enough on other windows.

Does the scrollwindow, or the viewport my drawing area is embedded in
absorb the motion and mouse button events ?

Because of GDK_POINTER_MOTION_HINT_MASK. This is the special case, you should ask for events with gdk_window_get_pointer() with this mask set...

Olexiy





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