File 0030-Don-t-re-evaluate-the-model-constantly-whilst-loopin.patch of Package plasma5-workspace

From 42d2b065d81d621a8ca0f206e659fd8515d1a6d7 Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Tue, 17 Jan 2017 18:55:11 +0000
Subject: [PATCH 30/44] Don't re-evaluate the model constantly whilst looping
 through windows

Summary:
We only want to set the menu to unavailable when we've searched all the
transient windows and found there is no menu, not whilst we are looping.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4176
---
 applets/appmenu/plugin/appmenumodel.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/applets/appmenu/plugin/appmenumodel.cpp b/applets/appmenu/plugin/appmenumodel.cpp
index 14ef5458..aa0b1e4d 100644
--- a/applets/appmenu/plugin/appmenumodel.cpp
+++ b/applets/appmenu/plugin/appmenumodel.cpp
@@ -154,8 +154,6 @@ void AppMenuModel::onActiveWindowChanged(WId id)
                 updateApplicationMenu(serviceName, menuObjectPath);
                 return true;
             }
-            setMenuAvailable(false);
-            emit modelNeedsUpdate();
             return false;
         };
 
@@ -178,6 +176,10 @@ void AppMenuModel::onActiveWindowChanged(WId id)
         if (updateMenuFromWindowIfHasMenu(id)) {
             return;
         }
+
+        //no menu found, set it to unavailable
+        setMenuAvailable(false);
+        emit modelNeedsUpdate();
     }
 #endif
 
-- 
2.12.0

openSUSE Build Service is sponsored by