[Libreoffice-commits] core.git: include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 27 19:24:17 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 19503a467f73e7a619b9fbd8e0c7a6cc9d8ba237
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 27 13:01:46 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Nov 27 20:22:34 2019 +0100

    get_active should be true when activated but menu not yet shown
    
    Change-Id: Ia2a7cbf5b47eab6d09c78eb9d18233e18b628a3f
    Reviewed-on: https://gerrit.libreoffice.org/83905
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index 744ed69241f1..f22fe29a6166 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 b26f48579813..b7e974e02195 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2624,7 +2624,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 957c4f63bff3..7402d361f4b8 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -36,10 +36,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 );
@@ -69,6 +74,9 @@ void MenuButton::ExecuteMenu()
             vcl::Window::GetDockingManager()->StartPopupMode(mpFloatingWindow, aRect, nFlags);
         }
     }
+
+    mbStartingMenu = false;
+
     SetPressed(false);
     if (mnCurItemId)
     {
@@ -96,8 +104,11 @@ void MenuButton::CancelMenu()
     }
 }
 
-bool MenuButton::MenuShown() const
+bool MenuButton::InPopupMode() const
 {
+    if (mbStartingMenu)
+        return true;
+
     if (!mpMenu && !mpFloatingWindow)
         return false;
 
@@ -116,6 +127,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