Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

Item not highlighted on start #56

Closed Tomas-M closed 6 years ago

Tomas-M commented 6 years ago

If I start xlunch, and mouse cursor happens to be over an item, it does not higlight the item unless I move my mouse slightly. I know there is an event handling for mouse move, but can we know mouse cursor coordinates even without moving the mouse, so xlunch selects the right item under cursor upon start, without the need to move mouse?

PMunch commented 6 years ago

Something like this will probably work.

Tomas-M commented 6 years ago

Hm, is there no simpler way? I was thinking to get x/y mouse coordinates on some other event, like expose, or window init, or focus or something (I really do not know). so we can get it directly in the message. Does xmotion.x and xmotion.y exist in any other scope than button press/release or motionnotify?

PMunch commented 6 years ago

No, only mouse events offer the mouse position fields. So without a mouse event we need to poll for it instead with something like what I linked. This is pretty useful though.

Tomas-M commented 6 years ago

I've resolved this by fd073ec5743969d77d30c657ca302acf4b12bc94 Basically what was needed is to listen for EnterNotify event, which also contains x/y coordinates, and is received by the window as soon as mouse enters it. This event is fired when the window is mapped too, so it perfectly does just what we want.

PMunch commented 6 years ago

Oh, that event also fires when the window is mapped? Cool!

Tomas-M commented 6 years ago

To be really honest I'm not entirely sure if the mapping is the correct particular action which causes the event to fire, that was just my guess, to make it clear :) but it is fired when xlunch starts, so something fires it and the resulting behavior is exactly what I need :-)