GUI: Fix unpressed state of checkboxes and radio buttons

Clicking on a checkbox (and, presumably, a radio button) would leave it
in the "pressed" state, which would inhibit tooltips for it. Now the
unpressed state is cleared along with _duringPress for both these
classes. There are other widgets that inherit from ButtonWidget, but
they either already did this, or didn't override handleMouseUp(), so
they should be fine.
This commit is contained in:
Torbjörn Andersson 2022-03-28 11:14:28 +02:00
parent 719ea5b72c
commit d057880f92

View File

@ -691,6 +691,7 @@ void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount) {
if (isEnabled() && _duringPress && x >= 0 && x < _w && y >= 0 && y < _h) {
toggleState();
}
setUnpressedState();
_duringPress = false;
}
@ -757,6 +758,7 @@ void RadiobuttonWidget::handleMouseUp(int x, int y, int button, int clickCount)
if (isEnabled() && _duringPress && x >= 0 && x < _w && y >= 0 && y < _h) {
toggleState();
}
setUnpressedState();
_duringPress = false;
}