satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
57 stars 13 forks source link

Cmd-` types the ` keystroke to write on signs, instead of doing nothing #46

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

When you press Cmd-Backquote on the web-based port, this will switch to different windows within the same browser app, as expected, but the app also receives the backquote as a keystroke. This causes it to enter text typing mode to write some text as a sign, annoying.

The keystroke should be ignored, maybe ignore keys when modifiers (command, shift, control) are pressed, if this is possible? Or what does glfw receive?

satoshinm commented 7 years ago

Is this an emscripten/glfw bug? From http://www.glfw.org/docs/latest/input.html, glfwSetCharCallback (set to on_char in Craft):

The callback function receives Unicode code points for key events that would have led to regular text input and generally behaves as a standard text field on that platform.

There is another glfwSetCharModsCallback function, whose description suggests the normal glfwSetCharCallback should not receive Cmd-Backquote as Backquote:

If you wish to receive even those Unicode code points generated with modifier key combinations that a plain text field would ignore, or just want to know exactly what modifier keys were used, set a character with modifiers callback.


Native doesn't even receive the Cmd-Backquote call, even with glfwSetCharModsCallback. Emscripten doesn't have glfwSetCharModsCallback, only glfwSetCharCallback.

satoshinm commented 7 years ago

Filed issue + test to emscripten: https://github.com/kripken/emscripten/issues/5121