@@ -752,16 +752,26 @@ void ui_do_frame()
752
752
// also use keydown events for ctrl characters, esc, and a few other
753
753
// characters that the emulator will need
754
754
if (io.WantCaptureKeyboard == false ) {
755
- // send keys that are down (which we need for control keys backspace
756
- // etc. The underlying code will figure out what it needs to keep
755
+ // get the text input keys from IMGUI and send whatever has been typed as normal
756
+ // keys. special handling of ctrl keys, etc is done next
757
+ if (io.KeyCtrl == false && io.KeyAlt == false && io.KeySuper == false ) {
758
+ for (auto n = 0 ; n < io.InputQueueCharacters .Size ; n++)
759
+ {
760
+ unsigned int c = (unsigned int )io.InputQueueCharacters [n];
761
+ keyboard_handle_event (c, false , io.KeyCtrl , io.KeyAlt , io.KeySuper );
762
+ }
763
+ }
764
+
765
+ // now handle non-printable characters
757
766
for (auto i = 0 ; i < 512 ; i++) {
758
767
int key = SDL_GetKeyFromScancode ((SDL_Scancode)i);
759
- if (ImGui::IsKeyPressed (i )) {
760
- if ((key & SDLK_SCANCODE_MASK) || key < 256 ) {
761
- keyboard_handle_event (key, io.KeyShift , io.KeyCtrl , io.KeyAlt , io.KeySuper );
762
- }
763
- }
768
+ if (io. KeyCtrl == true || (key <= SDLK_a || key > SDLK_z )) {
769
+ if ( ImGui::IsKeyPressed (i) ) {
770
+ keyboard_handle_event (key, io.KeyShift , io.KeyCtrl , io.KeyAlt , io.KeySuper );
771
+ }
772
+ }
764
773
}
774
+
765
775
}
766
776
767
777
if (Show_main_menu) {
0 commit comments