Make default cursor invisible without grabbing it?

Started by lainmaster, September 10, 2009, 01:02:16

Previous topic - Next topic

kappa



lainmaster

Okay, works nice, but how can I tell whenever the cursor exits the window?

kappa

you can't atm, you'll just have to do some manual hacking like detecting if the mouse.getX(),getY() has changed.

This is a much requested feature for LWJGL, maybe it will be added sometime in the future, your also free to write a patch.

lainmaster

I don't find it possible to do such hack, since Mouse.GetX/Y returns last when it still was inside the window, and I cannot tell where the mouse was going.
Maybe I can still get the Mouse position on screen, and the Left/Top position of the GL Window? How could I do that? (In particular, the second)

About telling when the mouse exits an area, I used to know how to do this in Visual Basic 6 using Window's API, I'll check out LWJGL's source and see if I can help.

kappa

you could also try java's AWT Robot class, and get the screen coordinates of the mouse and then calculate if its in or outside the window.

lainmaster

How can I tell what the position of the window is?

Matzon

I have a working solution for tracking if mouse left and also if mouse is to the left or below of the window when outside and dragging. I will commit it shortly, but I need to talk to people on irc first since the latter requires an API change (we must stop clipping value to 0).

furthermore - any api changes must also be done in mac and linux - for which I have no code currently.

lainmaster

It would be a nice addition to 2.2.1. : D It'd be nice to just do Mouse.isOut() or Mouse.eventOutOfBounds() Or something of the sort.

princec

Please don't break any existing code! If you're going to do that then enable the behaviour with a commandline switch.

Cas :)