NativeWindow: call setTextInputEnabled(false) right away when window is created (closes openfl/openfl#2697)
We seem to have been assuming that it was false by default, but in SDL 2, it is true by default (planned to be false in SDL 3, apparently). It can cause weird behavior like IME popups appearing when holding down keys (something commonly done by users playing games, so we don't want that!). We want setTextInputEnabled(true) to happen only when an OpenFL TextField (or anything else that accepts text input) receives focus, and then cleared again when focus is lost. This does not disable regular keyboard input. It is specifically related to what SDL considers text input, which is different, even if it uses the keyboard.
This commit is contained in:
@@ -173,6 +173,13 @@ class NativeWindow
|
||||
|
||||
setFrameRate(Reflect.hasField(attributes, "frameRate") ? attributes.frameRate : 60);
|
||||
#end
|
||||
|
||||
// SDL 2 enables text input events by default, but we want them only
|
||||
// when requested. otherwise, we might get weird behavior like IME
|
||||
// candidate windows appearing unexpectedly when holding down a key.
|
||||
// See, for example: openfl/openfl#2697
|
||||
// it appears that SDL 3 may behave differently, if we ever upgrade.
|
||||
setTextInputEnabled(false);
|
||||
}
|
||||
|
||||
public function alert(message:String, title:String):Void
|
||||
|
||||
Reference in New Issue
Block a user