Bug 396990 - [Regression from Frameworks 5.47 -> 5.48] Dolphin icons are incorrectly aligned if display scaling is used
Summary: [Regression from Frameworks 5.47 -> 5.48] Dolphin icons are incorrectly align...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kiconthemes
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.48.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords:
: 397820 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-07-30 19:10 UTC by valdikss
Modified: 2019-03-13 19:49 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.57


Attachments
Screenshot (11.58 KB, image/png)
2018-07-30 19:10 UTC, valdikss
Details
Update history (30.97 KB, text/plain)
2018-07-30 19:10 UTC, valdikss
Details
Elisa music player with 1.7x scaling. (73.87 KB, image/png)
2018-10-13 11:17 UTC, Vladimír Vondruš
Details

Note You need to log in before you can comment on or make changes to this bug.
Description valdikss 2018-07-30 19:10:17 UTC
Created attachment 114224 [details]
Screenshot

Description of problem:

File and folder icons in Dolphin are incorrectly aligned if display scaling is used.


Version-Release number of selected component (if applicable):
Probably Fedora's update from kf5-plasma-5.47.0-1.fc28.x86_64 to 5.48.0-2.fc28.x86_64 caused this issue.
Please see the screenshot.


How reproducible:
Always


Steps to Reproduce:
1. Set display scaling to 1.5 using KDE display settings
2. Relogin
3. Open Dolphin
4. Enable icons view mode if another mode is selected, adjust size to 64 px

Actual results:
Folder and file icons are incorrectly aligned.

Expected results:
Folder and file icons are correctly aligned, as it was in previous version.

Additional info:
I don't know which kf5 package exactly caused the regression because I no longer can revert to older packages with dnf history undo.
Update history file is in next post.
The issue is also reproducible on KDE NEON Developer edition with Plasma 5.13.3 & Frameworks 5.48.0.
Comment 1 valdikss 2018-07-30 19:10:43 UTC
Created attachment 114225 [details]
Update history
Comment 2 Nate Graham 2018-07-30 19:27:42 UTC
Since this regression happened after updating Frameworks, it probably isn't in Dolphin itself. Moving to KIO for now since that's the likeliest culprit (though looking through the list of commits for KIO 5.48, nothing immediately pops out at me).
Comment 3 Patrick Silva 2018-08-01 20:35:33 UTC
I can confirm on Arch Linux using 1.2 as display scaling factor.
Bug 396536 is another regression.
Comment 4 Nate Graham 2018-08-24 21:24:59 UTC
*** Bug 397820 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2018-09-05 14:10:30 UTC
FWIW, I can no longer reproduce this with Dolphin and Frameworks from git master when using the display scaling system in System Settings. Can anyone reproduce this with everything from git master, such as with Neon Dev unstable?
Comment 6 Nate Graham 2018-09-06 03:01:13 UTC
Never mind, can still confirm. Seems like it's dependent on the exact number: at 1.5x, I don't see the issue, but at 1.3x or 1.7x, I do.
Comment 7 Vladimír Vondruš 2018-10-13 11:17:45 UTC
Created attachment 115621 [details]
Elisa music player with 1.7x scaling.

Hi everyone! Here's some more details that should be hopefully enough to help you track down the problem:

I have a laptop with a 4K screen (and now an external 4K monitor) and was trying to track this down since I upgraded from 5.47, as the scaling is *seriously* broken on higher scales. Googling for this showed absolutely nothing. Desperate, I even created a new account to report this, but then this bug popped up.

I have a scaling factor of 2.4x on the laptop and 1.7x on the external monitor. The scaling is broken seemingly in a totally random way (a different set of icons is broken on 1.7x and on 1.8x). This affects all apps, not just Dolphin: KDevelop, Akregator, KWrite, Elisa, ... See the attachment for how Elisa looks on 1.7x (it's way worse on 2.4x).

Try to scale folder icons in Dolphin using ctrl-wheel with one of the above scales: the icons are misplaced in most cases but in some they jump to a correct size and alignment. Similar is in Elisa in the "minimal mode" (where the cover art fills the whole window) -- resize the window and see how randomly the cover art jumps around.

At first I suspected it has something to do with Qt because it's seemingly affecting all Qt-based apps I use, but today I managed to track it down to `kiconthemes` (so *not* kio): downgrading that package to 5.47 (I'm on Arch) makes everything usable again. Looking around, there isn't many commits in this particular project and I have a high suspicion this is the root of all evil: https://github.com/KDE/kiconthemes/commit/20f7137145f6b6fb38d2c3dd01a8443b8315cf41

Found also this with more screenshots (seriously, why there aren't more people hitting this?) -- if someone has an account there, could you mention this bug there? The suggested solution with xorg.conf solved absolutely nothing for me. https://forum.manjaro.org/t/some-icon-sizes-seem-broken/58522/6

Btw., Nate, thanks for your hard work. Your Sunday blog posts are always a happy read :)
Comment 8 Nate Graham 2018-10-13 20:50:13 UTC
You're very welcome, and thanks for the investigation, Vladimir. I can confirm it, and reverting 20f7137145f6b6fb38d2c3dd01a8443b8315cf41 fixes the issue for me.

Kai, could you take a look? You can trivially reproduce the issue by running `QT_SCALE_FACTOR=1.3 dolphin`. With 20f7137145f6b6fb38d2c3dd01a8443b8315cf41, the icons are broken; without it, they're fine.
Comment 9 Nate Graham 2018-10-17 23:22:53 UTC
I can no longer reproduce this issue with git master when doing `QT_SCALE_FACTOR=[anything] dolphin` or using the KScreen KCM's scaling UI. Icons now look correct at all scale factors for me. Is anyone else still able to reproduce this with KDE Frameworks 5.51 and/or git master?
Comment 10 Alexander Mentyu 2018-10-18 07:28:41 UTC
I can reproduce this bug in

Default Dolphin view settings, FHD screen
Operating System: KDE neon Developer Edition
KDE Plasma Version: 5.14.80
Qt Version: 5.11.1
KDE Frameworks Version: 5.52.0
Comment 11 Kai Uwe Broulik 2018-10-18 08:08:55 UTC
Please give this patch a try: https://phabricator.kde.org/D16291
Comment 12 Kai Uwe Broulik 2018-10-18 08:42:22 UTC
Git commit 2699d36365fabb7be56a5d6d8a3ef3867eac7605 by Kai Uwe Broulik.
Committed on 18/10/2018 at 08:41.
Pushed by broulik into branch 'master'.

Center icons properly if size doesn't fit

When requesting an icon size that cannot be served, the pixmap is centered in the requested size.
By using the original pixmap's device pixel ratio we ensure the padded pixmap is painted correctly.

Differential Revision: https://phabricator.kde.org/D16291

M  +2    -2    src/kiconengine.cpp

https://commits.kde.org/kiconthemes/2699d36365fabb7be56a5d6d8a3ef3867eac7605
Comment 13 Vladimír Vondruš 2019-02-20 09:50:06 UTC
Hi again, I just updated to 5.55 (after being pinned to kiconthemes 5.47 since my last comment) and I'm sorry to say this, but it still doesn't happen to be fully fixed compared to 5.47. While the issue disappeared from almost all apps I use (KDevelop, Akregator, Kate works well), it's still present in Dolphin (file icons when you scale them all the way down) and Elisa play/pause/... controls (but not the Albums / Artists / ... icons). The bug presents itself similarly as before -- a weirdly scaled down version in the bottom right corner. I rebuilt Elisa from Git just to be sure, but that didn't help. Reverting again back to kiconthemes 5.47 helped, tho.

Is there something special these two apps do, compared to others?

To help you reproduce, my desktop scaling is 1.7x.
Comment 14 Nate Graham 2019-02-20 16:47:03 UTC
Hmm, I cannot reproduce your problem with Dolphin or Elisa when using a 1.7x systemwide scale factor.
Comment 15 Vladimír Vondruš 2019-02-21 10:56:27 UTC
I did `rm ~/.cache/icon-cache.kcache` as suggested on https://www.reddit.com/r/kde/comments/9wsnk4/how_to_delete_the_icons_cache/, then restarted Dolphin and that *seemingly* fixed it. It partially fixed it for Elisa (the left panel icons), but the play/pause/... icons stayed broken the same way as before. I cycled through this a few times, but nothing changed. (I can post another screenshot, if that helps in any way, but I think you have the idea.)

Finally I rebooted the system and removed the icon cache even before logging in to KDE, thinking that some background process was still responsible for overwriting the cache with broken versions. After login both Dolphin and Elisa were back to the old broken state. Now, no matter how much I `rm` the cache, nothing changes.

I have no idea about what's all involved in this, but my suspicion is that there's some background process caching unscaled icons (without taking the 1.7x scaling into account), and then the apps pick them up from the cache without realizing they're not the correct scale. Is there something I can do to debug this further?

(Probably unrelated to this, but context menus on my Plasma desktop are not respecting the system-wide scaling, having proper text size but the icons and padding like on a 1x scaling. I was not able to convince it to follow system-wide scaling. Could Plasma be responsible for putting these unscaled icons into cache?)
Comment 16 Nate Graham 2019-02-21 14:26:54 UTC
(In reply to Vladimír Vondruš from comment #15)
> I did `rm ~/.cache/icon-cache.kcache` as suggested on
> https://www.reddit.com/r/kde/comments/9wsnk4/how_to_delete_the_icons_cache/,
> then restarted Dolphin and that *seemingly* fixed it.
That's Bug 403229.


> Finally I rebooted the system and removed the icon cache even before logging
> in to KDE, thinking that some background process was still responsible for
> overwriting the cache with broken versions. After login both Dolphin and
> Elisa were back to the old broken state. Now, no matter how much I `rm` the
> cache, nothing changes.
> 
> I have no idea about what's all involved in this, but my suspicion is that
> there's some background process caching unscaled icons (without taking the
> 1.7x scaling into account), and then the apps pick them up from the cache
> without realizing they're not the correct scale. Is there something I can do
> to debug this further?
Probably, but I'm afraid you've reached the limit of my knowledge here. Hopefully another developer will chime in with more information.


> (Probably unrelated to this, but context menus on my Plasma desktop are not
> respecting the system-wide scaling, having proper text size but the icons
> and padding like on a 1x scaling. I was not able to convince it to follow
> system-wide scaling. Could Plasma be responsible for putting these unscaled
> icons into cache?)
That's a separate issue: Bug 356446.
Comment 17 Kai Uwe Broulik 2019-03-13 11:20:56 UTC
Git commit 89344923c00b7bc502f5c24be50027b457d82177 by Kai Uwe Broulik.
Committed on 13/03/2019 at 11:20.
Pushed by broulik into branch 'master'.

Fix padding icon that doesn't exactly match the requested size

The size we get already takes into account scaling, so we end up creating a pixmap
whose size was scaled twice and then had the view scale it down again.

Reviewed-By: Marco Martin
Related: bug 397106

M  +1    -1    src/kiconengine.cpp

https://commits.kde.org/kiconthemes/89344923c00b7bc502f5c24be50027b457d82177
Comment 18 Nate Graham 2019-03-13 15:55:38 UTC
This is now fully fixed for me as of that commit (which will be in KDE Frameworks 5.57). Can folks who can test from source code verify?
Comment 19 Vladimír Vondruš 2019-03-13 17:05:58 UTC
Yes, thanks a lot for the last commit! It looked related to the last remaining issues I described above and so I and tried to apply it right away on the stable kiconthemes 5.56. Both Dolphin and Elisa are now working perfectly with it (and, conversely, are reproducibly broken with vanilla 5.56).

I'm not sure if this points to some other issue (why would only Dolphin and Elisa be affected like that, are they using some icons in an unsupported way?), but nevertheless it's fixed now with this commit. Thanks a lot again.
Comment 20 Christoph Feck 2019-03-13 19:49:30 UTC
Regarding Dolphin, it uses custom pixmaps to colorize the icons for the selection effect. Using scaling factors affects such code.