Skip to content
Commit 4edb830f authored by Nate Graham's avatar Nate Graham
Browse files

Fix Units::roundToIconSize() returning incorrect sizes with non-Qt scaling

When not using Qt Scaling (testable by using the Wayland session or
setting `PLASMA_USE_QT_SCALING=1` on X11), all pixel sizes are unscaled.
E.g. a 22x22 SmallMedium icon must be expressed as 44x44 to Plasma,
because it is not aware of Qt's scaling.

The `Units::roundToIconSize()` function was failing to do this, thus
returning incorrectly small icon sizes. For example you would ask it
for the correct icon for a 44px physical area, expecting a SmallMedium
icon--but internally the function would would find that 44 is lower than
48 (unscaled Large size), and give you the next smallest size, which
is Medium. Unscaled Medium is 32px, which is equivalent to a 16px scaled
icon. So you would get a Small icon when you expected a SmallMedium one.

Due to quirks of how the icon sizes increase at the larger end, correct
results were accidentally returned for larger icon sizes. However small
and smallMedium icons were always incorrectly getting the next smallest
size instead, most commonly manifesting as ToolButtons and System Tray
icons being too small.

This commit fixes the problem by scaling all of the icon sizes
internally both for the purposes of comparison and returning a final
value--but only when not using Qt scaling.

BUG: 390147
BUG: 381794
FIXED-IN: 5.85
parent 71c8f7e2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment