[AppMenu] Ignore show request when application menu isn't configured

Before Plasma 5.12 one could only have either global menu or decoration button configured but since the setting was non-intuitive
it was switched to auto-enable when applet or button is present.
This results in both menus reacting to e.g. Alt+F for File menu.

BUG: 392012
FIXED-IN: 5.12.4

Differential Revision: https://phabricator.kde.org/D11580
This commit is contained in:
Kai Uwe Broulik 2018-03-26 10:39:28 +02:00
parent 6c00ed2df8
commit c99d329125

View file

@ -27,6 +27,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QDBusObjectPath>
#include <QDBusServiceWatcher>
#include "decorations/decorationbridge.h"
#include <KDecoration2/DecorationSettings>
using namespace KWin;
KWIN_SINGLETON_FACTORY(ApplicationMenu)
@ -81,6 +84,13 @@ void ApplicationMenu::setViewEnabled(bool enabled)
void ApplicationMenu::slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
{
// Ignore show request when user has not configured the application menu title bar button
auto decorationSettings = Decoration::DecorationBridge::self()->settings();
if (!decorationSettings->decorationButtonsLeft().contains(KDecoration2::DecorationButtonType::ApplicationMenu)
&& !decorationSettings->decorationButtonsRight().contains(KDecoration2::DecorationButtonType::ApplicationMenu)) {
return;
}
if (AbstractClient *c = findAbstractClientWithApplicationMenu(serviceName, menuObjectPath)) {
c->showApplicationMenu(actionId);
}