telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.28k stars 5.22k forks source link

HiDPI Scaling #26155

Closed nullptroma closed 1 year ago

nullptroma commented 1 year ago

Steps to reproduce

1) Install KDE Plasma with common monitor 2)Launch tg 3) Change monitor to HiDPI (27', 2K) 4) Enable system scaling 125% 5)Launch tg

Expected behaviour

Proportional enlargement of the window and all its elements without loss of quality

Actual behaviour

Window enlargement, as it should be. The text has not lost quality. All pictures, photos and icons are in very poor quality, pixelated and blurry. Screenshot: https://i.imgur.com/n9IWjO9.png

It seems to work as it should sometimes when I experiment with environment variables (I never noticed a pattern). Now I deleted all references to Telegram in the system, ran the app from the official site and it worked. Then I restarted the pc and it blurred again.

Sources: From snap works perfectly. From all other sources (aur, pacman, official website) it does not work correctly.

Operating system

ArchLinux, KDE Plasma (more in logs)

Version of Telegram Desktop

4.7.1-1

Installation source

Static binary from official website

Crash ID

No response

Logs

Operating System: Arch Linux 
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.2.10-lqx1-2-lqx (64-bit)
Graphics Platform: X11
Processors: 16 × 11th Gen Intel® Core™ i7-11700F @ 2.50GHz
Memory: 15.5 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: B560M AORUS ELITE
ilya-fedin commented 1 year ago

Static binary from official website

I'm highly doubt this is true, the bug on the screenshot is known to happen only on third-party builds. It's a KDE bug (sadly still no one reported it to them, see #25126 for details), but all official builds have a Qt patch applied to avoid this bug.

nullptroma commented 1 year ago

Unfortunately right now I have tried all sources, and on Xorg this problem is everywhere. What could be wrong with my system that is not working for me?

ilya-fedin commented 1 year ago

Try to reset experimental settings while using official binary

nullptroma commented 1 year ago

How?

ilya-fedin commented 1 year ago

By pressing the reset settings button in the experimental settings menu

nullptroma commented 1 year ago

I didn't notice the button) Now I pressed it, the application restarted, nothing has changed. By the way, the experimental setting "Enable precise Hi-DPI Scaling" does not affect anything.

UDP: The reset button appears only after the settings have been changed. Since I didn't change anything, there was no button

ilya-fedin commented 1 year ago

Are you sure you have done this using the official build, not the Arch Linux's build?

ilya-fedin commented 1 year ago

The thing is KDE forces the precise scaling bypassing Telegram logic by using Qt's debugging API. That's why only Qt patching helps (by patching out the API).

nullptroma commented 1 year ago

Are you sure you have done this using the official build, not the Arch Linux's build?

I downloaded the linux archive from this site https://desktop.telegram.org/, unzipped it and ran it through the console ./Telegram

nullptroma commented 1 year ago

Miss click*

ilya-fedin commented 1 year ago

and ran it through the console ./Telegram

Does it immediately return you to the shell prompt? If yes, it means the application haven't launched, only focused the window of already running instance (which is probably the Arch Linux build).

nullptroma commented 1 year ago

and ran it through the console ./Telegram

Does it immediately return you to the shell prompt? If yes, it means the application haven't launched, only focused the window of already running instance (which is probably the Arch Linux build).

Before that, if I have another Telegram running from any source I right click on the tray icon and "Exit". When launching through the console, as I showed above, I do not get control back in the console, that is, everything works as it should, the application is launched from the console.

Another interesting fact: Everything works fine on Wayland

ilya-fedin commented 1 year ago

Another interesting fact: Everything works fine on Wayland

Well yes, KDE doesn't force precise scaling on Wayland fortunately (but it still does weird thing with other Qt debug variables).

I'm not sure what really happens, would like to see the log.txt (issue template describes how to get it).

nullptroma commented 1 year ago

log.txt

ilya-fedin commented 1 year ago

QT_SCALE_FACTOR_ROUNDING_POLICY: PassThrough :cry:

ilya-fedin commented 1 year ago

Maybe you have set it manually? I've never seen this variable set on KDE.

nullptroma commented 1 year ago

It's really about this variable! I removed it manually and checked, now Telegram looks right. Thanks so much, I'll try to find where I have it set!

nullptroma commented 1 year ago

I still haven't found where I set this variable. I want to remove it completely, any idea where it might be?

ilya-fedin commented 1 year ago

Maybe you're using a non-standard display manager and it sets the variable?

nullptroma commented 1 year ago

I got deepin packages from somewhere that change QT's behavior. I had to remove the packages in the screenshot 2023-04-11_19-43