Bug 483994

Summary: kwin: wrong window size after disabling external monitor
Product: [Plasma] kwin Reporter: Horst Schirmeier <horst>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: xaver.hugl
Priority: NOR    
Version First Reported In: 5.27.10   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Firefox showing button at viewport bottom right (before disabling ext. monitor / after applying workaround)
Firefox showing button at viewport bottom right (after disabling ext. screen), actually rendering it behind taskbar

Description Horst Schirmeier 2024-03-19 12:53:20 UTC
Created attachment 167466 [details]
Firefox showing button at viewport bottom right (before disabling ext. monitor / after applying workaround)

SUMMARY
After enabling ("Extend to right") and again disabling an external monitor, applications get the wrong impression what the current vertical viewport size actually is, although the screen resolution seems right. For example, a maximized Firefox window displaying a website with a button at the "bottom" of the current viewport does not show the button in the right place anymore, but at an even lower position behind the Plasma taskbar (see attached screenshots). Similarly, a maximized Konsole terminal shows its bottom-most text line behind the Plasma taskbar.

As a workaround, switching screen resolutions back and forth fixes the problem temporarily, until again an external monitor is involved:

xrandr --screen 0 --size 1680x1050
sleep 1
xrandr --screen 0 --size 1920x1080

STEPS TO REPRODUCE
1. Attach external monitor via HDMI that has a higher resolution (here: 2560x2880) than the primary monitor (here: 1920x1080)
2. Enable external monitor, "Extend to right"
3. Start a Konsole terminal, maximize on primary monitor, repeatedly press ENTER to reach the bottom terminal line
4. Disable external monitor, "Switch to laptop screen"

OBSERVED RESULT
Bottom terminal line (and cursor) isn't visible anymore but "behind" the Plasma taskbar

EXPECTED RESULT
Bottom terminal line (and cursor) should be visible right above the Plasma taskbar

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.27.10 (Debian testing: 4:5.27.10-3)
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10
Comment 1 Horst Schirmeier 2024-03-19 12:54:16 UTC
Created attachment 167468 [details]
Firefox showing button at viewport bottom right (after disabling ext. screen), actually rendering it behind taskbar
Comment 2 Horst Schirmeier 2024-03-19 12:57:54 UTC
Website for reproducers: https://www.w3schools.com/css/tryit.asp?filename=trycss_position_fixed
(the Konsole variant is even easier to reproduce)
Comment 3 Zamundaaa 2025-10-17 11:02:40 UTC
KWin nowadays has lots of code to resize apps back to how they were before hotplugging, so this should no longer be a problem in latest Plasma.