hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.55k stars 821 forks source link

[Glitches] Hyprland doesn't play well with Telegram Desktop (or QT?) #839

Open ghost opened 1 year ago

ghost commented 1 year ago

I've checked if this is Telegram Desktop's fault or if this happens only with Hyprland/Wayland sessions. But seems like it's not happening on Sway.

I thought it was an animation bug, but by disabling them it looks like that the bugs becomes even more persisting. At the moment, the only way to get back to the normal window state is by changing workspace or switching to full-screen. Looks like this is a bug present even on qterminal, so it may be an issue that affects some QT programs.

How to reproduce

Reproducing differentiates between applications, but in the case of Telegram:

Infos

Screenshot

Logs

log.txt

vaxerski commented 1 year ago

dunno, I've heard telegram does this but have never experienced this on any of the apps I use

freundTech commented 1 year ago

I can reproduce this issue and maybe give a bit more information:

When you open media in Telegram it doesn't just display it in the existing window. Instead it opens it in a new fullscreen window with semi-transparent background (Hyperland doesn't render the windows behind this semi-transparent fullscreen window, but that's another topic). After closing the media viewer Telegram becomes stretched.

What seems to be happening is that the fullscreen windows still take up space in the dwindle tree (which usually makes sense, because it returns there when un-fullscreened), taking space from the Telegram main window. When closing the media viewer Telegram expands again to take the size previously occupied by the media viewer. However something seems to not get notified correctly about that. Telegram keeps rendering at the size it had while the media viewer was open and is stretched to fill the full size.

In my case both resizing the Telegram window manually and even just switching focus to another window make Telegram update its size and render correctly again. Clicking and scrolling inside telegram don't make it update it's size.

socket2 logs the following when opening and closing the media viewer:

activewindow>>org.telegram.desktop,Telegram
activewindow>>org.telegram.desktop,Media viewer
fullscreen>>1
openwindow>>8a532cd0,1,org.telegram.desktop,Media viewer
closewindow>>8a532cd0
fullscreen>>0
activewindow>>org.telegram.desktop,Telegram
freundTech commented 1 year ago

Here's a workaround: Add the following to your hyperland.conf

windowrulev2=float,class:^(org.telegram.desktop|telegramdesktop)$,title:^(Media viewer)$

This makes the media viewer window start as floating and therefor not take space in the dwindle tree. It still goes fullscreen. After closing telegram won't be stretched, because its window size never changed in the first place.

(There are two window classes in the rule, as telegram installed from flatpak has a different window class as telegram installed from for example AUR)

ghost commented 1 year ago

This works as intended, but I don't know how would people do this on other QT applications. Yet amazing workaround, thank you! Closing since it was a problem with Telegram itself. If I encounter the same issue with other QT applications, I'll let you know.

freundTech commented 1 year ago

I would prefer to keep this open, because there is still something wrong. Somehow telegram doesn't get notified of its size change or gets notified in the wrong order or doesn't notice the notification or something.

The workaround just prevents that case from occurring, but it's still broken. In the end it's @vaxerski's decision whether to close this or keep it open though.

vaxerski commented 1 year ago

tell me how to reproduce this with any other qt app then.

labi-le commented 1 year ago

tell me how to reproduce this with any other qt app then.

open image\video viewer in telegram

vaxerski commented 1 year ago

other qt app

means NOT telegram

ghost commented 1 year ago

tell me how to reproduce this with any other qt app then.

open image\video viewer in telegram

bro used 500% of his brain

vaxerski commented 1 year ago

Managed to repro.

vaxerski commented 1 year ago

fixed in 10303259f7c6f3e64e74e9ca8a31d4223071d5f0

ghost commented 1 year ago

@freundTech can you confirm this is fixed? Because, at least for me, it's not. The Media Viewer bug is "kind of fixed" but still reproducible. Just not all time.

Also, another way to trigger this, is by opening the Emoji panel, resizing the windows and then closing the Emoji panel.

freundTech commented 1 year ago

I haven't tested the fix yet, as I'm not currently running the -git version.

The emoji picker problem also happens on other tiling DEs (tested on bspwm (X11)). What's happening there is that when you open the emoji picker telegram tries to change it's window size to keep the current content the same and add the emoji picker as additional space to the side.
When you close it it tries to change the window size again to remove the space previously taken up by the emoji picker.

The problem when using a tiling window manager is that telegram obviously can't modify it's own window size. It however assumes that the change was successful and renders at the new resolution until it gets notified about its real size. A possible workaround might be to notify a window about it's current size every time it requests a size change, though I haven't tested that.

q234rty commented 1 year ago

I can confirm that this still happens in both telegram desktop and nheko, though I'm not sure how to consistently reproduce it.

felixsanz commented 11 months ago

this bug happens on some apps but on telegram-desktop it happens a lot. the workaround for the image viewer is perfect but the issue still remains, for example when resizing telegram window or creating a split that affects telegram.

it looks like the window is doing a transition to another window size and this transition doesn't complete, hence the window ends on this glitchy gpu rendered intermediate state.

Is this caused by animations? I have animations.enabled = false, but maybe this just reduces the timing to 0 and animations are still enabled? (ie. same process happening when resizing)

It doesn't happen on sway.

1696942519

DeNice-r commented 2 months ago

I also have an issue with telegram. It is always semi-transparent, like other windows do when not in focus, but when it is not in focus, the transparency effect doubles. Not sure if it is related, yet the issue title is broad enough to include this, imo.