diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-06-23 16:16:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-06-24 09:40:26 +0200 |
commit | 500a64964ad0f22bb11ff494430c70a069659ec6 (patch) | |
tree | feab13f310143658a6ed92aa16b5f5d748f0ac62 /sc | |
parent | 522f5ad4d8c92624fffa869143aa869662a48589 (diff) |
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/+/136345
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 0d585cc430df..655c063174a9 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -478,6 +478,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(); } @@ -1817,6 +1818,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 @@ -2073,9 +2077,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() ); @@ -2091,7 +2097,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 ); |