keyboard: fix flag icons being half-size and squashed on HiDPI - #13951
Open
rumours86 wants to merge 1 commit into
Open
keyboard: fix flag icons being half-size and squashed on HiDPI#13951rumours86 wants to merge 1 commit into
rumours86 wants to merge 1 commit into
Conversation
Two related problems made panel/menu flag icons unusable on HiDPI: 1. St.TextureCache.load_image_from_file_async() returns an actor that is pre-scaled by the ui scale. SubscriptableFlagIcon put it into its St.Bin without correcting the size, so the bin clamped only the height: with ui scale 2 a 320x240 (4:3) flag rendered at twice its proper width - visibly squashed (e.g. 64x24 for a requested height of 24). Scale the returned actor back to the logical size. 2. The applet requested the flag at the logical icon size (the menu path even lost its ui_scale multiplication at some point), so on HiDPI the flag was rendered at half the intended size. Multiply the requested size by global.ui_scale in both call sites. Measured on a 3000x2000 panel (ui scale 2): the panel flag went from a squashed 64x24 to a correct 4:3 image at the intended size. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
With "show flags" enabled the keyboard applet's flag icons render squashed (2x too wide) and at half the intended size on HiDPI.
Two related causes:
St.TextureCache.load_image_from_file_async()returns an actor pre-scaled by the ui scale.SubscriptableFlagIconputs it into itsSt.Binwithout correcting the size, so the bin clamps only the height: with ui scale 2 a 320×240 (4:3)iso-flag-pngfile renders at twice its proper width — e.g. 64×24 for a requested height of 24. Fixed by scaling the returned actor back to the logical size (a no-op at ui scale 1).The applet requests the flag at the logical icon size, so on HiDPI the image is half the intended size. Fixed by multiplying by
global.ui_scaleat both call sites (the menu path used to have this multiplication and lost it at some point).Verified live on a 3000×2000 laptop panel (ui scale 2): the panel flag went from a squashed 64×24 to a correct 4:3 image at the intended size; layouts menu flags likewise. At ui scale 1 both changes are no-ops.
🤖 Generated with Claude Code