Bug 137924 - [KF5] UI not scaled correctly on HIDPI Wayland/KDE screens
Summary: [KF5] UI not scaled correctly on HIDPI Wayland/KDE screens
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.0.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 142882 (view as bug list)
Depends on:
Blocks: HiDPI Wayland KDE
  Show dependency treegraph
 
Reported: 2020-11-02 05:02 UTC by David Gow
Modified: 2021-07-25 05:17 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Gow 2020-11-02 05:02:30 UTC
Description:
When running any LibreOffice application under a KDE Wayland session (specifically, the "Plasma (Full Wayland)" session under OpenSUSE Tumbleweed), on a HiDPI display, the UI elements (buttons, etc) are not scaled, appearing tiny.

The layout of most windows (dialog boxes, etc), including the main windows of the various applications (Writer, Impress, etc) only use the top-left quarter of the window (when 2× scaling is enabled for the display in KDE), though resizeable windows will usually correctly use the whole window area if it's resized. Note that the mouse cursor still interacts correctly with these controls, so it seems to be a layout problem rather than a rendering problem.

Note that the menu bar is scaled correctly — presumably it's handled differently.

The "gtk3" VCL plugin seems to work fine. This issue seems to have only appeared when Bug 127687 was fixed (beforehand, everything was blurry and pixelated: I think KWin was scaling the window). I haven't actually tried to bisect, though, so take that with a grain of salt.

Steps to Reproduce:
Start any LibreOffice application under a KDE Wayland session, (with QT_QPA_PLATFORM=wayland and SAL_USE_VCLPLUGIN=kf5, both of which should be defaults).

Actual Results:
The controls in windows are tiny, and may be squeezed into the top-left-hand corner of the window.

See screenshots:
https://davidgow.net/stuff/lowriter-recovery-hidpi-scale.png
https://davidgow.net/stuff/lowriter-totd-hidpi-scale.png
https://davidgow.net/stuff/lowriter-mainwin-hidpi-scale.png


Expected Results:
The controls in the UI are twice the width and twice the height.

Basically, it should look like this, but not blurry (this is running under XWayland, where a lower-resolution display is reported to the application, and the window manager scales the input/output):
https://davidgow.net/stuff/lowriter-mainwin-x11-scale.png


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
This seems to have been happening since LibreOffice 7.0.

I've tried it with and without a new UserProfile and OpenGL enabled/disabled. The system in question is running OpenSUSE Tumbleweed (a rolling-release distro), with an Intel Integrated Graphics chipset. (This is a Dell XPS 13 9360 laptop.)

The output of "$ env | grep QT" is below, but changing these (except QT_QPA_PLATFORM) doesn't fix the issue:
QT_QPA_PLATFORM=wayland
PLASMA_USE_QT_SCALING=1
QT_WAYLAND_FORCE_DPI=96
QT_IM_MODULE=fcitx
QT_AUTO_SCREEN_SCALE_FACTOR=0
Comment 1 Michael Weghorn 2021-01-04 11:53:48 UTC
I can essentially reproduce small icons in Writer main win on a FullHD screen (1920x1080) by explicitly enabling scaling:

   QT_QPA_PLATFORM=wayland QT_SCALE_FACTOR=2 ./instdir/program/soffice.bin --writer

and icons are larger when using QT_QPA_PLATFORM=xcb instead.

I'm using an LO master build as of commit 211688521a983963adc9ca827eebd0e2435f2705 on Debian testing, which currently has Qt 5.15.2, Plasma 5.20, KWin 5.20.4.


I see all kinds of other issues in LibreOffice and other KDE apps with 'QT_QPA_PLATFORM=wayland QT_SCALE_FACTOR=2', like elements being wrongly arranged in Kate's save as dialog or LibreOffice dialogs, so I'm not sure whether all of the reported issues are actually a LO problem, or some lower levels (like Qt) might have issues as well - at least in my setup.
Comment 2 Buovjaga 2021-02-18 13:21:57 UTC
Confirmed with a Wayland session on a Lenovo ThinkPad T570
Comment 3 Marian Klein 2021-05-28 00:59:11 UTC
I am affected too. on HiDPI 4k screen wayland on laptop HP Spectre X360
Comment 4 Nate Graham 2021-05-28 01:39:23 UTC
@Michael

I have a true HiDPI screen and DE setup in KDE Plasma where everything generally works fine on Wayland (barring bugs like this, of course :) ), so I can track down for you which issues are only in seen in LO and which issues are quirks of a handmade testing setup. Gimmie a day or two...
Comment 5 Marian Klein 2021-05-28 22:26:36 UTC
Hi Michael.
I also can confirm xcb works better for me on wayland / kubuntu 21.04

QT_QPA_PLATFORM=xcb QT_SCALE_FACTOR=1  libreoffice --calc

Is quite usable setup on HiDPi/4k wayland ,although the fonts are not as sharp as they could be.  I use SCALE 200% in system settings /display configuration. 
Thank you for bringing env var QT_QPA_PLATFORM to the attention.
Comment 6 David Gow 2021-05-30 09:19:00 UTC
I can confirm that this is still happening for me, too.

I've been using the gtk3 backend, which does work properly with HiDPI screens with KDE/wayland:

$ SAL_USE_VCLPLUGIN=gtk3 lowriter

However, using the xcb backend as Marian suggested also works, albeit appearing a bit blurrier:

$ QT_QPA_PLATFORM=xcb QT_SCALE_FACTOR=1 lowriter

Both of these are quite usable, but ideally the kf5 backend would work properly.

Like Nate, I'm not seeing any similar issues in other Qt apps, so this appears to be LibreOffice specific.
Comment 7 Michael Weghorn 2021-06-23 10:40:24 UTC
(In reply to Nate Graham from comment #4)
> @Michael
> 
> I have a true HiDPI screen and DE setup in KDE Plasma where everything
> generally works fine on Wayland (barring bugs like this, of course :) ), so
> I can track down for you which issues are only in seen in LO and which
> issues are quirks of a handmade testing setup. Gimmie a day or two...

@Nate: Thanks for the offer! Unless anybody else takes a look earlier (which would be highly appreciated), I hope I'll find some time to take a look at those issues at some point in time, but can't really say when I'll be able to do so.

(In reply to David Gow from comment #6)
> Like Nate, I'm not seeing any similar issues in other Qt apps, so this
> appears to be LibreOffice specific.

That's well possible. I'm on Debian testing which doesn't have the latest Plasma/KF5 versions and it's just not fun using Plasma Wayland there so far,  since very basic things don't work (reliably). (I have plasma-desktop 4:5.20.5-4, libqt5core5a:amd64 5.15.2+dfsg-7, libgtk-3-0:amd64 3.24.24-4).
Comment 8 Doug 2021-07-25 05:17:36 UTC
*** Bug 142882 has been marked as a duplicate of this bug. ***