svtools/source/control/tabbar.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
New commits: commit 84797ab79e3f1a37e630abffc47bfe43fbf66c22 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 13 20:17:51 2023 +0000 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Feb 14 10:09:26 2023 +0000 Resolves: tdf#149482 don't insert if the mouse is not still pressed In repeat callback, if we didn't see a mouse up, but find that the mouse is no longer pressed at this point, then bail Change-Id: I6e5d1d7201065fadcc2242fd52323ffb56766383 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146922 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index dd49bda0df4f..d2aabc1c20b0 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -871,6 +871,15 @@ void TabBar::ImplShowPage( sal_uInt16 nPos ) IMPL_LINK( TabBar, ImplClickHdl, weld::Button&, rBtn, void ) { + if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)) == 0) + { + // like tdf#149482 if we didn't see a mouse up, but find that the mouse is no + // longer pressed at this point, then bail + mpImpl->mxButtonBox->m_xPrevRepeater->Stop(); + mpImpl->mxButtonBox->m_xNextRepeater->Stop(); + return; + } + EndEditMode(); sal_uInt16 nNewPos = mnFirstPos; @@ -909,6 +918,14 @@ IMPL_LINK( TabBar, ImplClickHdl, weld::Button&, rBtn, void ) IMPL_LINK_NOARG(TabBar, ImplAddClickHandler, weld::Button&, void) { + if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)) == 0) + { + // tdf#149482 if we didn't see a mouse up, but find that the mouse is no + // longer pressed at this point, then bail + mpImpl->mxButtonBox->m_xAddRepeater->Stop(); + return; + } + EndEditMode(); AddTabClick(); }