mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-12 04:46:00 +00:00
The text input state has been changed to be window-specific.
SDL_StartTextInput(), SDL_StopTextInput(), SDL_TextInputActive(), SDL_ClearComposition(), and SDL_SetTextInputRect() all now take a window parameter. This change also fixes IME candidate positioning when SDL_SetTextInputRect() is called before SDL_StartTextInput(), as is recommended in the documentation.
This commit is contained in:
@@ -292,8 +292,11 @@ class SDL_BLooper : public BLooper
|
||||
|
||||
void _HandleKey(BMessage *msg)
|
||||
{
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 scancode, state; /* scancode, pressed/released */
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("key-state", &state) != B_OK ||
|
||||
msg->FindInt32("key-scancode", &scancode) != B_OK) {
|
||||
return;
|
||||
@@ -306,7 +309,8 @@ class SDL_BLooper : public BLooper
|
||||
HAIKU_SetKeyState(scancode, state);
|
||||
SDL_SendKeyboardKey(0, SDL_DEFAULT_KEYBOARD_ID, scancode, HAIKU_GetScancodeFromBeKey(scancode), state);
|
||||
|
||||
if (state == SDL_PRESSED && SDL_TextInputActive()) {
|
||||
win = GetSDLWindow(winID);
|
||||
if (state == SDL_PRESSED && SDL_TextInputActive(win)) {
|
||||
const int8 *keyUtf8;
|
||||
ssize_t count;
|
||||
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) {
|
||||
|
Reference in New Issue
Block a user