SUMMARY KWin_x11 shows redundant minimize and maximize button for Qt::Dialog type window, close button was not shown. According to Qt documentation, Qt::Dialog... > Indicates that the widget is a window that should be decorated as a dialog > (i.e., typically no maximize or minimize buttons in the title bar). > This is the default type for QDialog. In KWin it's completely the opposite behavior, which shows a maximize and a minimize button, but not show the close button. According to https://bugs.kde.org/show_bug.cgi?id=463063, the missing close button bug is an upstream issue, so this bug report only related to the redundant minimize and maximize button. STEPS TO REPRODUCE 1. Go to https://invent.kde.org/network/neochat/-/merge_requests/707#note_580407 and save the sample code to test.qml 2. use qml executable to show the saved qml file 3. see the result OBSERVED RESULT Under Plasma desktop, the dialog will have redundant maximize and minimize button. EXPECTED RESULT Maximize and minimize button shouldn't be there and the close button should be shown. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Arch Linux (rolling), KDE Plasma desktop environment KDE Plasma Version: 5.6.24 KDE Frameworks Version: 5.101.0 Qt Version: 5.15.7 ADDITIONAL INFORMATION This issue is originally reported as a part of https://bugs.kde.org/show_bug.cgi?id=463063. That one was marked as resolved but it only addressed the missing close button issue, the redundant maximize and minimize button issue is still there. Please also see https://invent.kde.org/network/neochat/-/merge_requests/707#note_580407 for detailed information. Let me know if you need any additional information.
*** Bug 474735 has been marked as a duplicate of this bug. ***
Once this is fixed, we can probably revert https://invent.kde.org/frameworks/knewstuff/-/commit/ea19fa6e824650f3257e8047d6f90e01899b2e03.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-integration/-/merge_requests/108
Git commit 522824e4302c5dae2cd92c488153ee2fe048e548 by Vlad Zahorodnii. Committed on 06/10/2023 at 08:23. Pushed by vladz into branch 'master'. Force WindowCloseButtonHint for toplevel dialogs Prior to 6f6603eb64b945e39820a0658504041b851c6e8c, the close button had been implicitly added by QtXCB. For example, if window flags contain only Qt::Dialog, QtXCB will set MWM_FUNC_ALL motif hints. So QtQuick dialogs used to get the close button even though there's no Qt::WinodwCloseButtonHint flag. QtWidgets dialogs usually always pass Qt::WindowCloseButtonHint flag. After making kwin display minimize and maximize decoration buttons only if corresponding Motif hints are set, KDE applications that use windows with Dialog type lost their min/max buttons because QtWidgets code doesn't set those flags. 6f6603eb64b945e39820a0658504041b851c6e8c tried to fix that by making the platform integration theme force Qt::WindowMinimizeButtonHint and Qt::WindowMaximizeButtonHint flags. But it accidentally broke QtQuick dialogs since dialogs have additional flags besides Qt::Dialog now, so QtXCB has stopped setting MWM_FUNC_ALL hints anymore. In order to address that, this patch changes a few things: - Make the platform theme be more careful about changing window flags. If user has explicitly changed window decoration flags, i.e. Qt::CustomizeWindowHint flag is set, don't touch decoration hints. - Merge Qt::WindowMaximizeButtonHint with Qt::WindowMinimizeButtonHint. If the window cannot be maximized, the window manager will hide the maximize button, so we can pass Qt::WindowMinMaxButtonHint. In some way, it's a breaking change as child dialogs may not have maximize button, but it's a weird case and maybe user code should be in control of that? - Forces Qt::WindowCloseButtonHint in addition to min/max button hints. QtQuick child dialogs, i.e. transientParent() is not null, will get default decoration buttons. M +3 -9 qt5/src/platformtheme/x11integration.cpp M +3 -9 qt6/src/platformtheme/x11integration.cpp https://invent.kde.org/plasma/plasma-integration/-/commit/522824e4302c5dae2cd92c488153ee2fe048e548
Git commit d6d82f2b0c26b8b5e5e76618fda1dfa763592b78 by Vlad Zahorodnii. Committed on 06/10/2023 at 09:19. Pushed by vladz into branch 'Plasma/5.27'. Force WindowCloseButtonHint for toplevel dialogs Prior to 6f6603eb64b945e39820a0658504041b851c6e8c, the close button had been implicitly added by QtXCB. For example, if window flags contain only Qt::Dialog, QtXCB will set MWM_FUNC_ALL motif hints. So QtQuick dialogs used to get the close button even though there's no Qt::WinodwCloseButtonHint flag. QtWidgets dialogs usually always pass Qt::WindowCloseButtonHint flag. After making kwin display minimize and maximize decoration buttons only if corresponding Motif hints are set, KDE applications that use windows with Dialog type lost their min/max buttons because QtWidgets code doesn't set those flags. 6f6603eb64b945e39820a0658504041b851c6e8c tried to fix that by making the platform integration theme force Qt::WindowMinimizeButtonHint and Qt::WindowMaximizeButtonHint flags. But it accidentally broke QtQuick dialogs since dialogs have additional flags besides Qt::Dialog now, so QtXCB has stopped setting MWM_FUNC_ALL hints anymore. In order to address that, this patch changes a few things: - Make the platform theme be more careful about changing window flags. If user has explicitly changed window decoration flags, i.e. Qt::CustomizeWindowHint flag is set, don't touch decoration hints. - Merge Qt::WindowMaximizeButtonHint with Qt::WindowMinimizeButtonHint. If the window cannot be maximized, the window manager will hide the maximize button, so we can pass Qt::WindowMinMaxButtonHint. In some way, it's a breaking change as child dialogs may not have maximize button, but it's a weird case and maybe user code should be in control of that? - Forces Qt::WindowCloseButtonHint in addition to min/max button hints. QtQuick child dialogs, i.e. transientParent() is not null, will get default decoration buttons. (cherry picked from commit 522824e4302c5dae2cd92c488153ee2fe048e548) M +3 -9 src/platformtheme/x11integration.cpp https://invent.kde.org/plasma/plasma-integration/-/commit/d6d82f2b0c26b8b5e5e76618fda1dfa763592b78