|
14 | 14 |
|
15 | 15 | #include "flutter/shell/platform/common/json_message_codec.h" |
16 | 16 | #include "flutter/shell/platform/linux_embedded/logger.h" |
17 | | -#include "flutter/shell/platform/linux_embedded/plugin/key_event_plugin_glfw_util.h" |
| 17 | +#include "flutter/shell/platform/linux_embedded/plugin/keyboard_glfw_util.h" |
18 | 18 | #include "flutter/shell/platform/linux_embedded/window_binding_handler_delegate.h" |
19 | 19 |
|
20 | 20 | namespace flutter { |
@@ -83,17 +83,22 @@ uint32_t KeyeventPlugin::GetCodePoint(uint32_t keycode) { |
83 | 83 |
|
84 | 84 | bool KeyeventPlugin::IsTextInputSuppressed(uint32_t code_point) { |
85 | 85 | if (code_point) { |
86 | | - auto mods = GetGlfwModifiers(xkb_mods_mask_); |
87 | | - return (mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); |
| 86 | + auto ctrl_key_index = |
| 87 | + xkb_keymap_mod_get_index(xkb_keymap_, XKB_MOD_NAME_CTRL); |
| 88 | + auto alt_key_index = |
| 89 | + xkb_keymap_mod_get_index(xkb_keymap_, XKB_MOD_NAME_ALT); |
| 90 | + |
| 91 | + return (xkb_mods_mask_ & ((1 << ctrl_key_index) | (1 << alt_key_index))) != |
| 92 | + 0; |
88 | 93 | } |
89 | 94 | return false; |
90 | 95 | } |
91 | 96 |
|
92 | 97 | void KeyeventPlugin::OnKey(uint32_t keycode, uint32_t state) { |
93 | 98 | #if defined(DISPLAY_BACKEND_TYPE_WAYLAND) |
94 | 99 | auto unicode = GetCodePoint(keycode); |
95 | | - auto mods = GetGlfwModifiers(xkb_mods_mask_); |
96 | | - auto keyscancode = GetGlfwKeyScancode(keycode); |
| 100 | + auto mods = GetGlfwModifiers(xkb_keymap_, xkb_mods_mask_); |
| 101 | + auto keyscancode = GetGlfwKeycode(keycode); |
97 | 102 | SendKeyEvent(keyscancode, unicode, mods, state); |
98 | 103 | #else |
99 | 104 | // We cannot get notifications of modifier keys when we use the DRM backend. |
|
0 commit comments