Murga-Projects Forums
Detecting mouse position and raising a window - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Detecting mouse position and raising a window (/showthread.php?tid=329)


Detecting mouse position and raising a window - dvw86 - 07-16-2008 12:53 PM

According to the docs, show() should raise a window even if it is already shown. However it does not behave this way for me. I would like the window to become the front (top-most) window when a mouse hovers over it.

Another problem I am having is detecting the mouse pointer position when it is not over a FLTK window. Fl:event_y_root() and Fl:event_x_root() work, but only when the pointer over the FLTK window. I would like a program to run in the background and monitor the mouse pointer location. This way I could have a menu popup after a one second delay if I held the cursor at the bottom of the screen or have a different menu popup if I held the cursor at the top left corner of the screen.


RE: Detecting mouse position and raising a window - JohnMurga - 07-17-2008 02:58 AM

I will have to look into this ... I am really not sure FLTK handles it.


RE: Detecting mouse position and raising a window - znarf - 07-17-2008 05:22 AM

I did some search on this 6 years ago while writing a portable general input system, and I'm pretty sure fltk won't offer access to it. Grabbing the mouse pointer position all over the screen is pretty easy in X (just look at the source code of xeyes...), however, it's hard under Windows (search the web for "hook mouse windows"). There are good reasons for an API to not support it, because it opens a door for certain phishing attacks by secretely recording mouse and keyboard input.