layout: add missing groupbar decoration to the window (#3235)

* fix: add missing groupbar decoration to the window

Add groupbar decoration to the operand window of `CWindow::insertWindowToGroup` if it does not exist, to prevent segmentation faults when mouse events are triggered after moving the window to a group, where `getDecorationByType(DECORATION_GROUPBAR)` unexpectedly returns nullptr.

Also fixed a bug where the group bar disappeared when the moveIntoGroup dispatcher's operand window was in a group.

* Update Window.cpp
This commit is contained in:
memchr 2023-09-10 21:59:10 +00:00 committed by GitHub
parent 19bbdeed47
commit 79862c957c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -733,6 +733,9 @@ void CWindow::insertWindowToGroup(CWindow* pWindow) {
const auto BEGINAT = this;
const auto ENDAT = m_sGroupData.pNextWindow;
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
pWindow->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(pWindow));
if (!pWindow->m_sGroupData.pNextWindow) {
BEGINAT->m_sGroupData.pNextWindow = pWindow;
pWindow->m_sGroupData.pNextWindow = ENDAT;