1
0
Fork 0

audio display: limit mouse event rate

Same as with visual typesetting.
This commit is contained in:
Mia Herkt 2021-01-18 05:03:16 +01:00
parent d2b3e38565
commit 774ff2bbaf
Signed by: mia
SSH Key Fingerprint: SHA256:wqxNmz1v3S4rHhF0I3z/ogVueFRUac93swSgNGfr8No
2 changed files with 10 additions and 0 deletions

View File

@ -1045,6 +1045,13 @@ void AudioDisplay::OnMouseLeave(wxMouseEvent&)
void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
{
// wx doesnt throttle for us, updating the video view is
// 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;
last_event = ts;
// If we have focus, we get mouse move events on Mac even when the mouse is
// outside our client rectangle, we don't want those.
if (event.Moving() && !GetClientRect().Contains(event.GetPosition()))

View File

@ -130,6 +130,9 @@ class AudioDisplay: public wxWindow {
/// Zoom level given as a number, see SetZoomLevel for details
int zoom_level;
/// Time since last mouse event
long last_event = 0;
/// Absolute pixel position of the tracking cursor (mouse or playback)
int track_cursor_pos = -1;
/// Label to show by track cursor