diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-07-12 18:05:07 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-07-12 18:05:07 +0200 |
| commit | 858c3cad869593765fa81f417432d2a0d0e60af5 (patch) | |
| tree | 8a81f36b6fd6719cba903366849dab693f4f23c2 | |
| parent | 11dc28c32169ac5c785b70d9f4fe97077c8b7ba8 (diff) | |
Fix Wayland FL_RELEASE events reporting wrong button
... in Fl::event_button().
This can be seen when two buttons have been pressed simultaneously
and then released (see test/handle_events.cxx).
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index cac300567..b4cc6eb58 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -309,20 +309,20 @@ static void pointer_button(void *data, } int b = 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;} - Fl::e_keysym = FL_Button + b; - } + 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; set_event_xy(win); if (state == WL_POINTER_BUTTON_STATE_PRESSED) { event = FL_PUSH; checkdouble(); - } else if (state == WL_POINTER_BUTTON_STATE_RELEASED) event = FL_RELEASE; -//fprintf(stderr, "%s %s\n", fl_eventnames[event], win->label() ? win->label():"[]"); + } else if (state == WL_POINTER_BUTTON_STATE_RELEASED) { + event = FL_RELEASE; + } + // fprintf(stderr, "%s %s\n", fl_eventnames[event], win->label() ? win->label():"[]"); Fl::handle(event, win); } |
