mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
Check if SDL_GetKeyboardFocus is null in X11/Wayland events
This commit is contained in:
@@ -381,7 +381,8 @@ int Wayland_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
|||||||
WAYLAND_wl_display_flush(d->display);
|
WAYLAND_wl_display_flush(d->display);
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (!d->text_input_manager && SDL_TextInputActive(SDL_GetKeyboardFocus())) {
|
SDL_Window *keyboard_focus = SDL_GetKeyboardFocus();
|
||||||
|
if (!d->text_input_manager && keyboard_focus && SDL_TextInputActive(keyboard_focus)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -454,7 +455,8 @@ void Wayland_PumpEvents(SDL_VideoDevice *_this)
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (!d->text_input_manager && SDL_TextInputActive(SDL_GetKeyboardFocus())) {
|
SDL_Window *keyboard_focus = SDL_GetKeyboardFocus();
|
||||||
|
if (!d->text_input_manager && keyboard_focus && SDL_TextInputActive(keyboard_focus)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1649,7 +1651,8 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
|
|||||||
Wayland_UpdateImplicitGrabSerial(input, serial);
|
Wayland_UpdateImplicitGrabSerial(input, serial);
|
||||||
|
|
||||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
if (SDL_TextInputActive(SDL_GetKeyboardFocus())) {
|
SDL_Window *keyboard_focus = SDL_GetKeyboardFocus();
|
||||||
|
if (keyboard_focus && SDL_TextInputActive(keyboard_focus)) {
|
||||||
has_text = keyboard_input_get_text(text, input, key, SDL_PRESSED, &handled_by_ime);
|
has_text = keyboard_input_get_text(text, input, key, SDL_PRESSED, &handled_by_ime);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -2024,7 +2024,8 @@ int X11_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
|||||||
X11_DispatchEvent(_this, &xevent);
|
X11_DispatchEvent(_this, &xevent);
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (SDL_TextInputActive(SDL_GetKeyboardFocus())) {
|
SDL_Window *keyboard_focus = SDL_GetKeyboardFocus();
|
||||||
|
if (keyboard_focus && SDL_TextInputActive(keyboard_focus)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2084,7 +2085,8 @@ void X11_PumpEvents(SDL_VideoDevice *_this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
if (SDL_TextInputActive(SDL_GetKeyboardFocus())) {
|
SDL_Window *keyboard_focus = SDL_GetKeyboardFocus();
|
||||||
|
if (keyboard_focus && SDL_TextInputActive(keyboard_focus)) {
|
||||||
SDL_IME_PumpEvents();
|
SDL_IME_PumpEvents();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user