summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-01-05 19:34:46 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-01-05 19:34:46 +0100
commitbc28433f2e50c1a3381b0b7b356a65cc0129eacb (patch)
treef0dda05478eb868bd5aaaf3516815f6ef27766c3 /src
parent944b5e7072ff85333cb0f026a9864865e30660a3 (diff)
Wayland: numeric keypad keys don't work as intended - cont'd (#881)
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 60162f92a..74b60c3d6 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -720,18 +720,13 @@ fprintf(stderr, "key %s: sym: %-12s(%d) code:%u fl_win=%p, ", action, buf, sym,
xkb_state_key_get_utf8(seat->xkb_state, keycode, buf, sizeof(buf));
//fprintf(stderr, "utf8: '%s' e_length=%d [%d]\n", buf, (int)strlen(buf), *buf);
Fl::e_keysym = Fl::e_original_keysym = for_key_vector;
- if (!(Fl::e_state & FL_NUM_LOCK) && sym >= 0xFF95 && sym <= 0xFF9E) {
+ if (!(Fl::e_state & FL_NUM_LOCK) && sym >= XKB_KEY_KP_Home && sym <= XKB_KEY_KP_Insert) {
// process keypad number keys when NumLock is off
- if (sym == XKB_KEY_KP_Insert) Fl::e_keysym = FL_Insert; // 0
- else if (sym == XKB_KEY_KP_End) Fl::e_keysym = FL_End; // 1
- else if (sym == XKB_KEY_KP_Down) Fl::e_keysym = FL_Down; // 2
- else if (sym == XKB_KEY_KP_Page_Down) Fl::e_keysym = FL_Page_Down; // 3
- else if (sym == XKB_KEY_KP_Left) Fl::e_keysym = FL_Left; // 4
- else if (sym == XKB_KEY_KP_Begin) Fl::e_keysym = 0xff0b; // 5
- else if (sym == XKB_KEY_KP_Right) Fl::e_keysym = FL_Right; // 6
- else if (sym == XKB_KEY_KP_Home) Fl::e_keysym = FL_Home; // 7
- else if (sym == XKB_KEY_KP_Up) Fl::e_keysym = FL_Up; // 8
- else if (sym == XKB_KEY_KP_Page_Up) Fl::e_keysym = FL_Page_Up; // 9
+ static const int table[10] = {FL_Home /* 7 */, FL_Left /* 4 */, FL_Up /* 8 */,
+ FL_Right /* 6 */, FL_Down /* 2 */, FL_Page_Up /* 9 */,
+ FL_Page_Down /* 3 */, FL_End /* 1 */, 0xff0b /* 5 */,
+ FL_Insert /* 0 */};
+ Fl::e_keysym = table[sym - XKB_KEY_KP_Home];
}
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
if (search_int_vector(key_vector, for_key_vector) < 0) {