visual typesetting: limit event frequency
This change makes Aegisub a lot more responsive on platforms like X11 where mouse events may come in at very high frequencies and/or in bursts.
This commit is contained in:
parent
d40eb355dd
commit
ca1ac8bcea
2 changed files with 8 additions and 0 deletions
|
@ -172,6 +172,13 @@ VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, agi::Context *context)
|
||||||
|
|
||||||
template<class FeatureType>
|
template<class FeatureType>
|
||||||
void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
|
void VisualTool<FeatureType>::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 - lastEvent) < 5) return;
|
||||||
|
lastEvent = ts;
|
||||||
|
|
||||||
bool left_click = event.LeftDown();
|
bool left_click = event.LeftDown();
|
||||||
bool left_double = event.LeftDClick();
|
bool left_double = event.LeftDClick();
|
||||||
shift_down = event.ShiftDown();
|
shift_down = event.ShiftDown();
|
||||||
|
|
|
@ -92,6 +92,7 @@ protected:
|
||||||
bool holding = false; ///< Is a hold currently in progress?
|
bool holding = false; ///< Is a hold currently in progress?
|
||||||
AssDialogue *active_line = nullptr; ///< Active dialogue line; nullptr if it is not visible on the current frame
|
AssDialogue *active_line = nullptr; ///< Active dialogue line; nullptr if it is not visible on the current frame
|
||||||
bool dragging = false; ///< Is a drag currently in progress?
|
bool dragging = false; ///< Is a drag currently in progress?
|
||||||
|
long lastEvent = 0;
|
||||||
|
|
||||||
int frame_number; ///< Current frame number
|
int frame_number; ///< Current frame number
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue