Implement keyboard grab support for Wayland

Use zwp_keyboard_shortcuts_inhibit_manager_v1 to allow SDL applications
to capture system keyboard shortcuts like Alt+Tab when keyboard grab is
enabled via SDL_HINT_GRAB_KEYBOARD.
This commit is contained in:
Cameron Gutman
2021-01-19 18:20:07 -06:00
parent 6e97170e96
commit d789ba8332
7 changed files with 193 additions and 2 deletions

View File

@@ -636,10 +636,15 @@ Wayland_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
if (grabbed)
if (grabbed) {
Wayland_input_confine_pointer(window, data->input);
else
if (SDL_GetHintBoolean(SDL_HINT_GRAB_KEYBOARD, SDL_FALSE))
Wayland_input_grab_keyboard(window, data->input);
} else {
Wayland_input_ungrab_keyboard(window);
Wayland_input_unconfine_pointer(data->input);
}
}
int Wayland_CreateWindow(_THIS, SDL_Window *window)