diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 36764150c..24ceff4d0 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -589,6 +589,17 @@ static void remove_int_vector(std::vector& v, int val) { } +static char keycode_to_ascii(int keycode) { + static const char row_AD[] = "qwertyuiop"; + static const char row_AC[] = "asdfghjkl"; + static const char row_AB[] = "zxcvbnm"; + if (keycode >= 24 && keycode <= 33) return row_AD[keycode - 24]; + else if (keycode >= 38 && keycode <= 46) return row_AC[keycode - 38]; + else if (keycode >= 52 && keycode <= 58) return row_AB[keycode - 52]; + else return 0; +} + + static int process_wld_key(struct xkb_state *xkb_state, uint32_t key, uint32_t *p_keycode, xkb_keysym_t *p_sym) { uint32_t keycode = key + 8; @@ -604,6 +615,13 @@ static int process_wld_key(struct xkb_state *xkb_state, uint32_t key, } else if (keycode == 19) { for_key_vector = '0'; } + // Check for non-Latin keyboard layout + if (xkb_state_key_get_one_sym(xkb_state, 38 /* 'A' key on US keyboard */) > 'z') { + int asciiSym = keycode_to_ascii(keycode); + if (asciiSym != 0) { + for_key_vector = asciiSym; + } + } if (p_keycode) *p_keycode = keycode; if (p_sym) *p_sym = sym; return for_key_vector;