[Libreoffice-commits] core.git: vcl/win

Mike Kaganski mike.kaganski at collabora.com
Tue Mar 27 13:38:57 UTC 2018


 vcl/win/window/salframe.cxx |   26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

New commits:
commit fec7dc8d4b82cc9a60d8625f313ba12d926665b5
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Tue Mar 27 09:19:57 2018 +0100

    tdf#93120: Avoid redraws when mouse enters tooltips (Win)
    
    Change-Id: I3870f4fad0662d9f4b027ec307370291740b1d52
    Reviewed-on: https://gerrit.libreoffice.org/51930
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 57ac8512daf7..7d22f95260f3 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -64,6 +64,7 @@
 #include <win/salobj.h>
 #include <win/saltimer.h>
 
+#include <helpwin.hxx>
 #include <impbmp.hxx>
 #include <window.h>
 #include <sallayout.hxx>
@@ -3042,17 +3043,32 @@ static bool ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
             SalData* pSalData = GetSalData();
             if ( pSalData->mhWantLeaveMsg == hWnd )
             {
+                // Mouse-Coordinates are relative to the screen
+                POINT aPt;
+                aPt.x = static_cast<short>(LOWORD(lParam));
+                aPt.y = static_cast<short>(HIWORD(lParam));
+                ScreenToClient(hWnd, &aPt);
+                if (const auto& pHelpWin = ImplGetSVData()->maHelpData.mpHelpWin)
+                {
+                    const tools::Rectangle& rHelpRect = pHelpWin->GetHelpArea();
+                    if (rHelpRect.IsInside(Point(aPt.x, aPt.y)))
+                    {
+                        // We have entered a tooltip (help window). Don't call the handler here; it
+                        // would launch the sequence "Mouse leaves the Control->Control redraws->
+                        // Help window gets destroyed->Mouse enters the Control->Control redraws",
+                        // which takes CPU and may flicker. Just destroy the help window and pretend
+                        // we are still over the original window.
+                        ImplDestroyHelpWindow(true);
+                        bCall = false;
+                        break;
+                    }
+                }
                 pSalData->mhWantLeaveMsg = nullptr;
                 if ( pSalData->mpMouseLeaveTimer )
                 {
                     delete pSalData->mpMouseLeaveTimer;
                     pSalData->mpMouseLeaveTimer = nullptr;
                 }
-                // Mouse-Coordinates are relative to the screen
-                POINT aPt;
-                aPt.x = static_cast<short>(LOWORD( lParam ));
-                aPt.y = static_cast<short>(HIWORD( lParam ));
-                ScreenToClient( hWnd, &aPt );
                 aMouseEvt.mnX = aPt.x;
                 aMouseEvt.mnY = aPt.y;
                 aMouseEvt.mnButton = 0;


More information about the Libreoffice-commits mailing list