Bug 434620

Summary: Changing size constraint doesn't update title bar buttons position
Product: [Plasma] kwin Reporter: Damir Porobic <damir_porobic>
Component: decorationsAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: normal CC: kde.podagric, klemen.skerbis, me, nate
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: No exit button prior to resizing

Description Damir Porobic 2021-03-19 12:24:20 UTC
SUMMARY
kwin seem to be not updating the tittle bar buttons position when the buttons count change. We have a use case where we switch to fixed size (which has only two buttons, minimize and close), then adjust the widget size (here the buttons position is probably updated), then we switch back resizable size (this adds the third button, maximize), but the button position stays the same and the maximize buttons pushes the close button outside the visible frame. 

STEPS TO REPRODUCE
1. Set widget size constraint to fixed:
    mLayout->setSizeConstraint(QLayout::SetFixedSize);
2. Adjust widget size:
    QWidget::adjustSize();
3. Revert widget size constraint back to value that was previously set:
    mLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);

OBSERVED RESULT
The close button is no longer visible, if you enlarge the widget manually so that you move the right border further to the right side, the close button becomes visible again.  

EXPECTED RESULT
Changing size constraint in a way that the tittle bar button count is changed should also update the position of the buttons so that all buttons are visible.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.71.0
Qt Version: 5.12.7

ADDITIONAL INFORMATION
Comment 1 Damir Porobic 2022-02-15 11:16:56 UTC
Any updates on this one?
Just had a user with Plasma 5.24 reporting that the issue persists.
Comment 2 Klemen 2022-02-15 11:56:02 UTC
Created attachment 146762 [details]
No exit button prior to resizing

I also have this issue on KDE 5.24 on EndeavourOS. When i take a screenshot with a tool Ksnip, and the tool's window pops up, there is SOMETIMES no exit button. If i want the exit button to appear, i just have to resize the window slightly or maximize it, then the exit button appears.