From 8b29f07dbeeaf15d665c2faf25bf86e23f3e4f36 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 30 Jan 2024 13:11:34 +0200 Subject: [PATCH] Make NETRootInfo initialization reasonable The documentation of NETRootInfo::activate() says that it should be called after creating the NETRootInfo object to read properties. However, it's called in two places: VirtualDesktopManager::setRows() and Workspace::initializeX11(). At quick glance, there's no justifying reason to call activate() in setRows(), it doesn't fit the purpose of setRows(). This change re-arranges NETRootInfo initialization code so it makes more sense. --- src/virtualdesktops.cpp | 1 - src/workspace.cpp | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/virtualdesktops.cpp b/src/virtualdesktops.cpp index 540c3eddbb..69b1243f50 100644 --- a/src/virtualdesktops.cpp +++ b/src/virtualdesktops.cpp @@ -610,7 +610,6 @@ void VirtualDesktopManager::setRows(uint rows) } if (m_rootInfo) { m_rootInfo->setDesktopLayout(NET::OrientationHorizontal, columns, m_rows, NET::DesktopLayoutCornerTopLeft); - m_rootInfo->activate(); } updateLayout(); diff --git a/src/workspace.cpp b/src/workspace.cpp index 2920fd75d8..2f22b09a97 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -303,9 +303,10 @@ void Workspace::initializeX11() m_nullFocus->map(); RootInfo *rootInfo = RootInfo::create(); + rootInfo->activate(); + const auto vds = VirtualDesktopManager::self(); vds->setRootInfo(rootInfo); - rootInfo->activate(); // TODO: only in X11 mode // Extra NETRootInfo instance in Client mode is needed to get the values of the properties