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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue May 11 15:38:34 UTC 2021


 vcl/unx/gtk3/gtkframe.cxx |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

New commits:
commit 3cc2ea2da2dad635e7e0d4375668c55b16bada55
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 11 14:44:59 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 11 17:37:41 2021 +0200

    gtk4: rename ensure_dbus_setup to attach_menu_model
    
    Change-Id: I26b657aaad0dfbdbe6917815a8a4c5ca2d3bf4f3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115426
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 23457d764881..6a5df5eafb20 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -514,9 +514,8 @@ static void hud_activated( gboolean hud_active, gpointer user_data )
 }
 #endif
 
-static bool ensure_dbus_setup( gpointer data )
+static void attach_menu_model(GtkSalFrame* pSalFrame)
 {
-    GtkSalFrame* pSalFrame = static_cast< GtkSalFrame* >( data );
     GtkWidget* pWidget = pSalFrame->getWindow();
 #if !GTK_CHECK_VERSION(4,0,0)
     GdkSurface* gdkWindow = gtk_widget_get_window(pWidget);
@@ -536,15 +535,13 @@ static bool ensure_dbus_setup( gpointer data )
 
 #if !GTK_CHECK_VERSION(4,0,0)
         // Get a DBus session connection.
-        if(!pSessionBus)
+        if (!pSessionBus)
             pSessionBus = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, nullptr);
-        if( !pSessionBus )
-        {
-            return false;
-        }
+        if (!pSessionBus)
+            return;
 
         // Generate menu paths.
-        sal_uIntPtr windowId = pSalFrame->GetNativeWindowHandle(pSalFrame->getWindow());
+        sal_uIntPtr windowId = pSalFrame->GetNativeWindowHandle(pWidget);
         gchar* aDBusWindowPath = g_strdup_printf( "/org/libreoffice/window/%lu", windowId );
         gchar* aDBusMenubarPath = g_strdup_printf( "/org/libreoffice/window/%lu/menus/menubar", windowId );
 
@@ -581,7 +578,6 @@ static bool ensure_dbus_setup( gpointer data )
         g_free( aDBusMenubarPath );
 #endif
     }
-    return false;
 }
 
 void on_registrar_available( GDBusConnection * /*connection*/,
@@ -1347,8 +1343,8 @@ void GtkSalFrame::Init( SalFrame* pParent, SalFrameStyleFlags nStyle )
 
     if (!bPopup)
     {
-        // Enable DBus native menu if available.
-        ensure_dbus_setup( this );
+        // Enable GMenuModel native menu
+        attach_menu_model(this);
     }
 }
 


More information about the Libreoffice-commits mailing list