Skip to content

Commit

Permalink
Fix text input
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j committed Feb 22, 2017
1 parent 0aaba49 commit 2180f0b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/base/UMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -525,18 +525,12 @@ procedure CheckEvents;
if not Assigned(Display.NextScreen) then
begin //drop input when changing screens
KeyCharUnicode:=0;
if (Event.type_ = SDL_TEXTINPUT) and (Event.key.keysym.unicode <> 0) then
if (Event.type_ = SDL_TEXTINPUT) then
try
s1:=Event.text.text;
KeyCharUnicode:=UnicodeStringToUCS4String(UnicodeString(UTF8String(Event.text.text)))[0];
//KeyCharUnicode:=UnicodeStringToUCS4String(UnicodeString(Event.key.keysym.unicode))[1];//Event.text.text)[0];
except
end
// TODO: hacky workaround for enabling keyboard simulation of controllers. use SDL2 new input handling SDL_StartTextInput and SDL_StopTextInput(
else if Event.key.keysym.unicode = 0 then
begin
s1 := SDL_GetScancodeName(Event.key.keysym.scancode);
if Length(s1) = 1 then KeyCharUnicode := Ord(s1[1])
end;

// if print is pressed -> make screenshot and save to screenshot path
Expand Down

0 comments on commit 2180f0b

Please sign in to comment.