File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -990,18 +990,29 @@ release(ButtonHandle button) {
990
990
// Button up. Send the up event associated with the region(s) we were
991
991
// over when the button went down.
992
992
993
- // There is some danger of losing button-up events here. If more than one
994
- // button goes down together, we won't detect both of the button-up events
995
- // properly.
996
993
if (_preferred_button_down_region != nullptr ) {
997
994
param.set_outside (_preferred_button_down_region != _preferred_region);
998
995
_preferred_button_down_region->release (param);
999
996
throw_event_pattern (_button_up_pattern,
1000
997
_preferred_button_down_region, button);
1001
998
}
1002
999
1003
- _button_down = false ;
1004
- _preferred_button_down_region = nullptr ;
1000
+ // Do not stop capturing until the last mouse button has gone up. This is
1001
+ // needed to prevent stopping the capture until the capturing region has
1002
+ // finished processing all the releases.
1003
+ bool has_button = false ;
1004
+ for (size_t i = 0 ; i < MouseButton::num_mouse_buttons; ++i) {
1005
+ if (MouseButton::_buttons[i] != button &&
1006
+ _current_buttons_down.get_bit (MouseButton::_buttons[i].get_index ())) {
1007
+ has_button = true ;
1008
+ }
1009
+ }
1010
+
1011
+ if (!has_button) {
1012
+ // The last mouse button went up.
1013
+ _button_down = false ;
1014
+ _preferred_button_down_region = nullptr ;
1015
+ }
1005
1016
1006
1017
} else {
1007
1018
// It's a keyboard button; therefore, send the event to every region that
You can’t perform that action at this time.
0 commit comments