-
Notifications
You must be signed in to change notification settings - Fork 825
Fix OSD level animation lag when using gesture volume control #13338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Fix jerky level animation for small value changes, if level value changes by less than 0.4 do it using new fast constant, set it to zero for now. the 0.4 is kind of hardcoded as the I wanted the brightness (that jumps by 0.4 on my system) to have the 100ms level animation and all below it 0ms.
throttling OSD manager show function calls to prevent event flooding when using gestures for volume control, which too was contributing to some choppiness.
Updates Clutter animation to linear to make is smooth and lower burstiness of animation.
|
hey @mtwebster , sorry for the bother, but c8cb4ec is failing on mint22 build but the later commit is passing, also since I'm new can you check if the code is following good standards. |
|
Hi sorry I missed your comment, don't worry about those builds - they're meaningless for commits like this that don't touch compiled code, and there are many reasons unrelated to a pull request that can cause failures as well. |
|
I made a typo in my code and crashed my ui, thought something was wrong with the code so closed the pull request and checked the code, no issue here. |
js/ui/gestures/actions.js
Outdated
| this.pct_step = Math.ceil(this.max_volume / 100); | ||
|
|
||
| this.last_time = 0; | ||
| this.poll_interval = 50 * 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the poll interval is used in two places, maybe it should just be a constant for the entire file and we get rid of poll_interval altogether.
like const CONTINUOUS_ACTION_POLL_INTERVAL = 50 * 1000;
| if (percentage < this.threshold) { | ||
| return; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a final Main.osdWindowManager.show() in end()? It may have been skipped during the update, and the volume ends up not being the same as what the user last saw in an Osd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the show() fnc to end, I lazily thought the visual and actual volume diff in these cases would be very small, but yeah we should try to present it cleanly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the change correct or should I have gone with this:
const percentage = Math.ceil(sink.volume / this.pct_step).clamp(0, 100); Main.osdWindowManager.show(-1, this._get_volume_icon(percentage), null, percent, false);
add polling const, reset last_time to 0 in begin() and show final volume state after gesture end.
code had auto indented because of editor.
Fixes visual laggy appearance of level animation in OSD when using touchpad gesture volume control, from #12760.
Need
The previous behavior forces 100ms LEVEL_ANIMATION_TIME transition for all level changes, even minuscule ones, causes extreme lag when using gestures. (addressable by throttling alone for now)
Fix
Throttled osdWindowManager.show() call in similar fashion as in zoom control class, prevent event flooding.
Initially made other changes, but realised they were not really necessary and felt bloaty, throttling works fine.
Thanks for reviewing.
Closes #12760