Work around some input method bug on windows
At least this fixes Hangul input for me. I'm sure nobody else had any problems with it and I'm sure everyone will start having problems with it now :)
This commit is contained in:
parent
a5e179e530
commit
2c56adde5a
@ -249,10 +249,15 @@ void Engine::onTextEditing(String text, int start)
|
||||
// arrives. We also forward a textediting event on every packet,
|
||||
// which is redundant, but should be okay, as textediting events are
|
||||
// not supposed to have an effect on the actual text being edited.
|
||||
if (start == 0)
|
||||
// * We define a first-y looking packet as one with a start parameter
|
||||
// lower than or equal to the start parameter of the previous packet.
|
||||
// This is general enough that it seems to work around the bugs
|
||||
// of all SDL input method backends.
|
||||
if (start <= lastTextEditingStart)
|
||||
{
|
||||
textEditingBuf.clear();
|
||||
}
|
||||
lastTextEditingStart = start;
|
||||
textEditingBuf.append(text);
|
||||
if (state_ && !ignoreEvents)
|
||||
state_->DoTextEditing(textEditingBuf);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "common/ExplicitSingleton.h"
|
||||
#include "graphics/Pixel.h"
|
||||
#include "gui/interface/Point.h"
|
||||
#include <climits>
|
||||
|
||||
class Graphics;
|
||||
namespace ui
|
||||
@ -92,6 +93,7 @@ namespace ui
|
||||
bool resizable;
|
||||
|
||||
bool textInput = false;
|
||||
int lastTextEditingStart = INT_MAX;
|
||||
|
||||
float dt;
|
||||
float fps;
|
||||
|
Loading…
Reference in New Issue
Block a user