no need to lookup window if cursor has not moved (tdf#105575)

use a single-item cache to avoid calling WindowFromPos

Change-Id: I0d42c9572d28363949e38f3e052973727a44fb4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120419
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2021-08-13 13:34:44 +02:00
committed by Noel Grandin
parent a334112b44
commit d29eb3d715
+8
View File
@@ -5460,6 +5460,14 @@ void SalTestMouseLeave()
{
POINT aPt;
GetCursorPos( &aPt );
// a one item cache, because this function is sometimes hot - if the cursor has not moved, then
// no need to call WindowFromPoint
static POINT cachedPoint;
if (cachedPoint.x == aPt.x && cachedPoint.y == aPt.y)
return;
cachedPoint = aPt;
if ( pSalData->mhWantLeaveMsg != WindowFromPoint( aPt ) )
SendMessageW( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MAKELPARAM( aPt.x, aPt.y ) );
}