[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 17 20:16:28 UTC 2020
include/vcl/treelistbox.hxx | 4 ++++
vcl/inc/treeglue.hxx | 2 +-
vcl/source/treelist/treelistbox.cxx | 22 ++++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
New commits:
commit 8c74d9b30aacec2207dd6c7960c81280c79e2c31
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jun 17 16:47:15 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 17 22:15:48 2020 +0200
ignore positions on top of scrollbars for GetTargetAtPoint
Change-Id: I6d63ac3723b392e7c82836ea5d4455ebde8a8e08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96553
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index ac24996221cc..1fe73c689610 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -557,6 +557,10 @@ protected:
void ImplEditEntry( SvTreeListEntry* pEntry );
void AdjustEntryHeightAndRecalc();
+
+ // true if rPos is over the SvTreeListBox body, i.e. not over a
+ // scrollbar
+ VCL_DLLPRIVATE bool PosOverBody(const Point& rPos) const;
public:
void SetNoAutoCurEntry( bool b );
diff --git a/vcl/inc/treeglue.hxx b/vcl/inc/treeglue.hxx
index 11c61944f5e1..ea643635faee 100644
--- a/vcl/inc/treeglue.hxx
+++ b/vcl/inc/treeglue.hxx
@@ -130,7 +130,7 @@ public:
SvTreeListEntry* GetTargetAtPoint(const Point& rPos, bool bHighLightTarget)
{
SvTreeListEntry* pOldTargetEntry = pTargetEntry;
- pTargetEntry = pImpl->GetEntry(rPos);
+ pTargetEntry = PosOverBody(rPos) ? pImpl->GetEntry(rPos) : nullptr;
if (pOldTargetEntry != pTargetEntry)
ImplShowTargetEmphasis(pOldTargetEntry, false);
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index e41a11d0f103..a31f86e81f45 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -1996,6 +1996,28 @@ void SvTreeListBox::ModelHasCleared()
SvListView::ModelHasCleared();
}
+bool SvTreeListBox::PosOverBody(const Point& rPos) const
+{
+ if (rPos.X() < 0 || rPos.Y() < 0)
+ return false;
+ Size aSize(GetSizePixel());
+ if (rPos.X() > aSize.Width() || rPos.Y() > aSize.Height())
+ return false;
+ if (pImpl->m_aVerSBar->IsVisible())
+ {
+ tools::Rectangle aRect(pImpl->m_aVerSBar->GetPosPixel(), pImpl->m_aVerSBar->GetSizePixel());
+ if (aRect.IsInside(rPos))
+ return false;
+ }
+ if (pImpl->m_aHorSBar->IsVisible())
+ {
+ tools::Rectangle aRect(pImpl->m_aHorSBar->GetPosPixel(), pImpl->m_aHorSBar->GetSizePixel());
+ if (aRect.IsInside(rPos))
+ return false;
+ }
+ return true;
+}
+
void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
{
if( !nDeltaEntries || !pImpl->m_aVerSBar->IsVisible() )
More information about the Libreoffice-commits
mailing list