summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-06-23 16:16:15 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-08-18 19:18:17 +0200
commit64fbd90158f5248636490237e23325c90683d9be (patch)
treec6dfd45c80bbd738d270fd7c30329a5bb211282c
parenttdf#148913 sw: fix crash with pending infobars on Windows (diff)
downloadcore-64fbd90158f5248636490237e23325c90683d9be.tar.gz
core-64fbd90158f5248636490237e23325c90683d9be.zip
tdf#149609 release mouse before showing popups from calc grid window
If we capture the mouse in the course of the mouse down handler, then release it before showing a popup to undo any unhelpful seleng capture. Change-Id: I94ead6b516c2b2a019030e0e04760f8e07ff35d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136329 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sc/source/ui/view/gridwin.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2e4fcf0bc38d..f41d7b580a01 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -475,6 +475,7 @@ IMPL_LINK_NOARG(ScGridWindow, PopupModeEndHdl, weld::Popover&, void)
mpFilterBox->SetCancelled(); // cancel select
// restore the mouse capture state of the GridWindow to
// what it was at initial popup time
+ SAL_WARN_IF(bMouseWasCaptured, "sc.ui", "Is there a scenario where the mouse was captured before mouse down?");
if (bMouseWasCaptured)
CaptureMouse();
}
@@ -1797,6 +1798,9 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
if (pScMod->IsModalMode(mrViewData.GetSfxDocShell()))
return;
+ const bool bWasMouseCaptured = IsMouseCaptured();
+ SAL_WARN_IF(bWasMouseCaptured, "sc.ui", "Is there a scenario where the mouse is captured before mouse down?");
+
pScActiveViewShell = mrViewData.GetViewShell(); // if left is clicked
nScClickMouseModifier = rMEvt.GetModifier(); // to always catch a control click
@@ -2053,9 +2057,11 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
tools::Rectangle aButtonRect = GetListValButtonRect( aListValPos );
if ( aButtonRect.Contains( aPos ) )
{
- // tdf#125917 typically we have the mouse captured already, except if are editing the cell.
- // Ensure its captured before the menu is launched even in the cell editing case
- CaptureMouse();
+ // tdf#149609 if we captured the mouse in the course of this function
+ // release it before showing the data select menu to undo any unhelpful
+ // seleng capture
+ if (!bWasMouseCaptured && IsMouseCaptured())
+ ReleaseMouse();
LaunchDataSelectMenu( aListValPos.Col(), aListValPos.Row() );
@@ -2071,7 +2077,11 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
ScRange aScenRange;
if ( rMEvt.IsLeft() && HasScenarioButton( aPos, aScenRange ) )
{
- CaptureMouse();
+ // tdf#149609 if we captured the mouse in the course of this function
+ // release it before showing the data scenario menu to undo any unhelpful
+ // seleng capture
+ if (!bWasMouseCaptured && IsMouseCaptured())
+ ReleaseMouse();
DoScenarioMenu( aScenRange );