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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 5 09:51:45 UTC 2021


 include/vcl/keycod.hxx       |    4 +---
 vcl/qt5/Qt5Menu.cxx          |    4 +---
 vcl/source/window/keycod.cxx |    5 ++---
 vcl/unx/gtk3/gtksalmenu.cxx  |    2 +-
 4 files changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 1a5bee9d18c9d7a8db0f9f011a0d2224d687e327
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 4 20:26:35 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Aug 5 11:51:11 2021 +0200

    vcl::KeyCode::GetName doesn't need a specific vcl::Window
    
    any will do
    
    Change-Id: Ice1875d9b9e1cd46ecbc6e306c77768dc0b07dbd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120029
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/keycod.hxx b/include/vcl/keycod.hxx
index 8da99ba7ccb9..68841ef85cac 100644
--- a/include/vcl/keycod.hxx
+++ b/include/vcl/keycod.hxx
@@ -24,8 +24,6 @@
 #include <vcl/dllapi.h>
 #include <vcl/keycodes.hxx>
 
-namespace vcl { class Window; }
-
 enum class KeyFuncType : sal_Int32 { DONTKNOW,
                    CUT, COPY, PASTE, UNDO,
                    REDO, DELETE };
@@ -64,7 +62,7 @@ public:
     sal_uInt16      GetGroup() const
                     { return (nKeyCodeAndModifiers & KEYGROUP_TYPE); }
 
-    OUString        GetName( vcl::Window* pWindow = nullptr ) const;
+    OUString        GetName() const;
 
     bool            IsFunction() const
                     { return (eFunc != KeyFuncType::DONTKNOW); }
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 75ab745de2b4..e8a170407281 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -158,9 +158,7 @@ void Qt5Menu::InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos)
 
                 UpdateActionGroupItem(pSalMenuItem);
 
-                const Qt5Frame* pFrame = GetFrame();
-                if (pFrame)
-                    pAction->setShortcut(toQString(nAccelKey.GetName(pFrame->GetWindow())));
+                pAction->setShortcut(toQString(nAccelKey.GetName()));
 
                 connect(pAction, &QAction::triggered, this,
                         [pSalMenuItem] { slotMenuTriggered(pSalMenuItem); });
diff --git a/vcl/source/window/keycod.cxx b/vcl/source/window/keycod.cxx
index e0ab290486ff..cc3fca5802ea 100644
--- a/vcl/source/window/keycod.cxx
+++ b/vcl/source/window/keycod.cxx
@@ -63,10 +63,9 @@ vcl::KeyCode::KeyCode( KeyFuncType eFunction )
     eFunc = eFunction;
 }
 
-OUString vcl::KeyCode::GetName( vcl::Window* pWindow ) const
+OUString vcl::KeyCode::GetName() const
 {
-    if ( !pWindow )
-        pWindow = ImplGetDefaultWindow();
+    vcl::Window* pWindow = ImplGetDefaultWindow();
     return pWindow ? pWindow->ImplGetFrame()->GetKeyName( GetFullCode() ) : "";
 }
 
diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx
index 78e1b7d6ffa3..380df0d62dd1 100644
--- a/vcl/unx/gtk3/gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtksalmenu.cxx
@@ -300,7 +300,7 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
         // Force updating of native menu labels.
         NativeSetItemText( nSection, nItemPos, aText );
         NativeSetItemIcon( nSection, nItemPos, aImage );
-        NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) );
+        NativeSetAccelerator(nSection, nItemPos, nAccelKey, nAccelKey.GetName());
 
         if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == nullptr )
         {


More information about the Libreoffice-commits mailing list