mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 05:35:29 +08:00
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).
This commit is contained in:
@@ -309,20 +309,20 @@ static void pointer_button(void *data,
|
|||||||
}
|
}
|
||||||
int b = 0;
|
int b = 0;
|
||||||
Fl::e_state &= ~FL_BUTTONS;
|
Fl::e_state &= ~FL_BUTTONS;
|
||||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
if (button == BTN_LEFT) {Fl::e_state |= FL_BUTTON1; b = 1;}
|
||||||
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_RIGHT) {Fl::e_state |= FL_BUTTON3; b = 3;}
|
else if (button == BTN_MIDDLE) {Fl::e_state |= FL_BUTTON2; b = 2;}
|
||||||
else if (button == BTN_MIDDLE) {Fl::e_state |= FL_BUTTON2; b = 2;}
|
Fl::e_keysym = FL_Button + b;
|
||||||
Fl::e_keysym = FL_Button + b;
|
|
||||||
}
|
|
||||||
Fl::e_dx = Fl::e_dy = 0;
|
Fl::e_dx = Fl::e_dy = 0;
|
||||||
|
|
||||||
set_event_xy(win);
|
set_event_xy(win);
|
||||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||||
event = FL_PUSH;
|
event = FL_PUSH;
|
||||||
checkdouble();
|
checkdouble();
|
||||||
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED) event = FL_RELEASE;
|
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||||
//fprintf(stderr, "%s %s\n", fl_eventnames[event], win->label() ? win->label():"[]");
|
event = FL_RELEASE;
|
||||||
|
}
|
||||||
|
// fprintf(stderr, "%s %s\n", fl_eventnames[event], win->label() ? win->label():"[]");
|
||||||
Fl::handle(event, win);
|
Fl::handle(event, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user