Properly skip events

So the mouse doesn’t get trapped because the button release event is
swallowed up.
This commit is contained in:
Mia Herkt 2021-01-18 14:10:03 +01:00
parent 774ff2bbaf
commit a3024815a0
Signed by: mia
SSH key fingerprint: SHA256:wqxNmz1v3S4rHhF0I3z/ogVueFRUac93swSgNGfr8No
2 changed files with 8 additions and 2 deletions

View file

@ -1049,7 +1049,10 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
// very expensive, and aegisubs work queue handling is bad,
// so limit mouse event rate to ~200 Hz
long ts = event.GetTimestamp();
if ((ts - last_event) < 5) return;
if (!event.IsButton() && (ts - last_event) < 5) {
event.Skip();
return;
}
last_event = ts;
// If we have focus, we get mouse move events on Mac even when the mouse is

View file

@ -174,7 +174,10 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
// very expensive, and aegisubs work queue handling is bad,
// so limit mouse event rate to ~200 Hz
long ts = event.GetTimestamp();
if ((ts - lastEvent) < 5) return;
if (!event.IsButton() && (ts - lastEvent) < 5) {
event.Skip();
return;
}
lastEvent = ts;
bool left_click = event.LeftDown();