[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 11 15:38:02 UTC 2021
vcl/unx/gtk3/gtkframe.cxx | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
New commits:
commit 72f52efe861ff2a85d26a7cf6d8301af1c5ec2a2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 11 14:41:35 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 11 17:37:09 2021 +0200
gtk4: trim ensure_dbus_setup down to the minimum needed
Change-Id: Ic74ae09ca36ec110c67718fdb3de0513ef36d387
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115425
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 b98e5d2a75bf..23457d764881 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -499,6 +499,7 @@ static void ObjectDestroyedNotify( gpointer data )
}
}
+#if !GTK_CHECK_VERSION(4,0,0)
static void hud_activated( gboolean hud_active, gpointer user_data )
{
if ( hud_active )
@@ -511,6 +512,7 @@ static void hud_activated( gboolean hud_active, gpointer user_data )
pSalMenu->UpdateFull();
}
}
+#endif
static bool ensure_dbus_setup( gpointer data )
{
@@ -524,6 +526,15 @@ static bool ensure_dbus_setup( gpointer data )
if ( gdkWindow != nullptr && g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-menubar" ) == nullptr )
{
+ // Create menu model and action group attached to this frame.
+ GMenuModel* pMenuModel = G_MENU_MODEL( g_lo_menu_new() );
+ GActionGroup* pActionGroup = reinterpret_cast<GActionGroup*>(g_lo_action_group_new());
+
+ // Set window properties.
+ g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify );
+ g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify );
+
+#if !GTK_CHECK_VERSION(4,0,0)
// Get a DBus session connection.
if(!pSessionBus)
pSessionBus = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, nullptr);
@@ -532,20 +543,11 @@ static bool ensure_dbus_setup( gpointer data )
return false;
}
- // Create menu model and action group attached to this frame.
- GMenuModel* pMenuModel = G_MENU_MODEL( g_lo_menu_new() );
- GActionGroup* pActionGroup = reinterpret_cast<GActionGroup*>(g_lo_action_group_new());
-
// Generate menu paths.
sal_uIntPtr windowId = pSalFrame->GetNativeWindowHandle(pSalFrame->getWindow());
gchar* aDBusWindowPath = g_strdup_printf( "/org/libreoffice/window/%lu", windowId );
gchar* aDBusMenubarPath = g_strdup_printf( "/org/libreoffice/window/%lu/menus/menubar", windowId );
- // Set window properties.
- g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify );
- g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify );
-
-#if !GTK_CHECK_VERSION(4,0,0)
GdkDisplay *pDisplay = GtkSalFrame::getGdkDisplay();
#if defined(GDK_WINDOWING_X11)
if (DLSYM_GDK_IS_X11_DISPLAY(pDisplay))
@@ -567,7 +569,6 @@ static bool ensure_dbus_setup( gpointer data )
"/org/libreoffice",
g_dbus_connection_get_unique_name( pSessionBus ));
}
-#endif
#endif
// Publish the menu model and the action group.
SAL_INFO("vcl.unity", "exporting menu model at " << pMenuModel << " for window " << windowId);
@@ -578,6 +579,7 @@ static bool ensure_dbus_setup( gpointer data )
g_free( aDBusWindowPath );
g_free( aDBusMenubarPath );
+#endif
}
return false;
}
More information about the Libreoffice-commits
mailing list