Skip to content

Grab keyboard when the game is not launched with -nomousegrab#665

Merged
pzychotic merged 1 commit intomainfrom
keyboard-grab
Feb 23, 2025
Merged

Grab keyboard when the game is not launched with -nomousegrab#665
pzychotic merged 1 commit intomainfrom
keyboard-grab

Conversation

@Lgt2x
Copy link
Member

@Lgt2x Lgt2x commented Feb 17, 2025

Pull Request Type

  • GitHub Workflow changes
  • Documentation or Wiki changes
  • Build and Dependency changes
  • Runtime changes
    • Render changes
    • Audio changes
    • Input changes
    • Network changes
    • Other changes

Description

Avoid system shortcuts getting in the way of the game by grabbing the keyboard. Per the doc, only alt+tab is allowed when the game is in full-screen (https://wiki.libsdl.org/SDL3/SDL_SetWindowKeyboardGrab)

Related Issues

#664

Will change signature when ported to SDL3 (cf #663 )

Avoid system shortcuts getting in the way of the game
Copy link
Member

@pzychotic pzychotic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also works on Windows to prevent tabbing out of the game when accidentally hitting the windows key.

I'm just reluctant to merge since the referenced issue to be closed derailed into another topic.

@Lgt2x
Copy link
Member Author

Lgt2x commented Feb 23, 2025

I edited the description so it will not close the issue automatically. In the meantime, I think we can merge this. I wanted to add the release of the mouse grab when the game is paused in this PR, but unfortunately we'll need to fix the mouse input code first ( see #634)

@pzychotic pzychotic merged commit f699b3c into main Feb 23, 2025
10 checks passed
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.

2 participants