audio display: limit mouse event rate
Same as with visual typesetting.
This commit is contained in:
parent
07e4d38198
commit
b4f54a3adc
2 changed files with 10 additions and 0 deletions
|
@ -1045,6 +1045,13 @@ void AudioDisplay::OnMouseLeave(wxMouseEvent&)
|
|||
|
||||
void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
// wx doesn’t throttle for us, updating the video view is
|
||||
// very expensive, and aegisub’s 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()))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue