#5 button-press-event weirdness

open
nobody
None
5
2007-05-02
2007-05-02
Anonymous
No

Hello,

button-press-event causes leave-notify-event and enter-notify-event to be called in rapid succession.

This means, when changing fill-color on enter-notify-event and changing it back to it's original color on leave-notify-event (to simulate a "selected" item), you get a "flashing" background whenever you click that item in question.

An example of this can be seen in the arrowhead demo with the resize boxes. It gets lot's worse with larger items.

Note button-release-event does not have this problem.

Discussion

  • Damon Chaplin
    Damon Chaplin
    2007-05-02

    Logged In: YES
    user_id=186672
    Originator: NO

    Yes, I can reproduce it.

    It looks like a problem related to the code that finds the current item.
    Probably not too hard to fix.

     
  • Damon Chaplin
    Damon Chaplin
    2007-05-02

    Logged In: YES
    user_id=186672
    Originator: NO

    It seems to happen to widgets too - go to the "Grabs" page of the demo and click on a widget.

    I think it is due to implicit pointer grabs. They are supposed to generate enter-notify and
    leave-notify events between the current window and the grabbing window. But I didn't think
    they were supposed to do that if the windows were the same.

    So it could be an X bug.

    I can't think of a way to work around it. It happens before the item gets the button press
    so it can't know it is about to get a grab and just ignore the spurious events.