diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-11-08 08:09:12 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-11-08 08:09:12 +0100 |
| commit | 402b08cb6ec70861f5931a39d0b4509a4d7a4e1d (patch) | |
| tree | c8a3a23c1a9d6b75781788c17c4e97129073efb9 | |
| parent | 9c793a383f181ecb1a76db54b13705dbfa9255e5 (diff) | |
Wayland: show keyboard modifiers during mouse clicks (#534)
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index d0198c646..cd067883a 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -344,11 +344,11 @@ static void pointer_button(void *data, return; } int b = 0; - Fl::e_state = 0; + Fl::e_state &= ~FL_BUTTONS; if (state == WL_POINTER_BUTTON_STATE_PRESSED) { - if (button == BTN_LEFT) {Fl::e_state = FL_BUTTON1; b = 1;} - else if (button == BTN_RIGHT) {Fl::e_state = FL_BUTTON3; b = 3;} - else if (button == BTN_MIDDLE) {Fl::e_state = FL_BUTTON2; b = 2;} + if (button == BTN_LEFT) {Fl::e_state |= FL_BUTTON1; b = 1;} + else if (button == BTN_RIGHT) {Fl::e_state |= FL_BUTTON3; b = 3;} + else if (button == BTN_MIDDLE) {Fl::e_state |= FL_BUTTON2; b = 2;} Fl::e_keysym = FL_Button + b; } Fl::e_dx = Fl::e_dy = 0; @@ -737,7 +737,7 @@ static void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, { struct seat *seat = (struct seat*)data; xkb_state_update_mask(seat->xkb_state, mods_depressed, mods_latched, mods_locked, 0, 0, group); - Fl::e_state = 0; + Fl::e_state &= ~(FL_SHIFT+FL_CTRL+FL_ALT+FL_CAPS_LOCK+FL_NUM_LOCK); if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_DEPRESSED)) Fl::e_state |= FL_SHIFT; if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_DEPRESSED)) @@ -746,6 +746,8 @@ static void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, Fl::e_state |= FL_ALT; if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED)) Fl::e_state |= FL_CAPS_LOCK; + if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_NUM, XKB_STATE_MODS_LOCKED)) + Fl::e_state |= FL_NUM_LOCK; //fprintf(stderr, "mods_depressed=%u Fl::e_state=%X\n", mods_depressed, Fl::e_state); } |
