ReleaseMouse so focus can be grabbed by the FilterFloat
otherwise the keyboard events don't get to the dropdown Change-Id: I6cbaea5e3cef16a39edb12fecdf1d08ab29cbd5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96366 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
ac18631b85
commit
d6533cb372
2 changed files with 25 additions and 11 deletions
|
@ -82,6 +82,8 @@ struct SpellCallbackInfo;
|
|||
// predefines
|
||||
namespace sdr::overlay { class OverlayObjectList; }
|
||||
|
||||
class ScFilterFloatingWindow;
|
||||
|
||||
class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSourceHelper
|
||||
{
|
||||
// ScFilterListBox is always used for selection list
|
||||
|
@ -152,7 +154,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, public DropTargetHel
|
|||
std::unique_ptr<ScNoteMarker, o3tl::default_delete<ScNoteMarker>> mpNoteMarker;
|
||||
|
||||
VclPtr<ScFilterListBox> mpFilterBox;
|
||||
VclPtr<FloatingWindow> mpFilterFloat;
|
||||
VclPtr<ScFilterFloatingWindow> mpFilterFloat;
|
||||
VclPtr<ScCheckListMenuWindow> mpAutoFilterPopup;
|
||||
VclPtr<ScCheckListMenuWindow> mpDPFieldPopup;
|
||||
std::unique_ptr<ScDPFieldButton> mpFilterButton;
|
||||
|
|
|
@ -311,21 +311,25 @@ IMPL_LINK_NOARG(ScFilterListBox, AsyncSelectHdl, void*, void)
|
|||
pGridWin->ClickExtern();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// use a System floating window for the above filter listbox
|
||||
class ScFilterFloatingWindow : public FloatingWindow
|
||||
{
|
||||
private:
|
||||
bool m_bGridHadMouseCaptured;
|
||||
public:
|
||||
ScFilterFloatingWindow(vcl::Window* pParent);
|
||||
virtual ~ScFilterFloatingWindow() override;
|
||||
virtual void dispose() override;
|
||||
};
|
||||
|
||||
}
|
||||
bool MouseWasCaptured() const
|
||||
{
|
||||
return m_bGridHadMouseCaptured;
|
||||
}
|
||||
};
|
||||
|
||||
ScFilterFloatingWindow::ScFilterFloatingWindow(vcl::Window* pParent)
|
||||
: FloatingWindow( pParent, WB_BORDER | WB_SYSTEMWINDOW ) // make it a system floater
|
||||
, m_bGridHadMouseCaptured(pParent->IsMouseCaptured())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -540,6 +544,10 @@ IMPL_LINK_NOARG(ScGridWindow, PopupModeEndHdl, FloatingWindow*, void)
|
|||
{
|
||||
if (mpFilterBox)
|
||||
mpFilterBox->SetCancelled(); // cancel select
|
||||
// restore the mouse capture state of the GridWindow to
|
||||
// what it was at initial popup time
|
||||
if (mpFilterFloat->MouseWasCaptured())
|
||||
CaptureMouse();
|
||||
GrabFocus();
|
||||
}
|
||||
|
||||
|
@ -980,6 +988,9 @@ void ScGridWindow::ShowFilterMenu(const tools::Rectangle& rCellRect, bool bLayou
|
|||
|
||||
mpFilterBox->SetSizePixel(aSize);
|
||||
mpFilterFloat->SetOutputSizePixel(aSize);
|
||||
|
||||
if (IsMouseCaptured())
|
||||
ReleaseMouse();
|
||||
mpFilterFloat->StartPopupMode(aCellRect, FloatWinPopupFlags::Down|FloatWinPopupFlags::GrabFocus);
|
||||
}
|
||||
|
||||
|
@ -1070,11 +1081,6 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
|
|||
rFilterBox.select(nPos);
|
||||
}
|
||||
mpFilterBox->EndInit();
|
||||
|
||||
// Scenario selection comes from MouseButtonDown:
|
||||
// The next MouseMove on the FilterBox is like a ButtonDown
|
||||
nMouseStatus = SC_GM_FILTER;
|
||||
CaptureMouse();
|
||||
}
|
||||
|
||||
void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
|
||||
|
@ -1771,7 +1777,6 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
|
|||
LaunchDataSelectMenu( aListValPos.Col(), aListValPos.Row() );
|
||||
|
||||
nMouseStatus = SC_GM_FILTER; // not set in DoAutoFilterMenue for bDataSelect
|
||||
CaptureMouse();
|
||||
rState.mbActivatePart = false;
|
||||
return;
|
||||
}
|
||||
|
@ -1783,7 +1788,14 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
|
|||
ScRange aScenRange;
|
||||
if ( rMEvt.IsLeft() && HasScenarioButton( aPos, aScenRange ) )
|
||||
{
|
||||
CaptureMouse();
|
||||
|
||||
DoScenarioMenu( aScenRange );
|
||||
|
||||
// Scenario selection comes from MouseButtonDown:
|
||||
// The next MouseMove on the FilterBox is like a ButtonDown
|
||||
nMouseStatus = SC_GM_FILTER;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue