diff options
author | Noel Grandin <noel@peralex.com> | 2021-08-13 10:19:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-13 13:34:44 +0200 |
commit | d29eb3d715a2bfd37c37e098d4f1c4600332487d (patch) | |
tree | b510f4cb71df66bc805900fb31da3a1133d252f8 | |
parent | a334112b44cb1ace8911c93323921510ccd0864e (diff) |
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>
-rw-r--r-- | vcl/win/window/salframe.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 45361d8baef0..ae19b4a5c5c7 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -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 ) ); } |