Bug 484423 - quick tiling resizes windows to 0x0 on display switching, breaking application rendering
Summary: quick tiling resizes windows to 0x0 on display switching, breaking applicatio...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: Quick Tiling (show other bugs)
Version: 5.27.5
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-24 21:55 UTC by kolAflash
Modified: 2024-03-26 13:44 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kolAflash 2024-03-24 21:55:52 UTC
SUMMARY
Quick tiled windows are temporarily being resized to (nearly) 0x0 when switching monitors. Afterwards the window is automatically being resized to it's correct size. This is a regression between KDE 5.20.5 (working fine, Debian-11) and 5.27.5 (Debian-12).

Unfortunately even temporarily resizing to 0x0 confuses some UI toolkits like Gtk-3. In case of Gtk-3 the window content is not being rendered any more, even after resizing the window back to a valid size.

Resizing to 0x0 doesn't seem to happen with every hardware. But the same problem is reproducible when simply turning off all displays for a moment.
  xrandr --output DISPLAY_NAME --off; sleep 3; xrandr --output DISPLAY_NAME --auto



STEPS TO REPRODUCE

You may reproduce this with a Debian-12, Kubuntu-23.10 or openSUSE-15.5 live image in a VM.
https://download.opensuse.org/distribution/leap/15.5/live/openSUSE-Leap-15.5-KDE-Live-x86_64-Media.iso
There you need to install a Gtk-3 application like "Geany" or "Pavucontrol".
Debian/Kubuntu: sudo apt update; sudo apt install geany
SUSE: sudo zypper install geany

1.
Start Geany and move it to the middle of the screens left boarder to trigger quick tiling.
(tiling it into a corner won't trigger the bug)

2.
Close Geany and reopen it.
(Don't ask me why this is needed. But else the bug doesn't happen.)

3.
On reopening Geany should have opened tiled to the left half of the screen.

4.
Disconnect the display for a moment, then reconnect it.
Alternatively run: xrandr --output DISPLAY_NAME --off; sleep 3; xrandr --output DISPLAY_NAME --auto

5.
Press CTRL+w to close the file opened in Geany. You'll see the window title changing, so Geany didn't completely crash. But the content of the window stays frozen. You may press CTRL+n to open a new empty file and the window title, the window title will change again, but the window content will stay frozen.

This overrides the minimum window size set by Geany and Pavucontrol which is somewhere around 50x50.

The same effect can be achieved by forcefully resizing Geany to 1x1. Simply right click the window titlebar, choose
  More Actions -> Configure Special Window Settings -> Add Property -> Size
There you set "Force", 1x1 (0x0 doesn't work here) and cilck "Apply". Afterwards change the value to 500x500.


OBSERVED RESULT
Window gets temporarily resized to (somewhere nearly) 0x0.

EXPECTED RESULT
Respect minimum window size. Or simply don't touch the window size at all when there's no active display anyway.



SOFTWARE/OS VERSIONS
Linux: Debian-12
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.20.5

Regression: 5.20.5 on Debian-11 was working fine



ADDITIONAL INFORMATION

May be related to this bug:

Split does not reset to its original value once "adjacent quick-tiled windows" configuration ceases to exist
https://bugs.kde.org/show_bug.cgi?id=465937

Window placement and positioning are sometimes wrong when waking up from sleep
https://bugs.kde.org/show_bug.cgi?id=465937
(sleeping may also "hide" the displays temporarily on some hardware)
Comment 1 Zamundaaa 2024-03-25 14:20:12 UTC
What Plasma versions do Kubuntu 23.10 and OpenSUSE 15.5 use? Debian is very out of date with 5.27.5; the bug you're describing should be fixed in 5.27.11, so if the other distros don't ship that yet, they'd still be affected as well
Comment 2 kolAflash 2024-03-26 12:49:35 UTC
(In reply to Zamundaaa from comment #1)
> What Plasma versions do Kubuntu 23.10 and OpenSUSE 15.5 use? Debian is very
> out of date with 5.27.5; the bug you're describing should be fixed in
> 5.27.11, so if the other distros don't ship that yet, they'd still be
> affected as well

https://cdimage.ubuntu.com/kubuntu/releases/23.10/release/kubuntu-23.10-desktop-amd64.manifest (2023-10-10)
kwin-x11: 5.27.8
plasma-workspace:  4:5.27.8
(reproduced bug)

https://download.opensuse.org/distribution/leap/15.5/live/openSUSE-Leap-15.5-KDE-Live-x86_64-Build13.15-Media.iso
Plasma: 5.27.9
(reproduced bug)

Kubuntu 24.04 Beta: https://cdimages.ubuntu.com/kubuntu/daily-live/current/ (2024-03-26)
kwin-x11: 5.27.10
plasma-workspace: 5.27.10
(reproduced bug)

I've checked the Plasma versions in Manjaro (2024-01-13) and Debian-13-Testing (Beta 2024-03-25).
(just checked Plasma version, didn't try to boot and reproduce the bug)
At maximum there was Plasma-5.27.10. It looks like Plasma-5.27.11 is still too young to be shipped with any distro.
https://invent.kde.org/plasma/kwin/-/tags/v5.27.11 (2024-03-06)
https://invent.kde.org/plasma/kwin/-/tags/v5.27.10 (2024-12-05)
And KDE-Neon already ships Plasma-6.0.2.


So I compiled kwin-5.27.11 and kdecoration-5.27.11 (needed dependency).
And this fixed the bug :-)

Debian-12:

mkdir -p ~/opt/kwin/build/
cd ~/opt/kwin/build/
wget https://invent.kde.org/plasma/kwin/-/archive/v5.27.11/kwin-v5.27.11.tar.bz2
wget https://invent.kde.org/plasma/kdecoration/-/archive/v5.27.11/kdecoration-v5.27.11.tar.bz2
tar xf kdecoration-v5.27.11.tar.bz2
tar xf kwin-v5.27.11.tar.bz2
cd kdecoration-v5.27.11
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=false -DCMAKE_INSTALL_PREFIX="${HOME}"/opt/kwin ..
make -j$(nproc) install
cd ~/opt/kwin/build/kwin-v5.27.11/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=false -DCMAKE_INSTALL_PREFIX="${HOME}"/opt/kwin ..
make -j$(nproc) install
~/opt/kwin/bin/kwin_x11 --replace
Comment 3 Zamundaaa 2024-03-26 13:44:55 UTC
Great