Kaydet (Commit) 9e043feb authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: tdf#102909 gtk3: remove configure loophole of non-native menubar

the ENABLE_DBUS + ENABLE_GIO thing is to allow building against an
old gtk2 baseline. If building against gtk3 then gio and dbus are
available, and allowing the unusual configure path through gtk3 results
in a non-supported cruddy build

Change-Id: Ic6306fe2f9951714fd5875c24aedda1d7c6f2b93
Reviewed-on: https://gerrit.libreoffice.org/40420Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 98782932
......@@ -22,7 +22,11 @@
#include <unx/gtk/gtkframe.hxx>
#include <vcl/idle.hxx>
#if ENABLE_DBUS && ENABLE_GIO && \
#if GTK_CHECK_VERSION(3,0,0)
# define ENABLE_GMENU_INTEGRATION
# include <unx/gtk/glomenu.h>
# include <unx/gtk/gloactiongroup.h>
#elif ENABLE_DBUS && ENABLE_GIO && \
(GLIB_MAJOR_VERSION > 2 || GLIB_MINOR_VERSION >= 36)
# define ENABLE_GMENU_INTEGRATION
# include <unx/gtk/glomenu.h>
......
......@@ -21,6 +21,8 @@
#include <unx/gtk/gtkdata.hxx>
#include <unx/gtk/gtkinst.hxx>
#include <unx/gtk/gtkgdi.hxx>
#include <unx/gtk/gtksalmenu.hxx>
#include <unx/gtk/hudawareness.h>
#include <vcl/help.hxx>
#include <vcl/keycodes.hxx>
#include <vcl/layout.hxx>
......@@ -42,13 +44,6 @@
#include <config_gio.h>
#if ENABLE_DBUS && ENABLE_GIO
# include <unx/gtk/gtksalmenu.hxx>
#endif
#if defined ENABLE_GMENU_INTEGRATION // defined in gtksalmenu.hxx above
# include <unx/gtk/hudawareness.h>
#endif
#include <gtk/gtk.h>
#include <X11/Xlib.h>
......@@ -109,9 +104,7 @@ using namespace com::sun::star;
int GtkSalFrame::m_nFloats = 0;
#if defined ENABLE_GMENU_INTEGRATION
static GDBusConnection* pSessionBus = nullptr;
#endif
static sal_uInt16 GetKeyModCode( guint state )
{
......@@ -504,8 +497,6 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
Init( pSysData );
}
#ifdef ENABLE_GMENU_INTEGRATION
// AppMenu watch functions.
static void ObjectDestroyedNotify( gpointer data )
......@@ -765,11 +756,9 @@ void on_registrar_unavailable( GDBusConnection * /*connection*/,
pGtkSalMenu->EnableUnity(false);
}
}
#endif
void GtkSalFrame::EnsureAppMenuWatch()
{
#ifdef ENABLE_GMENU_INTEGRATION
if ( !m_nWatcherId )
{
// Get a DBus session connection.
......@@ -790,9 +779,6 @@ void GtkSalFrame::EnsureAppMenuWatch()
this,
nullptr );
}
#else
(void) this; // loplugin:staticmethods
#endif
}
void GtkSalFrame::InvalidateGraphics()
......@@ -852,15 +838,14 @@ GtkSalFrame::~GtkSalFrame()
gtk_widget_destroy( GTK_WIDGET(m_pTopLevelGrid) );
{
SolarMutexGuard aGuard;
#if defined ENABLE_GMENU_INTEGRATION
if(m_nWatcherId)
g_bus_unwatch_name(m_nWatcherId);
#endif
if( m_pWindow )
{
g_object_set_data( G_OBJECT( m_pWindow ), "SalFrame", nullptr );
#if defined ENABLE_GMENU_INTEGRATION
if ( pSessionBus )
{
if ( m_nHudAwarenessId )
......@@ -874,7 +859,6 @@ GtkSalFrame::~GtkSalFrame()
if ( m_nAppActionGroupExportId )
g_dbus_connection_unexport_action_group( pSessionBus, m_nAppActionGroupExportId );
}
#endif
gtk_widget_destroy( m_pWindow );
}
}
......@@ -1272,10 +1256,8 @@ void GtkSalFrame::Init( SalFrame* pParent, SalFrameStyleFlags nStyle )
if( eWinType == GTK_WINDOW_TOPLEVEL )
{
#ifdef ENABLE_GMENU_INTEGRATION
// Enable DBus native menu if available.
ensure_dbus_setup( this );
#endif
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment