Fix handling of alt (option) key on macOS

It now works just as in linux. i.e. alt+a sends <esc>a to the client.
No longer needs turning off alt to generate unicode at the OS level.
This commit is contained in:
Kovid Goyal
2017-11-07 16:19:37 +05:30
parent 88df0890ae
commit f137ea7094
3 changed files with 671 additions and 634 deletions

View File

@@ -51,16 +51,8 @@ on_text_input(unsigned int codepoint, int mods) {
unsigned int sz = 0;
if (w != NULL) {
Screen *screen = w->render_data.screen;
bool in_alt_mods = !screen->modes.mEXTENDED_KEYBOARD && (mods == GLFW_MOD_ALT || mods == (GLFW_MOD_ALT | GLFW_MOD_SHIFT));
bool is_text = mods <= GLFW_MOD_SHIFT;
if (in_alt_mods) {
sz = encode_utf8(codepoint, buf + 1);
if (sz) {
buf[0] = 033;
sz++;
}
} else if (is_text) sz = encode_utf8(codepoint, buf);
if (is_text) sz = encode_utf8(codepoint, buf);
if (sz) schedule_write_to_child(w->id, buf, sz);
}
}