desktop/source/lib/init.cxx |   61 +++++++++++++++++++++++---------------------
 vcl/source/app/svapp.cxx    |    9 +++++-
 2 files changed, 40 insertions(+), 30 deletions(-)

New commits:
commit 987c03d5c237c6a86ac886991435220e7381ced1
Author:     Ashod Nakashian <[email protected]>
AuthorDate: Thu May 9 22:49:37 2019 -0400
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jul 25 19:24:19 2019 +0200

    LOK: Do not offset window coordinates in LOK
    
    This fixes the issue with selecting the incorrect
    color when clicking on the color presets in the
    color picker window in LOK. Because the window
    coordinates are shifted in Core, and LOK client
    sends in absolute coordinates, the shift causes
    a different color to be selected.
    
    (cherry picked from commit 171a2300d37d73065e5e3bd4b77678e35f678adf)
    
    Change-Id: Ib818b83c0f0c727944068cb244f8d10666e5bc1d
    Reviewed-on: https://gerrit.libreoffice.org/76323
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ebb52d175027..42972ce713b5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3278,7 +3278,7 @@ static void 
doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned
         return;
     }
 
-    Point aPos(nX, nY);
+    const Point aPos(nX, nY);
     MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, 
nButtons, nModifier);
 
     if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 4967144e38e4..6632364f1c6c 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -70,6 +70,7 @@
 #include <comphelper/lok.hxx>
 #include <comphelper/solarmutex.hxx>
 #include <osl/process.h>
+#include <comphelper/lok.hxx>
 
 #include <cassert>
 #include <utility>
@@ -880,8 +881,12 @@ ImplSVEvent* Application::PostMouseEvent( VclEventId 
nEvent, vcl::Window *pWin,
     {
         Point aTransformedPos( pMouseEvent->GetPosPixel() );
 
-        aTransformedPos.AdjustX(pWin->GetOutOffXPixel() );
-        aTransformedPos.AdjustY(pWin->GetOutOffYPixel() );
+        // LOK uses (0, 0) as the origin of all windows; don't offset.
+        if (!comphelper::LibreOfficeKit::isActive())
+        {
+            aTransformedPos.AdjustX(pWin->GetOutOffXPixel());
+            aTransformedPos.AdjustY(pWin->GetOutOffYPixel());
+        }
 
         const MouseEvent aTransformedEvent( aTransformedPos, 
pMouseEvent->GetClicks(), pMouseEvent->GetMode(),
                                             pMouseEvent->GetButtons(), 
pMouseEvent->GetModifier() );
commit 4289b86e33b3658a131781ce0e26d86a70b967a8
Author:     Ashod Nakashian <[email protected]>
AuthorDate: Wed May 8 21:33:55 2019 -0400
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jul 25 19:24:03 2019 +0200

    LOK: Reduce and improve logging of event compression
    
    Change-Id: I84e0e8806eb6f4fbda063ebc29fafa791d472bb8
    (cherry picked from commit d5b900630caefc4d3b62a31906117cf4acd623b1)
    Reviewed-on: https://gerrit.libreoffice.org/76322
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2db298e3998c..ebb52d175027 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1179,11 +1179,13 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
         // Dump the queue state and validate cached data.
         int i = 1;
         std::ostringstream oss;
-        oss << '\n';
+        if (m_queue.empty())
+            oss << "Empty";
+        else
+            oss << m_queue.size() << " items\n";
         for (const CallbackData& c : m_queue)
             oss << i++ << ": [" << c.Type << "] [" << c.PayloadString << 
"].\n";
-        const std::string aQueued = oss.str();
-        SAL_INFO("lok", "Current Queue: " << (aQueued.empty() ? "Empty" : 
aQueued));
+        SAL_INFO("lok", "Current Queue: " << oss.str());
         for (const CallbackData& c : m_queue)
             assert(c.validate());
     }
@@ -1396,45 +1398,53 @@ bool 
CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
                 const boost::property_tree::ptree& aOldTree = elem.getJson();
                 if (aOldTree.get<std::string>("action", "") == "invalidate")
                 {
-                    const unsigned nOldDialogId = aOldTree.get<unsigned>("id", 
0);
-                    std::string aOldRectStr = 
aOldTree.get<std::string>("rectangle", "");
-                    // not possible that we encounter an empty
-                    // rectangle here; we already handled this
-                    // case before
-                    std::istringstream aOldRectStream(aOldRectStr);
+                    // Not possible that we encounter an empty rectangle here; 
we already handled this case above.
+                    std::istringstream 
aOldRectStream(aOldTree.get<std::string>("rectangle", ""));
                     long nOldLeft, nOldTop, nOldWidth, nOldHeight;
                     char nOldComma;
                     aOldRectStream >> nOldLeft >> nOldComma >> nOldTop >> 
nOldComma >> nOldWidth
                         >> nOldComma >> nOldHeight;
-                    tools::Rectangle aOldRect = tools::Rectangle(
+                    const tools::Rectangle aOldRect = tools::Rectangle(
                         nOldLeft, nOldTop, nOldLeft + nOldWidth, nOldTop + 
nOldHeight);
 
-                    if (nLOKWindowId == nOldDialogId)
+                    if (nLOKWindowId == aOldTree.get<unsigned>("id", 0))
                     {
+                        if (aNewRect == aOldRect)
+                        {
+                            SAL_INFO("lok.dialog", "Duplicate rect [" << 
aNewRect.toString()
+                                                                      << "]. 
Skipping new.");
+                            // We have a rectangle in the queue already that 
makes the current Callback useless.
+                            currentIsRedundant = true;
+                            return false;
+                        }
                         // new one engulfs the old one?
-                        if (aNewRect.IsInside(aOldRect))
+                        else if (aNewRect.IsInside(aOldRect))
                         {
-                            SAL_INFO("lok.dialog", "New " << 
aNewRect.toString() << " engulfs old "
-                                                          << 
aOldRect.toString() << ".");
+                            SAL_INFO("lok.dialog",
+                                     "New rect [" << aNewRect.toString() << "] 
engulfs old ["
+                                                  << aOldRect.toString() << 
"]. Replacing old.");
                             return true;
                         }
                         // old one engulfs the new one?
                         else if (aOldRect.IsInside(aNewRect))
                         {
-                            SAL_INFO("lok.dialog", "Old " << 
aOldRect.toString() << " engulfs new "
-                                                          << 
aNewRect.toString() << ".");
-                            // we have a rectangle in the queue
-                            // already that makes the current
-                            // Callback useless
+                            SAL_INFO("lok.dialog",
+                                     "Old rect [" << aOldRect.toString() << "] 
engulfs new ["
+                                                  << aNewRect.toString() << 
"]. Skipping new.");
+                            // We have a rectangle in the queue already that 
makes the current Callback useless.
                             currentIsRedundant = true;
                             return false;
                         }
                         else
                         {
-                            SAL_INFO("lok.dialog", "Merging " << 
aNewRect.toString() << " & "
-                                                              << 
aOldRect.toString());
+                            // Overlapping rects.
+                            const tools::Rectangle aPreMergeRect = aNewRect;
                             aNewRect.Union(aOldRect);
-                            SAL_INFO("lok.dialog", "Merged: " << 
aNewRect.toString());
+                            SAL_INFO("lok.dialog", "Merging rects ["
+                                                       << 
aPreMergeRect.toString() << "] & ["
+                                                       << aOldRect.toString() 
<< "] = ["
+                                                       << aNewRect.toString()
+                                                       << "]. Replacing old.");
                             return true;
                         }
                     }
@@ -1446,12 +1456,7 @@ bool 
CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
 
             // Do not enqueue if redundant.
             if (currentIsRedundant)
-            {
-                SAL_INFO("lok.dialog", "Current payload is engulfed by one 
already in the queue. "
-                                       "Skipping redundant payload: "
-                                           << aNewRect.toString());
                 return true;
-            }
 
             aTree.put("rectangle", aNewRect.toString().getStr());
             aCallbackData.setJson(aTree);
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to