Skip to content

Add option to lock cursor to window - #423

Open
tpenguinltg wants to merge 1 commit into
itdelatrisu:masterfrom
tpenguinltg:f/lock-cursor
Open

Add option to lock cursor to window#423
tpenguinltg wants to merge 1 commit into
itdelatrisu:masterfrom
tpenguinltg:f/lock-cursor

Conversation

@tpenguinltg

Copy link
Copy Markdown
Contributor

Locking the cursor to the window prevents the mouse from leaving the window. This is useful in windowed mode where accidentally leaving the window results in the game being paused.

The F9 key has been globally bound to toggle this option. osu! uses F9 to toggle its extended chat window, but opsu! is unlikely to implement a chat feature. As well, it is close to the F10 key, which toggles mouse buttons.

Locking the cursor to the window prevents the mouse from leaving the
window. This is useful in windowed mode where accidentally leaving the
window results in the game being paused.

The F9 key has been globally bound to toggle this option. osu! uses F9
to toggle its extended chat window, but opsu! is unlikely to implement a
chat feature. As well, it is close to the F10 key, which toggles mouse
buttons.
@itdelatrisu

Copy link
Copy Markdown
Owner

Unfortunately this has been broken in Slick2D since the beginning: #45 (comment)

Just tried it again, and this still completely breaks touchscreen support. :/

@tpenguinltg

Copy link
Copy Markdown
Contributor Author

That's why I put it behind an option that's turned off by default. @fluddokt's fork would probably want to have this permanently disabled. Is there a way we can put a visible warning or detect that it's a touch screen? Or perhaps as a less-than-optimal workaround, disable it in fullscreen mode?

Unfortunately, I don't have a touch screen to test on. How exactly is it broken? Is it that it doesn't register any taps (or taps in the middle of the window) because the mouse position is internally managed by LWJGL? If so, the alternative solution I thought of was to set a mouse listener on mouse move and clamp the cursor position to the bounds of the window. Is there a way to find out what the absolute positions are for the corners of the window?

@tpenguinltg

Copy link
Copy Markdown
Contributor Author

I realized that a drawing tablet will probably experience the same issue as a touch screen, both being absolute pointing devices. I'll see what I can do with that.

@kleines-L

Copy link
Copy Markdown

please work on opsu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants