Commit 021a7175 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Immediately subscribe to menus once they show up and set window property only if there is one

appmenu-gtk-module always claims to have a menu even if there is none, so we need to
check that in advance and only write the window property announcing global menu support
if we successfully managed to acquire a menu
parent 8ef6ef75
......@@ -237,7 +237,11 @@ void Menu::initMenu()
emit requestWriteWindowProperties();
// appmenu-gtk-module always announces a menu bar on every GTK window even if there is none
// so we subscribe to the menu bar as soon as it shows up so we can figure out
// if we have a menu bar, an app menu, or just nothing
m_menuInited = true;
......@@ -275,6 +279,8 @@ void Menu::start(uint id)
if (reply.isError()) {
qCWarning(DBUSMENUPROXY) << "Failed to start subscription to" << id << "on" << m_serviceName << "at" << m_currentMenuObjectPath << reply.error();
} else {
const bool hadMenu = !m_menus.isEmpty();
const auto menus = reply.value();
for (auto menu : menus) {
......@@ -298,6 +304,11 @@ void Menu::start(uint id)
// TODO are we subscribed to all it returns or just to the ones we requested?
// do we have a menu now? let's tell everyone
if (!hadMenu && !m_menus.isEmpty()) {
emit requestWriteWindowProperties();
// When it was a delayed GetLayout request, send the reply now
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment