From 858c3cad869593765fa81f417432d2a0d0e60af5 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 12 Jul 2023 18:05:07 +0200 Subject: 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). --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3