mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
partial
This commit is contained in:
parent
fa0c09d202
commit
79669b5a94
2 changed files with 34 additions and 1 deletions
|
@ -37,6 +37,13 @@ enum EEVENT_TYPE
|
||||||
/** This event is created when multiple characters are sent at a time (e.g. using an IME). */
|
/** This event is created when multiple characters are sent at a time (e.g. using an IME). */
|
||||||
EET_STRING_INPUT_EVENT,
|
EET_STRING_INPUT_EVENT,
|
||||||
|
|
||||||
|
//! A string composition event.
|
||||||
|
/** This event is created when the user "composes" characters (e.g. using an IME) before entering
|
||||||
|
the complete text.
|
||||||
|
See https://wiki.libsdl.org/SDL2/SDL_TextEditingExtEvent
|
||||||
|
*/
|
||||||
|
EET_STRING_COMPOSITION_EVENT,
|
||||||
|
|
||||||
//! A touch input event.
|
//! A touch input event.
|
||||||
EET_TOUCH_INPUT_EVENT,
|
EET_TOUCH_INPUT_EVENT,
|
||||||
|
|
||||||
|
@ -382,6 +389,19 @@ struct SEvent
|
||||||
core::stringw *Str;
|
core::stringw *Str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! String composition event.
|
||||||
|
struct SStringComposition
|
||||||
|
{
|
||||||
|
//! The string that is composed.
|
||||||
|
core::stringw *Str;
|
||||||
|
|
||||||
|
//! The position within the composition where further text would be inserted.
|
||||||
|
s32 Start;
|
||||||
|
|
||||||
|
//! The number of characters that would be replaced by further typing.
|
||||||
|
s32 Length;
|
||||||
|
};
|
||||||
|
|
||||||
//! Any kind of touch event.
|
//! Any kind of touch event.
|
||||||
struct STouchInput
|
struct STouchInput
|
||||||
{
|
{
|
||||||
|
@ -532,6 +552,7 @@ struct SEvent
|
||||||
struct SMouseInput MouseInput;
|
struct SMouseInput MouseInput;
|
||||||
struct SKeyInput KeyInput;
|
struct SKeyInput KeyInput;
|
||||||
struct SStringInput StringInput;
|
struct SStringInput StringInput;
|
||||||
|
struct SStringComposition StringComposition;
|
||||||
struct STouchInput TouchInput;
|
struct STouchInput TouchInput;
|
||||||
struct SAccelerometerEvent AccelerometerEvent;
|
struct SAccelerometerEvent AccelerometerEvent;
|
||||||
struct SGyroscopeEvent GyroscopeEvent;
|
struct SGyroscopeEvent GyroscopeEvent;
|
||||||
|
|
|
@ -340,7 +340,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters ¶m) :
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set IME hints
|
// Set IME hints
|
||||||
SDL_SetHint(SDL_HINT_IME_INTERNAL_EDITING, "1");
|
SDL_SetHint(SDL_HINT_IME_INTERNAL_EDITING, "0");
|
||||||
#if defined(SDL_HINT_IME_SHOW_UI)
|
#if defined(SDL_HINT_IME_SHOW_UI)
|
||||||
SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");
|
SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");
|
||||||
#endif
|
#endif
|
||||||
|
@ -885,6 +885,18 @@ bool CIrrDeviceSDL::run()
|
||||||
irrevent.StringInput.Str = NULL;
|
irrevent.StringInput.Str = NULL;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case SDL_TEXTEDITING: {
|
||||||
|
irrevent.EventType = irr::EET_STRING_COMPOSITION_EVENT;
|
||||||
|
irrevent.StringComposition.Str = new core::stringw();
|
||||||
|
irr::core::utf8ToWString(*irrevent.StringInput.Str, SDL_event.edit.text);
|
||||||
|
irrevent.StringComposition.Start = SDL_event.edit.start;
|
||||||
|
irrevent.StringComposition.Length = SDL_event.edit.length;
|
||||||
|
postEventFromUser(irrevent);
|
||||||
|
delete irrevent.StringInput.Str;
|
||||||
|
irrevent.StringInput.Str = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
case SDL_KEYUP: {
|
case SDL_KEYUP: {
|
||||||
auto keysym = SDL_event.key.keysym.sym;
|
auto keysym = SDL_event.key.keysym.sym;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue