Bug 445457 - Showing a window before disabling resizing (GTK4 dialogs) results in incorrect title bar buttons
Summary: Showing a window before disabling resizing (GTK4 dialogs) results in incorrec...
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: decorations (show other bugs)
Version: 5.23.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-14 03:33 UTC by nyanpasu64
Modified: 2021-11-23 18:53 UTC (History)
1 user (show)

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


Attachments
The bug in gtk4-demo (16.32 KB, image/png)
2021-11-14 03:33 UTC, nyanpasu64
Details
The bug in a Qt Widgets app (26.71 KB, image/png)
2021-11-14 03:33 UTC, nyanpasu64
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nyanpasu64 2021-11-14 03:33:25 UTC
Created attachment 143527 [details]
The bug in gtk4-demo

SUMMARY
In X11 apps which first map a window, *then* call XSetWMNormalHints or send WM_NORMAL_HINTS to disable resizing (which hides kwin_x11's Maximize button), KWin fails to recompute the title bar layout and right-align the buttons.

STEPS TO REPRODUCE
1. Run gtk4-demo.
2. Scroll down to Dialogs and click Run.

OBSERVED RESULT
The title bar contains a minimize button, close button, and a blank space to the right (where the close button would be, if a maximize button was present).

EXPECTED RESULT
The title bar is properly right-aligned.

I don't know if GTK4 is wrong for mapping a window before disabling resize, or if KWin is wrong for rendering the title bar incorrectly when resizability is toggled after a window is mapped, or both.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Kernel Version: 5.14.16-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: NVIDIA GeForce GT 730/PCIe/SSE2

ADDITIONAL INFORMATION
First reported in https://bugs.kde.org/show_bug.cgi?id=439137#c1. I investigated the root cause at https://gitlab.gnome.org/GNOME/gtk/-/issues/4090#note_1309466. I decided to split it out since it's a different issue.

This happens by default in GTK4 dialogs, but I was also able to reproduce this effect in a Qt app by calling `dialog->layout()->setSizeConstraint(QLayout::SetFixedSize)` (which disables resizing) after the dialog is shown.
Comment 1 nyanpasu64 2021-11-14 03:33:50 UTC
Created attachment 143528 [details]
The bug in a Qt Widgets app