[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 3 12:36:02 UTC 2020


 sw/source/core/crsr/FormFieldButton.cxx |    9 ++++-----
 sw/source/core/inc/FormFieldButton.hxx  |    2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 80646f9ab79573a1575952ac44a9450c383c0180
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Dec 3 10:21:23 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Dec 3 13:35:28 2020 +0100

    show form dropdown on mouse press not release
    
    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 <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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;


More information about the Libreoffice-commits mailing list