Re: problem with button_press_events




Adrian Feiguin <adrian@ifir.ifir.edu.ar> writes:

> I'm developing gtksheet and Steven Rostedt found a little but ougly bug.
> When you click your mouse rapidly you get multiple calls to
> button_press_event but none to button_release_event. I think that the
> widget is recieving a double click event, but I'd like to avoid this
> because it causes serious problems.
> The event_mask is defined as follows:
> 
>   attributes.event_mask |= (GDK_EXPOSURE_MASK |
>                             GDK_BUTTON_PRESS_MASK |
>                             GDK_BUTTON_RELEASE_MASK |
>                             GDK_KEY_PRESS_MASK |
>                             GDK_POINTER_MOTION_MASK |
>                             GDK_POINTER_MOTION_HINT_MASK); 

Check, and I think you'll find you get exactly one event
with:
 
  event->type == GDK_BUTTON_PRESS

for each event event with event->type == GDK_BUTTON_RELEASE.
You are just getting more events with type 
GDK_2BUTTON_PRESS, and GDK_3BUTTON_PRESS.

(For a double click, gdk sends:

 GDK_BUTTON_PRESS
 GDK_BUTTON_RELEASE
 GDK_BUTTON_PRESS
 GDK_2BUTTON_PRESS
 GDK_BUTTON_RELEASE)

Regards,
                                        Owen



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