telegramdesktop / tdesktop

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

Phuzzy telegram window #27258

Closed YousefSaber closed 8 months ago

YousefSaber commented 9 months ago

Steps to reproduce

In the latest version of Telegram, the window and all of its text are very phuzzy and pixelated despite my monitor being 3200 * 2000

Expected behaviour

That Telegram will be rendered in the same resolution as my monitor

Actual behaviour

A phuzzy window appears

Operating system

Fedora 39

Version of Telegram Desktop

4.13

image

ilya-fedin commented 9 months ago

Provide logs as asked by the issue template

yaslama commented 8 months ago

@YousefSaber Can you try to go to Settings->Advanced->Experimental Settings, then enable "Enable precise High DPI Scaling"?

YousefSaber commented 8 months ago

@yaslama it fixed the issue thanks

image

YousefSaber commented 8 months ago

here's the log files without debug mode enabled @ilya-fedin log.txt

ilya-fedin commented 8 months ago

@YousefSaber thanks, can you enable debug mode and find screen resolution from Telegram POV in the logs from the DebugLogs subfolder? It should be on the lines containing Window Pos.

ilya-fedin commented 8 months ago

Uploading DebugLogs subfolder entirely is not a good idea, tcp and mtp logs contain dumps of entire tdesktop network data so anyone can steal your session.

ilya-fedin commented 8 months ago

Can you disable xdg-output fractional scaling and get new Window Pos?

YousefSaber commented 8 months ago

@ilya-fedin filtered the debug logs to show only Window Pos

josephsaber@172-1-20-21:~/.local/share/TelegramDesktop/DebugLogs$ grep "Window Pos" *
log_15_00.txt:[15:08:50.515 00-0000685] Window Pos: Initializing first 0, 24, 1600, 944 (scale 100%, maximized 1) (core_settings.cpp : 25)
log_15_00.txt:[15:08:50.515 00-0000686] Window Pos: Screen found, screen geometry: 0, 0, 3200, 2000, available: 0, 0, 3200, 2000 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.515 00-0000687] Window Pos: Window frame margins: 0, 24, 0, 0, available space for inner geometry: 0, 24, 3200, 1976 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.515 00-0000688] Window Pos: Resulting geometry is 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.515 00-0000689] Window Pos: Setting first 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.586 00-0000788] Window Pos: First show, setting maximized. (mainwindow.cpp : 25)
log_15_00.txt:[15:08:50.587 00-0000791] Window Pos: Saving non-maximized position: 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.587 00-0000792] Window Pos: Screen found, geometry: 0, 0, 3200, 2000 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.587 00-0000793] Window Pos: Writing: 0, 24, 1600, 944 (scale 100%, maximized [FALSE]) (main_window.cpp : 25)
log_15_00.txt:[15:08:50.587 00-0000794] Window Pos: Saving non-maximized position: 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.587 00-0000795] Window Pos: Screen found, geometry: 0, 0, 3200, 2000 (main_window.cpp : 25)
log_15_00.txt:[15:08:50.715 00-0000882] Window Pos: Saving maximized position. (main_window.cpp : 25)
log_15_00.txt:[15:08:50.715 00-0000883] Window Pos: Writing: 0, 24, 1600, 944 (scale 100%, maximized [TRUE]) (main_window.cpp : 25)
log_15_00.txt:[15:08:50.715 00-0000884] Window Pos: Saving maximized position. (main_window.cpp : 25)
log_15_00.txt:[15:08:51.765 00-0001014] Window Pos: Writing to storage 0, 24, 1600, 944 (scale 100%, maximized 1) (core_settings.cpp : 25)
log_15_00.txt:[15:08:51.777 00-0001016] Window Pos: Saving maximized position. (main

This is with HighDPI disabled

ilya-fedin commented 8 months ago

Precise highdpi doesn't really matter, xdg-output matters

YousefSaber commented 8 months ago

@ilya-fedin disabling xdg-output fractional scaling seems to solve the problem

josephsaber@172-1-20-21:~/.local/share/TelegramDesktop/DebugLogs$ grep "Window Pos" *
log_15_00.txt:[15:12:10.152 00-0000685] Window Pos: Initializing first 0, 24, 1600, 944 (scale 100%, maximized 1) (core_settings.cpp : 25)
log_15_00.txt:[15:12:10.152 00-0000686] Window Pos: Screen found, screen geometry: 0, 0, 3200, 2000, available: 0, 0, 3200, 2000 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.152 00-0000687] Window Pos: Window frame margins: 0, 24, 0, 0, available space for inner geometry: 0, 24, 3200, 1976 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.152 00-0000688] Window Pos: Resulting geometry is 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.152 00-0000689] Window Pos: Setting first 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.222 00-0000788] Window Pos: First show, setting maximized. (mainwindow.cpp : 25)
log_15_00.txt:[15:12:10.225 00-0000791] Window Pos: Saving non-maximized position: 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.225 00-0000792] Window Pos: Screen found, geometry: 0, 0, 3200, 2000 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.225 00-0000793] Window Pos: Writing: 0, 24, 1600, 944 (scale 100%, maximized [FALSE]) (main_window.cpp : 25)
log_15_00.txt:[15:12:10.225 00-0000794] Window Pos: Saving non-maximized position: 0, 24, 1600, 944 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.225 00-0000795] Window Pos: Screen found, geometry: 0, 0, 3200, 2000 (main_window.cpp : 25)
log_15_00.txt:[15:12:10.491 00-0000896] Window Pos: Saving maximized position. (main_window.cpp : 25)
log_15_00.txt:[15:12:10.491 00-0000897] Window Pos: Writing: 0, 24, 1600, 944 (scale 100%, maximized [TRUE]) (main_window.cpp : 25)
log_15_00.txt:[15:12:10.491 00-0000898] Window Pos: Saving maximized position. (main_window.cpp : 25)
log_15_00.txt:[15:12:11.441 00-0000945] Window Pos: Writing to storage 0, 24, 1600, 944 (scale 100%, maximized 1) (core_settings.cpp : 25)
log_15_00.txt:[15:12:11.476 00-0000947] Window Pos: Saving maximized position. (main_window.cpp : 25)
log_15_00.txt:[15:12:15.856 00-0002337] Window Pos: Window was maximized before hidding, setting maximized. (main_window.cpp : 25)
ilya-fedin commented 8 months ago

Still 3200x2000, wtf...

ilya-fedin commented 8 months ago

Can you run tdesktop with WAYLAND_DEBUG=1, redirect the output into a file and upload it? Using settings that trigger the bug of course.

sergiorussia commented 8 months ago

+1, ubuntu 22.04 lts, wayland. broken with latest update. my env laptop's built-in display 1920x1080, 100% scale external display 3840x2160, 200% scale when i plug in external display, tg becomes blurry. plug out - crisp

disabling xdg-output fractional scaling helps.

attaching output with WAYLAND_DEBUG=1 and xdg-output fractional scaling turned on, when the bug reproduces: tg.txt

and with scaling turned off, when the bug does not reproduce: tg.txt

ilya-fedin commented 8 months ago

@YousefSaber do you have multiple monitors as well?

sergiorussia commented 8 months ago

just to clarify, my setup is with "single display" set in settings, not "mirror" or "join displays"

ilya-fedin commented 8 months ago

just to clarify, my setup is with "single display" set in settings, not "mirror" or "join displays"

You mean second display is disabled?

ilya-fedin commented 8 months ago

@sergiorussia I reproduced your issue. Although I'm not sure your issue is the same as of the initial reporter, I need additional info from @YousefSaber.

@YousefSaber what's your display scaling? I was assuming it's 100% given that's what logged and you haven't mentioned that the log/settings scale number is wrong.

yaslama commented 8 months ago

@ilya-fedin In my case, I have an external monitor connected to laptop (the internal screen is disabled) using gnome/wayland using 200% scale. When enabling xdg-output fractional scaling, tg shows 100% scale and everything is blurry. When disabling it, tg is crisp and the scale in tg is shown as 200%

ilya-fedin commented 8 months ago

I need answer from @YousefSaber in order to know whether to close the issue or whether you folks should move to a new issue

sergiorussia commented 8 months ago

just to clarify, my setup is with "single display" set in settings, not "mirror" or "join displays"

You mean second display is disabled?

yes, only one active at a time

YousefSaber commented 8 months ago

@ilya-fedin my monitor is 3200 x 2000 The scaling is 200% only the monitor of my laptop

as for WAYLAND_DEBUG I don't know how to run Telegram desktop with it, with command line or settings I don't know the wiki doesn't show anything about running telegram with WAYLAND_DEBUG=1

ilya-fedin commented 8 months ago

The scaling is 200%

That explains the bluriness, tdesktop thinks your scale is 100%

parametalol commented 8 months ago

Hey, The text is fine now, thanks. The icon and some interface elements (most buttons, cursor, but not triggers in the experimental settings) are still in low resolution. That's with or without the hi-dpi option, 200% Gnome zoom, fractional scaling disabled. image FYI @ilya-fedin

ilya-fedin commented 8 months ago

@0x656b694d provide log.txt

parametalol commented 8 months ago

Voila! log.txt

ilya-fedin commented 8 months ago

@0x656b694d it says your display has 100% scale

parametalol commented 8 months ago

image

ilya-fedin commented 8 months ago

idk, I can't reproduce anymore

parametalol commented 8 months ago

When I enable "Default Interface Scale", the value jumps to 200%. If I set it to 100% and restart, it jumps to 50%. The interface looks small and low-res, like if it were rendered to 50% and then scaled back. It seems that there are different methods for calculating the scale, and they're randomly used, producing mixed results.

ilya-fedin commented 8 months ago

It seems that there are different methods for calculating the scale, and they're randomly used, producing mixed results.

Yes, that's true, Telegram is a legacy application, has its own scaling engine and doesn't fully support the Qt scaling engine. In your case it seems the global device pixel ratio is 1 (deduced from biggest screen's device pixel ratio) but window device pixel ratio is 2 which is lilkely because GNOME implements the xdg-output protocol incorrectly when fractional scaling in system is disabled, providing values not divided by scale while the protocol mandates they must be divided by scale.

Telegram supports only the global one and only integer so it draws at 1 and Qt upscales to 2.

parametalol commented 8 months ago

I can confirm, that Telegram indeed looks fine at 200% Gnome scaling, iff partial scaling is enabled.

ilya-fedin commented 8 months ago

Yeah, someone should report to mutter that they implement xdg-output protocol incorrectly with the option disabled

dgutov commented 8 months ago

If someone does, please leave a link here: this wouldn't be the only application that behaves differently with fractional scaling enabled vs. disabled.

parametalol commented 8 months ago

Is it the one? https://gitlab.gnome.org/GNOME/mutter/-/issues/2631

ilya-fedin commented 8 months ago

Yes, it is.

ilya-fedin commented 8 months ago

Tried to work around it blindly, hope it works in 4.14.3

dgutov commented 8 months ago

It's definitely looking better here.