Skip to content

Commit 795503d

Browse files
committed
Set Windows IME status
Per YoYoGames/GameMaker-Bugs#5524
1 parent af37209 commit 795503d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

scripts/__input_system_tick/__input_system_tick.gml

+20-2
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ function __input_system_tick()
139139
}
140140
}
141141
}
142-
143-
_global.__game_input_allowed = INPUT_ALLOW_OUT_OF_FOCUS || _global.__window_focus;
144142

143+
var _game_input_allowed_previous = _global.__game_input_allowed;
144+
145+
_global.__game_input_allowed = INPUT_ALLOW_OUT_OF_FOCUS || _global.__window_focus;
145146
_global.__overlay_focus = false;
146147

147148
if (_global.__using_steamworks)
@@ -168,6 +169,23 @@ function __input_system_tick()
168169
}
169170
}
170171

172+
//Set Windows IME availability based on focus loss and regain
173+
//see https://github.com/YoYoGames/GameMaker-Bugs/issues/5524
174+
if (__INPUT_ON_WINDOWS)
175+
{
176+
if (_global.__game_input_allowed != _game_input_allowed_previous)
177+
{
178+
if (_global.__game_input_allowed)
179+
{
180+
keyboard_virtual_hide();
181+
}
182+
else
183+
{
184+
keyboard_virtual_show(kbv_type_default, kbv_returnkey_default, kbv_autocapitalize_none, false);
185+
}
186+
}
187+
}
188+
171189
//Prevent restart thrashing
172190
if ((_global.__current_time - _global.__restart_time) < 1000)
173191
{

0 commit comments

Comments
 (0)