vcl/inc/svimpbox.hxx | 9 --------- vcl/source/treelist/svimpbox.cxx | 1 + vcl/source/treelist/treelistbox.cxx | 24 ++++++------------------ 3 files changed, 7 insertions(+), 27 deletions(-)
New commits: commit 183f66f79b40b6159a0edcf1b49c3aa612c90525 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Mon Aug 16 11:25:37 2021 +0200 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Mon Aug 16 13:20:21 2021 +0200 Revert "tdf#143114 Avoid StartDrag on TreeListBox when CaptureOnButton" This reverts commit ca7dab5d96e73b7b4b045e2460e0b2ee150757db. It created tdf#143749 + the dup tdf#143865 Change-Id: Ibd68c45213491b0df7dc36f0418de307412499c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120531 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/vcl/inc/svimpbox.hxx b/vcl/inc/svimpbox.hxx index c46003c35dd4..554c5a8070ae 100644 --- a/vcl/inc/svimpbox.hxx +++ b/vcl/inc/svimpbox.hxx @@ -310,17 +310,8 @@ public: bool IsSelectable( const SvTreeListEntry* pEntry ); void SetForceMakeVisible(bool bEnable) { mbForceMakeVisible = bEnable; } - - // tdf#143114 allow to ask if CaptureOnButton is active - // (MouseButtonDown hit on SvLBoxButton, CaptureMouse() active) - bool IsCaptureOnButtonActive() const; }; -inline bool SvImpLBox::IsCaptureOnButtonActive() const -{ - return nullptr != m_pActiveButton && nullptr != m_pActiveEntry; -} - inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType ) { return m_aNodeAndEntryImages[_eType]; diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 0b4f1e50d122..835ee2eac949 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -1794,6 +1794,7 @@ void SvImpLBox::EntryInserted( SvTreeListEntry* pEntry ) // ****** Control the control animation + bool SvImpLBox::ButtonDownCheckCtrl(const MouseEvent& rMEvt, SvTreeListEntry* pEntry) { SvLBoxItem* pItem = m_pView->GetItem(pEntry,rMEvt.GetPosPixel().X(),&m_pActiveTab); diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index ee4b01981007..660294dd36c4 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1108,13 +1108,9 @@ void SvTreeListBox::SetupDragOrigin() void SvTreeListBox::StartDrag( sal_Int8, const Point& rPosPixel ) { - if(nullptr != pImpl) - { - // tdf#143114 do not start drag when a Button/Checkbox is in - // drag-before-ButtonUp mode (CaptureMouse() active) - if(pImpl->IsCaptureOnButtonActive()) - return; - } + Point aEventPos( rPosPixel ); + MouseEvent aMouseEvt( aEventPos, 1, MouseEventModifiers::SELECT, MOUSE_LEFT ); + MouseButtonUp( aMouseEvt ); nOldDragMode = GetDragDropMode(); if ( nOldDragMode == DragDropMode::NONE ) @@ -2286,26 +2282,18 @@ void SvTreeListBox::Paint(vcl::RenderContext& rRenderContext, const tools::Recta void SvTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) { + pImpl->m_pCursorOld = pImpl->m_pCursor; pImpl->MouseButtonDown( rMEvt ); - - // tdf#143114 remember the *correct* starting entry - pImpl->m_pCursorOld = (rMEvt.IsLeft() && (nTreeFlags & SvTreeFlags::CHKBTN) && mnClicksToToggle > 0) - ? GetEntry(rMEvt.GetPosPixel()) - : nullptr; } void SvTreeListBox::MouseButtonUp( const MouseEvent& rMEvt ) { // tdf#116675 clicking on an entry should toggle its checkbox - // tdf#143114 use the already created starting entry and if it exists - if (nullptr != pImpl->m_pCursorOld) + if (rMEvt.IsLeft() && (nTreeFlags & SvTreeFlags::CHKBTN) && mnClicksToToggle > 0) { const Point aPnt = rMEvt.GetPosPixel(); SvTreeListEntry* pEntry = GetEntry(aPnt); - - // compare if MouseButtonUp *is* on the same entry, regardless of scrolling - // or other things - if (pEntry && pEntry->m_Items.size() > 0 && 1 == mnClicksToToggle && pEntry == pImpl->m_pCursorOld) + if (pEntry && pEntry->m_Items.size() > 0 && (mnClicksToToggle == 1 || pEntry == pImpl->m_pCursorOld)) { SvLBoxItem* pItem = GetItem(pEntry, aPnt.X()); // if the checkbox button was clicked, that will be toggled later, do not toggle here