If mouse leaves the application (e.g. top menu focused)

sbessey's icon

Is there a way to check for mouse focus for the main patcher window?

I am working on my custom cursor and when I select a menu from the top and start moving through the menu items, my cursor hide code is executed, hiding the real mouse cursor. I have a boundary check for when mouseX > 0 or mouseY > 0, so I see why the mouse is hiding. The thing is my custom cursor is behind the currently open menu, hence why I am asking about focus in / focus out.

I have also tried to give the Global Patch a name but no luck. My application only has the main patcher file, and does not load any other [patcher] object.