DestinationSol icon indicating copy to clipboard operation
DestinationSol copied to clipboard

Research mouse-locking options on Linux

Open Cervator opened this issue 6 years ago • 1 comments

Follow-up to #360 which upgraded DS to use LWJGL3 on the backend. As noted by @BenjaminAmos in that PR "Mouse locking has been disabled on Linux, as it does not appear to work anymore (the mouse co-ordinates returned are incorrect when the cursor is locked, so the mouse cursor is never visible when locked)."

See SolInputManager.java for the related code. Probably this is a subject that can be researched decently online for an available alternative. Alternatively if we don't need it / can find a whole other approach then suggestions are welcomed!

May also want to look through older closed issues or PRs that may have touched the area in the past.

Cervator avatar Dec 24 '18 04:12 Cervator

First interesting idea on SO I found uses java.awt for this:

  1. you can query the actual mouse position with https://docs.oracle.com/javase/8/docs/api/java/awt/PointerInfo.html#getLocation--
  2. you can reset the mouse to the center with https://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html#mouseMove(int,%20int) I'll try it out when I have some time

Avalancs avatar Mar 12 '20 00:03 Avalancs