Bug 446948 - Qt apps scaling breaks in multi-monitor setup with 90 degree rotation
Summary: Qt apps scaling breaks in multi-monitor setup with 90 degree rotation
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.23.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-13 20:47 UTC by Szymon Łągiewka
Modified: 2023-04-02 19:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screen arrangement (9.12 KB, image/png)
2021-12-13 20:47 UTC, Szymon Łągiewka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Łągiewka 2021-12-13 20:47:16 UTC
Created attachment 144521 [details]
Screen arrangement

SUMMARY
When a scaled display is on the right of another display that is rotated 90 degrees anticlockwise, moving Qt-based apps between them will eventually break scaling. 

See the attachment for the layout. Happens for both clockwise and anticlockwise. I've first thought that it might have something to do with the display's virtual "chin" being in the way (as is in the illustration), but this is not the case when rotated the other way.  

STEPS TO REPRODUCE
1. Get two displays
2. Rotate the display on the left 90 degrees (anti)clockwise 
3. Scale the display on the right to 200%
4. Open a Qt app on left (100% scale) display 
5. Move the app to the right screen
6. Move the app to the left screen
7. Move the app to the right screen

1. Get two displays
2. Rotate the display on the left 90 degrees (anti)clockwise 
3. Scale the display on the right to 200%
4. Open a Qt app on right (200% scale) display 
5. Move the app to the left screen
6. Move the app to the right screen

OBSERVED RESULT
After each set of steps the Qt app will not keep the scale (will be blurry).

EXPECTED RESULT
Flipping windows back and forth between screens for hours doesn't break scaling. Amazing. 

It's worth mentioning that this does not happen if the scaled display is on the left. I have already filed a bug regarding context menu (https://bugs.kde.org/show_bug.cgi?id=446563) which is subject to the same layout rules, but is reproducible _without_ any rotation. If one of the displays is scaled - things on the right display can break.

Tested with scaled display above and below - works. Only when on the right - this happens.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2+kde (KDE patches in main repos for some packages)

ADDITIONAL INFORMATION
This doesn't happen for non-Qt apps - Firefox, Electron (Ozone) and other Gtk apps (I've tested Gnome's Files / Nautilus) work just fine. 

I've no idea whether this is Qt or KWin issue. The fact that this happens only for certain screen arrangements makes me think this might be KWin as well.
Comment 1 Vlad Zahorodnii 2021-12-15 14:22:40 UTC
Looks like a Qt bug at quick glance. Can you run a Qt application with WAYLAND_DEBUG=1 environment variable and post the output here? Please avoid moving the window between screens back and forth too much, so parsing the debug log is easier.
Comment 2 Szymon Łągiewka 2021-12-15 15:20:12 UTC
Sure. The outputs from 2> in the snippet: https://invent.kde.org/-/snippets/2010

I've noticed that scaling doesn't break if I move the window directly to another screen via Move to Screen (from title bar).
Comment 3 Szymon Łągiewka 2022-12-05 14:35:56 UTC
From Nate's blog I heard about 

```
In the Plasma Wayland session, when you drag a window containing QtQuick-based user interface elements to another screen that’s using a different scale factor, the window instantly adjusts itself to display properly according to that screen’s scale factor, with no blurriness or pixelation. It even works when a window is partially on one screen and partially on another! (David Edmundson, Frameworks 5.101. Link 1 and link 2)
```

This seems like it's similar. I will test if (or when) I get the chance to update to 5.101.
Comment 4 Szymon Łągiewka 2023-04-02 19:51:31 UTC
I can no longer see the issue!
Comment 5 Szymon Łągiewka 2023-04-02 19:52:16 UTC
Closing ;)