From 80646f9ab79573a1575952ac44a9450c383c0180 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 3 Dec 2020 10:21:23 +0000 Subject: show form dropdown on mouse press not release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit otherwise clicking on on the button when the dropdown is shown will cause a new dropdown to appear, not just dismiss the original Change-Id: Id417c8135d41797e00ed0f785c5ca91adf44e287 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107152 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sw/source/core/crsr/FormFieldButton.cxx | 9 ++++----- sw/source/core/inc/FormFieldButton.hxx | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sw/source/core/crsr/FormFieldButton.cxx b/sw/source/core/crsr/FormFieldButton.cxx index 43d8ff6e07e9..65412b3f558b 100644 --- a/sw/source/core/crsr/FormFieldButton.cxx +++ b/sw/source/core/crsr/FormFieldButton.cxx @@ -56,19 +56,18 @@ void FormFieldButton::CalcPosAndSize(const SwRect& rPortionPaintArea) } } -void FormFieldButton::MouseButtonUp(const MouseEvent&) +void FormFieldButton::MouseButtonDown(const MouseEvent&) { assert(GetParent()); - Point aPixPos = GetPosPixel(); - aPixPos.AdjustY(GetSizePixel().Height()); - // sets m_pFieldPopup InitPopup(); m_pFieldPopup->SetPopupModeEndHdl(LINK(this, DropDownFormFieldButton, FieldPopupModeEndHdl)); - tools::Rectangle aRect(GetParent()->OutputToScreenPixel(aPixPos), Size(0, 0)); + Size aSize = GetSizePixel(); + Point aPos(GetParent()->OutputToScreenPixel(GetPosPixel())); + tools::Rectangle aRect(aPos, aSize); m_pFieldPopup->StartPopupMode(aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus); Invalidate(); } diff --git a/sw/source/core/inc/FormFieldButton.hxx b/sw/source/core/inc/FormFieldButton.hxx index 265d0bafb713..93a7079651fb 100644 --- a/sw/source/core/inc/FormFieldButton.hxx +++ b/sw/source/core/inc/FormFieldButton.hxx @@ -32,7 +32,7 @@ public: void CalcPosAndSize(const SwRect& rPortionPaintArea); - virtual void MouseButtonUp(const MouseEvent& rMEvt) override; + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; DECL_LINK(FieldPopupModeEndHdl, FloatingWindow*, void); virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; -- cgit