[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 5 07:02:29 UTC 2019


 include/vcl/menubtn.hxx        |    3 ++-
 vcl/source/app/salvtables.cxx  |    2 +-
 vcl/source/control/menubtn.cxx |   14 +++++++++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit bfe0b8776332b9cf80ca87742f59b9e713fa2977
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 27 13:01:46 2019 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu Dec 5 08:01:42 2019 +0100

    get_active should be true when activated but menu not yet shown
    
    Change-Id: Ia2a7cbf5b47eab6d09c78eb9d18233e18b628a3f
    Reviewed-on: https://gerrit.libreoffice.org/83906
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit f8719f68f8c073c0ad473507b16fc4bd99e79baa)
    Reviewed-on: https://gerrit.libreoffice.org/83987
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index 90d42fc607fc..5c3008a792cb 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -38,6 +38,7 @@ private:
     OString         msCurItemIdent;
     sal_uInt16      mnCurItemId;
     bool            mbDelayMenu;
+    bool            mbStartingMenu;
     Link<MenuButton*,void> maActivateHdl;
     Link<MenuButton*,void> maSelectHdl;
 
@@ -62,7 +63,7 @@ public:
     virtual void    Select();
 
     void            ExecuteMenu();
-    bool            MenuShown() const;
+    bool            InPopupMode() const;
     void            CancelMenu();
 
     //if false then the whole button launches the menu
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 8dd4d4a53914..8d775803e6b1 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1918,7 +1918,7 @@ public:
 
     virtual bool get_active() const override
     {
-        return m_xMenuButton->MenuShown();
+        return m_xMenuButton->InPopupMode();
     }
 
     virtual void set_inconsistent(bool /*inconsistent*/) override
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index ccf336a46375..b92877117d5d 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -38,10 +38,15 @@ void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
 
 void MenuButton::ExecuteMenu()
 {
+    mbStartingMenu = true;
+
     Activate();
 
     if (!mpMenu && !mpFloatingWindow)
+    {
+        mbStartingMenu = false;
         return;
+    }
 
     Size aSize = GetSizePixel();
     SetPressed( true );
@@ -71,6 +76,9 @@ void MenuButton::ExecuteMenu()
             vcl::Window::GetDockingManager()->StartPopupMode(mpFloatingWindow, aRect, nFlags);
         }
     }
+
+    mbStartingMenu = false;
+
     SetPressed(false);
     if (mnCurItemId)
     {
@@ -98,8 +106,11 @@ void MenuButton::CancelMenu()
     }
 }
 
-bool MenuButton::MenuShown() const
+bool MenuButton::InPopupMode() const
 {
+    if (mbStartingMenu)
+        return true;
+
     if (!mpMenu && !mpFloatingWindow)
         return false;
 
@@ -118,6 +129,7 @@ MenuButton::MenuButton( vcl::Window* pParent, WinBits nWinBits )
     : PushButton(WindowType::MENUBUTTON)
     , mnCurItemId(0)
     , mbDelayMenu(false)
+    , mbStartingMenu(false)
 {
     mnDDStyle = PushButtonDropdownStyle::MenuButton;
     ImplInit(pParent, nWinBits);


More information about the Libreoffice-commits mailing list