summaryrefslogtreecommitdiffstats
path: root/desktop/inc
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-05-08 12:02:54 -0400
committerJan Holesovsky <kendy@collabora.com>2016-05-09 13:58:30 +0200
commit81d866a78d33dfc483b004b0cfc783a3d9005592 (patch)
treeaa8880532423f74f37eeffbdcd6ca3f0c392a456 /desktop/inc
parentLOK: SAL_WARN for each removed event is unnecessary (diff)
downloadcore-81d866a78d33dfc483b004b0cfc783a3d9005592.tar.gz
core-81d866a78d33dfc483b004b0cfc783a3d9005592.zip
LOK: drop identical invalidation notifications
And drop duplicate GRAPHIC_SELECTION notifications. (cherry picked from commit 7cdfe080432f69c2247cc7ff28316b653bd654ff) Change-Id: I0c372efa9a58620e24cea219d82479cdc9dff359 Reviewed-on: https://gerrit.libreoffice.org/24771 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'desktop/inc')
-rw-r--r--desktop/inc/lib/init.hxx25
1 files changed, 17 insertions, 8 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 933b9e669a2d..c0a4462543e0 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -43,6 +43,7 @@ namespace desktop {
m_states.emplace(LOK_CALLBACK_TEXT_SELECTION_START, "NIL");
m_states.emplace(LOK_CALLBACK_TEXT_SELECTION_END, "NIL");
m_states.emplace(LOK_CALLBACK_TEXT_SELECTION, "NIL");
+ m_states.emplace(LOK_CALLBACK_GRAPHIC_SELECTION, "NIL");
m_states.emplace(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, "NIL");
m_states.emplace(LOK_CALLBACK_STATE_CHANGED, "NIL");
m_states.emplace(LOK_CALLBACK_MOUSE_POINTER, "NIL");
@@ -85,7 +86,6 @@ namespace desktop {
return;
}
-
const std::string payload(data ? data : "(nil)");
std::unique_lock<std::mutex> lock(m_mutex);
@@ -124,13 +124,14 @@ namespace desktop {
case LOK_CALLBACK_TEXT_SELECTION_START:
case LOK_CALLBACK_TEXT_SELECTION_END:
case LOK_CALLBACK_TEXT_SELECTION:
+ case LOK_CALLBACK_GRAPHIC_SELECTION:
case LOK_CALLBACK_MOUSE_POINTER:
case LOK_CALLBACK_CELL_CURSOR:
case LOK_CALLBACK_CELL_FORMULA:
case LOK_CALLBACK_CURSOR_VISIBLE:
case LOK_CALLBACK_SET_PART:
case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
- removeAllButLast(type);
+ removeAllButLast(type, false);
break;
// These come with rects, so drop earlier
@@ -139,10 +140,15 @@ namespace desktop {
case LOK_CALLBACK_INVALIDATE_TILES:
if (payload.empty())
{
- // Invalidating everything means previous
+ // Invalidating everything means previously
// invalidated tiles can be dropped.
- removeAllButLast(type);
+ removeAllButLast(type, false);
+ }
+ else
+ {
+ removeAllButLast(type, true);
}
+
break;
}
@@ -171,23 +177,26 @@ namespace desktop {
}
}
- void removeAllButLast(const int type)
+ void removeAllButLast(const int type, const bool identical)
{
int i = m_queue.size() - 1;
+ std::string payload;
for (; i >= 0; --i)
{
if (m_queue[i].first == type)
{
- //SAL_WARN("idle", "Found [" + std::to_string(type) + "] at " + std::to_string(i));
+ payload = m_queue[i].second;
+ //SAL_WARN("idle", "Found [" + std::to_string(type) + "] at " + std::to_string(i) + ": [" + payload + "].");
break;
}
}
for (--i; i >= 0; --i)
{
- if (m_queue[i].first == type)
+ if (m_queue[i].first == type &&
+ (!identical || m_queue[i].second == payload))
{
- //SAL_WARN("idle", "Removing [" + std::to_string(type) + "] at " + std::to_string(i));
+ //SAL_WARN("idle", "Removing [" + std::to_string(type) + "] at " + std::to_string(i) + ": " + m_queue[i].second + "].");
m_queue.erase(m_queue.begin() + i);
}
}