Skip to content

keyboard: fix flag icons being half-size and squashed on HiDPI - #13951

Open
rumours86 wants to merge 1 commit into
linuxmint:masterfrom
rumours86:keyboard-flag-hidpi
Open

keyboard: fix flag icons being half-size and squashed on HiDPI#13951
rumours86 wants to merge 1 commit into
linuxmint:masterfrom
rumours86:keyboard-flag-hidpi

Conversation

@rumours86

Copy link
Copy Markdown

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:

  1. St.TextureCache.load_image_from_file_async() returns an actor pre-scaled by the ui scale. SubscriptableFlagIcon puts it into its St.Bin without correcting the size, so the bin clamps only the height: with ui scale 2 a 320×240 (4:3) iso-flag-png file 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).

  2. 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_scale at 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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant