Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

SDL_TEXTINPUT when holding Control, only on Firefox #60

Open
TrevorSundberg opened this issue Jul 20, 2018 · 1 comment
Open

SDL_TEXTINPUT when holding Control, only on Firefox #60

TrevorSundberg opened this issue Jul 20, 2018 · 1 comment

Comments

@TrevorSundberg
Copy link

I made a simple SDL application to test this behavior. This is basically first hitting LCtrl, then V (hence two keydowns) and then letting go of V and then LCtrl (two keyups), effectively pressing Ctrl+V:

Chrome 67.0.3396.99 (64-bit):

SDL_KEYDOWN state: 1, scan: 224, sym: 1073742048
Ctrl 1
SDL_KEYDOWN state: 1, scan: 25, sym: 118
Ctrl 1
SDL_KEYUP   state: 0, scan: 25, sym: 118
Ctrl 1
SDL_KEYUP   state: 0, scan: 224, sym: 1073742048
Ctrl 0

Edge 42.17134.1.0 (64-bit):

SDL_KEYDOWN state: 1, scan: 224, sym: 1073742048
Ctrl 1
SDL_KEYDOWN state: 1, scan: 25, sym: 118
Ctrl 1
SDL_KEYUP   state: 0, scan: 25, sym: 118
Ctrl 1
SDL_KEYUP   state: 0, scan: 224, sym: 1073742048
Ctrl 0

Opera 54.0.2952.60 (64-bit):

SDL_KEYDOWN state: 1, scan: 224, sym: 1073742048
Ctrl 1
SDL_KEYDOWN state: 1, scan: 25, sym: 118
Ctrl 1
SDL_KEYUP   state: 0, scan: 25, sym: 118
Ctrl 1
SDL_KEYUP   state: 0, scan: 224, sym: 1073742048
Ctrl 0

Firefox 61.0.1 (64-bit):

SDL_KEYDOWN state: 1, scan: 224, sym: 1073742048
Ctrl 1
SDL_KEYDOWN state: 1, scan: 25, sym: 118
Ctrl 1
SDL_TEXTINPUT v
Ctrl 1
SDL_KEYUP   state: 0, scan: 25, sym: 118
Ctrl 1
SDL_KEYUP   state: 0, scan: 224, sym: 1073742048
Ctrl 0

There is basically a SDL_TEXTINPUT in the middle only on Firefox. Obviously in our own code we can just ignore it when Ctrl is pressed, however I thought you might like to know the difference exists.

Just for testing... really rough program, don't judge me :P

  SDL_Event event;
  while (SDL_PollEvent(&event))
  {
    if (event.type == SDL_KEYDOWN)
      printf("SDL_KEYDOWN state: %d, scan: %d, sym: %d\n", event.key.state, event.key.keysym.scancode, event.key.keysym.sym);
    if (event.type == SDL_KEYUP)
      printf("SDL_KEYUP   state: %d, scan: %d, sym: %d\n", event.key.state, event.key.keysym.scancode, event.key.keysym.sym);
    if (event.type == SDL_TEXTINPUT)
      printf("SDL_TEXTINPUT %s\n", event.text.text);
    
    if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP || event.type == SDL_TEXTINPUT)
      printf("Ctrl %d\n", (int)(SDL_GetKeyboardState(NULL)[SDL_SCANCODE_LCTRL] || SDL_GetKeyboardState(NULL)[SDL_SCANCODE_RCTRL]));
    
    fflush(stdout);
  }
@TrevorSundberg TrevorSundberg changed the title SDL_TEXTINPUT when holding control, only on Firefox not on Chrome SDL_TEXTINPUT when holding Control, only on Firefox Jul 20, 2018
@TrevorSundberg
Copy link
Author

Also I just tested that other browsers do not give SDL_TEXTINPUT when Alt is held, but Firefox does.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant