Repository navigation
Conversation
Added a range check on the portal's accent-color channels. Bumped the version to 2.1.1.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
2 tasks done
049er
marked this pull request as ready for review
November 6, 2026 06:36
Read the accent color asynchronously, with a two second timeout. Unwrapped the portal value however many variants wrap it.
getAccentColor now returns null when the GTK theme has no accent color or the view is gone. Updated the plugin's doc comments.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Three fixes to
getAccentColoron Linux.The XDG settings portal reports an unset accent color with values outside 0 to 1.
getAccentColorconverted them anyway, so(-1, -1, -1)became0xFFFFFF01, almost pure yellow. It now falls back to the GTK theme color when any channel is out of range or not a number.The portal was read synchronously with the default D-Bus timeout, so a portal that did not answer held the platform thread for 25 seconds. The read is now asynchronous with a 2 second timeout, then falls back to the GTK theme color. A value wrapped in one variant is accepted as well as two.
getAccentColorreturns null when neither the portal nor the GTK theme provides a color. It used to return an undefined value when the theme has notheme_selected_bg_color, and logged GTK critical messages when the window closed during a read.A portal that is already not answering when the app starts is not covered. Flutter's own settings code reads it with no timeout before Dart runs, so the app does not start.
#705 routes its
SettingChangedhandler through the same conversion, so that path needs the same range check.Tests
Native code and doc comments only, so no unit test.
flutter testpasses.Checked with Flutter 3.44.1 stable against a fake portal on a private session bus, with GTK theme color
0xFFE95420.(-1, -1, -1),(2, 0.5, 0.5)and(NaN, 0, 0)now return the theme color. In-range values and a missing setting are unchanged. A value in one variant returns that value instead of the theme color. A missing setting with a theme that lacks the color returns null instead of0x00000000.With the real portal frozen with
SIGSTOP,getAccentColorreturns the theme color after 2 seconds instead of 25, and a clipboard call made at the same time is answered in 11 ms instead of 25 seconds. The GTK critical messages no longer appear when the window is destroyed during a read.The
Analyze Dart codecheck already fails onmainbecause of deprecation warnings. This change adds none.Not tested against a real desktop that reports an unset accent color.
Issues
No linked issue.
Checklist
CHANGELOG.mdContributed by Werner Scholtz, with thanks to KDAB.