Find the topmost window under a mouse cursor

Anthony Petrov anthony.petrov at oracle.com
Tue Mar 27 02:26:34 PDT 2012


Hi Alexander,

I suggest to track the MouseIsOver state with a boolean flag per window, 
and send a synthetic Entered event upon receiving any other mouse event 
(Moved, Clicked, etc.) if the flag indicates we haven't yet sent an 
Entered event for this window. The flag should be set/reset in the 
Entered/Exited mouse handlers.

We use this approach in FX and everyone seems to be happy about that.

--
best regards,
Anthony

On 3/27/2012 12:08 PM, Alexander Scherbatiy wrote:
> 
> Hello,
> 
> Does the Mac OS X contains a method that allows to find the topmost 
> window under a mouse cursor?
> 
> There is the issue when a window is created under a mouse cursor or it 
> is moved under a mouse cursor the system does not generate the 
> NSMouseEntered event.
> 
> It is possible to synthetically generate the MouseEntered event for  
> window creation and moving in Java because we need that a window 
> behavior on Mac OS X was the same as on others platforms.
> But it is necessary to have a way to know is this window the topmost 
> under a mouse cursor.
> 
> Thanks,
> Alexandr.
> 
> 
> 


More information about the macosx-port-dev mailing list