summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-05-08 21:17:00 -0400
committerJan Holesovsky <kendy@collabora.com>2019-05-14 11:39:46 +0200
commit0bb310d7ce39421ecc4ff90518ffdf6aa01d1b02 (patch)
tree93294efdf665981719231dab1724c5dde65642d9 /desktop
parent570a3c5361d58635e4d0ac8baf6df787bd2290ad (diff)
LOK: Minor window event processing cleanup
This reduces the number of json reads we do when compressing window events, which happens quite often. Change-Id: I1c85f28867b52cad85445fff8a031b990dad8b56
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index abb4ec547047..754d7dc589e9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1328,7 +1328,8 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
boost::property_tree::ptree& aTree = aCallbackData.setJson(payload);
const unsigned nLOKWindowId = aTree.get<unsigned>("id", 0);
- if (aTree.get<std::string>("action", "") == "invalidate")
+ const std::string aAction = aTree.get<std::string>("action", "");
+ if (aAction == "invalidate")
{
std::string aRectStr = aTree.get<std::string>("rectangle", "");
// no 'rectangle' field => invalidate all of the window =>
@@ -1339,9 +1340,8 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
if (elem.Type == LOK_CALLBACK_WINDOW)
{
const boost::property_tree::ptree& aOldTree = elem.getJson();
- const unsigned nOldDialogId = aOldTree.get<unsigned>("id", 0);
- if (aOldTree.get<std::string>("action", "") == "invalidate"
- && nLOKWindowId == nOldDialogId)
+ if (nLOKWindowId == aOldTree.get<unsigned>("id", 0)
+ && aOldTree.get<std::string>("action", "") == "invalidate")
{
return true;
}
@@ -1360,9 +1360,8 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
return false;
const boost::property_tree::ptree& aOldTree = elem.getJson();
- const unsigned nOldDialogId = aOldTree.get<unsigned>("id", 0);
- if (aOldTree.get<std::string>("action", "") == "invalidate"
- && nLOKWindowId == nOldDialogId
+ if (nLOKWindowId == aOldTree.get<unsigned>("id", 0)
+ && aOldTree.get<std::string>("action", "") == "invalidate"
&& aOldTree.get<std::string>("rectangle", "").empty())
{
return true;
@@ -1442,6 +1441,7 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
return false;
});
+ // Do not enqueue if redundant.
if (currentIsRedundant)
{
SAL_INFO("lok.dialog", "Current payload is engulfed by one already in the queue. "
@@ -1455,7 +1455,7 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
assert(aCallbackData.validate() && "Validation after setJson failed!");
}
}
- else if (aTree.get<std::string>("action", "") == "created")
+ else if (aAction == "created")
{
// Remove all previous actions on same dialog, if we are creating it anew.
removeAll([&nLOKWindowId](const queue_type::value_type& elem) {
@@ -1468,7 +1468,7 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
return false;
});
}
- else if (aTree.get<std::string>("action", "") == "size_changed")
+ else if (aAction == "size_changed")
{
// A size change is practically re-creation of the window.
// But at a minimum it's a full invalidation.