mirror of
https://github.com/encounter/SDL.git
synced 2025-12-11 06:27:44 +00:00
Fixed bug 3461 - Implement TEXTINPUT events for Haiku
Kai Sterker Apparently, SDL2 on Haiku does not generate SDL_TEXTINPUT events. Attached is a patch that adds this functionality. Tested with SDLs own checkkeys program and different keymaps as well as my own SDL application and German keyboard layout to verify it generates the expected input.
This commit is contained in:
@@ -193,7 +193,8 @@ public:
|
||||
if(_current_context)
|
||||
_current_context->UnlockGL();
|
||||
_current_context = newContext;
|
||||
_current_context->LockGL();
|
||||
if (_current_context)
|
||||
_current_context->LockGL();
|
||||
}
|
||||
private:
|
||||
/* Event management */
|
||||
@@ -272,6 +273,17 @@ private:
|
||||
}
|
||||
BE_SetKeyState(scancode, state);
|
||||
SDL_SendKeyboardKey(state, BE_GetScancodeFromBeKey(scancode));
|
||||
|
||||
if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
|
||||
const int8 *keyUtf8;
|
||||
ssize_t count;
|
||||
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) {
|
||||
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
||||
SDL_zero(text);
|
||||
SDL_memcpy(text, keyUtf8, count);
|
||||
SDL_SendKeyboardText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _HandleMouseFocus(BMessage *msg) {
|
||||
|
||||
Reference in New Issue
Block a user