Main index > Python programming > strange mouse behavior

By dessaya (Desklet Author), on Fri Jul 8 12:54:07 2005: strange mouse behavior.

Here's another of my annoying questions: :oops:
The first time I click on my desklet, I get a leave_notify() before the button_press(). Subsequent clicks are fine. Is this a normal behavior?

By syfou (Core Developer & Desklet Author), on Fri Jul 8 13:40:53 2005.

No problem, Diego. As mentionned in the python documentation of the adesklets module (Appendix B at the time of writting -- see adesklets.events_handler) , all events that you want to catch are always processed in the order they arrived, exception made for Quit events. No event is ever lost.

If you get this leave_notify event, it is because the desklet get a new focus attribution just before your first click -- this is due to the way X11 handle things: a newly created window has no defined focus state: it is the role of the Window Manager to attribute one. The problem is that override_redirect windows are unmanaged, thus are not handled by the WM. So, whenever you click a first time, the focus goes through a hard reset (which is in fact a fallback procedure from the core server), hence the leave notify.

Depending of what you want to achieve, there is always a proper way to handle this. If what you want is only to ignore this first leave_notify, you can simply use a boolean attribute that goes from False to True on your first click...


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.