Bug 424534 - Krita's window shown centered in display when scaled too big for the screen
Summary: Krita's window shown centered in display when scaled too big for the screen
Status: RESOLVED UPSTREAM
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.3.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-22 11:38 UTC by phrxmd
Modified: 2020-07-27 16:50 UTC (History)
3 users (show)

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


Attachments
Screenshot of Krita window upon launch (KWin window manager without titlebars) (335.15 KB, image/png)
2020-07-22 11:38 UTC, phrxmd
Details
Screenshot from AppImage. (334.78 KB, image/png)
2020-07-22 18:06 UTC, phrxmd
Details
Krita from AppImage and from distro side by side (1.51 MB, image/png)
2020-07-22 18:36 UTC, phrxmd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description phrxmd 2020-07-22 11:38:27 UTC
Created attachment 130315 [details]
Screenshot of Krita window upon launch (KWin window manager without titlebars)

SUMMARY
On Linux system with X11, HiDPI screen and global scaling 200% set in KDE, UI elements are misplaced upon startup. 

System is a Thinkpad X1 Yoga R3, screen resolution 2560x1440. 

STEPS TO REPRODUCE
1. Launch Krita with HiDPI screen.

OBSERVED RESULT
Bad placement of toolbars, window content is too large, as if window extends beyond the top of the screen (see screenshot of window).

EXPECTED RESULT
Toolbar placement and window content scaling adjusted to window size. 

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20200717
KDE Plasma Version: 5.19.3
KDE Frameworks Version: 5.72.0
Qt Version: 5.15.0
Kernel Version: 5.7.7-1-default
OS Type: 64-bit

ADDITIONAL INFORMATION

Global scaling set to 200%, QT scaling environment variables set as follows:

$ env | grep QT
PLASMA_USE_QT_SCALING=1
QT4_IM_MODULE=xim
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_IM_MODULE=ibus
QT_IM_SWITCHER=imsw-multi
QT_SCREEN_SCALE_FACTORS=eDP-1=2;DP-1=2;HDMI-1=2;DP-2=2;HDMI-2=2;
Comment 1 Tiar 2020-07-22 11:44:52 UTC
Can you please check what happens if you open the appimage instead? (Download from the website krita.org).
Comment 2 Halla Rempt 2020-07-22 11:47:53 UTC
I'm sorry, but there's nothing we can do about this. We don't control the way Qt and kwin handle display scaling. You can switch support for display scaling off in Krita, but that's it.

You didn't mention whether you are using a flatpak, a distribution package or our  appimages, but that might make a difference as well, since the appimage is 5.12, but the distribution packages or flatpaks likely use a newer version of Qt, with new display scaling bugs.
Comment 3 phrxmd 2020-07-22 18:06:02 UTC
Created attachment 130320 [details]
Screenshot from AppImage.

The initial screenshot is from the version from the distro repositories (OpenSUSE Tumbleweed). I downloaded the AppImage instead, here's a screenshot from the AppImage. As you can see, the placement is correct.
Comment 4 phrxmd 2020-07-22 18:36:06 UTC
Created attachment 130322 [details]
Krita from AppImage and from distro side by side

Here the Krita windows from the AppImage (left) and from the OpenSUSE repositories (right) are side by side.

As you can see, the scaling of the window is the same. So this is not a HiDPI issue per se.

The right window (from the distro repositories) apparently has a size hint that prevents from resizing vertically. As a result, it is higher than the screen; what looked like bad scaling is actually KWin placing it at negative Y (on the screenshot the coordinates are reported as +1408,-184 (563x812). When I disable tiling and move the window manually, I can move the upper part of the window into view; however as I cannot resize it vertically, the lower part then becomes inaccessible.

The AppImage version has none of these issues.
Comment 5 Bug Janitor Service 2020-07-23 04:33:11 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 6 Nate Graham 2020-07-23 18:34:29 UTC
(In reply to Boudewijn Rempt from comment #2)
> I'm sorry, but there's nothing we can do about this. We don't control the
> way Qt and kwin handle display scaling. You can switch support for display
> scaling off in Krita, but that's it.
Hmm, can you clarify this statement? Turning off scaling is not a feasible option because then everything else in the system will be too small. Does Krita not support Qt scaling? If not, you can disable high dpi scaling yourself for just Krita and do whatever custom thing you need, which includes setting an appropriate default window size. But it would be nice to formally support Qt scaling like other KDE apps do.
Comment 7 Halla Rempt 2020-07-24 09:06:16 UTC
Krita supports Qt's display scaling, but Qt's display scaling is in a pretty bad state _and_ is getting worse. Which is why the appimage, which uses Qt 5.12 is okay, and the distribution packages with Qt 5.15 is not okay. Inside Krita, you can turn off support for display scaling, so Krita won't scale, independent of any other settings, but that's all we can do.
Comment 8 Nate Graham 2020-07-24 13:33:39 UTC
If it doesn't work for Krita, wouldn't it make sense to do that automatically rather than making the user figure out how to do this.

I assume the problems you're facing are tracked with Qt bug reports? Qt scaling seems to work out all right for other KDE apps I use.
Comment 9 Halla Rempt 2020-07-24 13:56:32 UTC
The option is necessary on Windows, where fractional scaling doesn't work. On 1920x1080 screens, Windows by default has 150% scaling, which Qt turns into 200%, which makes everything too big. I know that newer versions of Qt are supposed to have fractional scaling, but even in 5.15 that's broken. (And no, I haven't reported a bug for every problem, since that requires a small example that shows the issue, and I don't have those.)


Anyway, when it comes to this bug report, I had missed the side-by-side screenshot.

If I look at that screenshot, it looks like the distribution version of Krita is high enough that the titlebar and the menubar are pushed off-screen. Almost as if the window manager places the window centered. But even if I start Krita with a QT_SCALE_FACTOR=4, I don't see that happening on my NEON system. The window might be too big to be completely mapped, but it's always placed correctly.
Comment 10 phrxmd 2020-07-24 15:42:07 UTC
What happens is that the window from the distribution version with Qt 5.15 cannot be resized vertically, while the window from the AppImage with Qt5.12 can.
Comment 11 Tiar 2020-07-27 16:49:36 UTC
@Nate you can turn off UI scaling for just Krita in Configure Krita -> General -> Window -> Enable HiDPI.

@Philipp - can you please attach the output from Help -> Show system information for bug reports? It will give us detailed information about your displays and how Krita reads them. 

Also can you please check if Krita works better if you turn off UI scaling like I wrote above? (You can turn it off in an appimage and it will work for the other version too). 

Another thing I would try is switching Krita to `fusion` style (the one in the appimage) - you can do it via GUI in Settings -> Styles -> Fusion, or when opening Krita from console: 

> KRITA_NO_STYLE_OVERRIDE="yes" /path/to/krita -style=fusion

Another, a bit wild guess would be to go to Window -> Workspace -> and select Default. It does fix it on my system when I have incorrect workspaces or whatever and the window doesn't really work the way it's supposed to. If you cannot reach the main menu, try to use alt+drag to move the window.

In any case, I'm not sure if we can help much - we provide appimages exactly for that reason, because from our experience the available Qt versions right now have a bit buggy behaviour in various areas like tablet support, drag&drop etc. Appimage has the most "stable" for Krita version of Qt and multiple of our patches. (All patches were submitted upstream, of course, but they were applied to different versions of Qt).