-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Add Linux platform support for fetching refresh rate on startup. #52934
Add Linux platform support for fetching refresh rate on startup. #52934
Conversation
This patch addresses the missing implementation of `platformDispatcher.views` on Linux. It checks if the refresh rate of the primary or first monitor is available and returns the value. Without this implementation, `WidgetsBinding.instance.platformDispatcher.views.first.display.size` would throw an exception on Linux, preventing safe usage. Related: flutter/flutter#144230
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Maybe @robert-ancell has some testing Ideas? It would be great to have this. |
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.
Thanks for working on this, this should be good with the logic moved to the renderer.
Instead of calculate refresh rate directly in fl_engine.cc, move the logic to fl_renderer.cc and implement it also in the headless renderer.
Thanks for the review. |
The updated code now has a test for the mock render's refresh rate. I'm not good at using GLib, because I think glib mimics OOP in a hard way. That's why I'm interested in Flutter, which uses a "real OOP" language for UI development. However, to fix engine behavior, I still need to write some GLib code, unfortunately :( Please correct my code if I made a mistake. |
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.
Looks good with the documentation fix, thanks!
…149148) flutter/engine@cf201b1...416c619 2024-05-28 [email protected] Add Linux platform support for fetching refresh rate on startup. (flutter/engine#52934) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/ doc/main/autoroll/README.md
…lutter#149148) flutter/engine@cf201b1...416c619 2024-05-28 [email protected] Add Linux platform support for fetching refresh rate on startup. (flutter/engine#52934) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/ doc/main/autoroll/README.md
This patch addresses the missing implementation of
platformDispatcher.views
on Linux. It checks the refresh rate of the renderer's window and returns the value. Without this implementation,WidgetsBinding.instance.platformDispatcher.views.first.display.size
would throw an exception on Linux, preventing safe usage.Related: flutter/flutter#144230
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.