mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 23:48:29 +00:00
Refactor keyboard grab to be managed by the video core
This gives us flexibility to add others hints to control keyboard grab behavior without having to touch all of the backends. It also allows us to possibly expose keyboard grab separately from mouse grab for applications that want to manage those independently.
This commit is contained in:
@@ -676,12 +676,20 @@ Wayland_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
|
||||
|
||||
if (grabbed) {
|
||||
Wayland_input_confine_pointer(window, data->input);
|
||||
} else {
|
||||
Wayland_input_unconfine_pointer(data->input);
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_GetHintBoolean(SDL_HINT_GRAB_KEYBOARD, SDL_FALSE))
|
||||
Wayland_input_grab_keyboard(window, data->input);
|
||||
void
|
||||
Wayland_SetWindowKeyboardGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
|
||||
{
|
||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||
|
||||
if (grabbed) {
|
||||
Wayland_input_grab_keyboard(window, data->input);
|
||||
} else {
|
||||
Wayland_input_ungrab_keyboard(window);
|
||||
Wayland_input_unconfine_pointer(data->input);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user