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

Caolán McNamara caolanm at redhat.com
Wed Jul 26 14:02:33 UTC 2017


 vcl/inc/unx/gtk/gtksalmenu.hxx |    6 +++++-
 vcl/unx/gtk3/gtk3gtkframe.cxx  |   26 ++++----------------------
 2 files changed, 9 insertions(+), 23 deletions(-)

New commits:
commit 9e043feb59a082f383f757972ee0b1887f8747bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 25 15:28:14 2017 +0100

    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/40420
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index c303583941b3..3446c774c1df 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -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>
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 0a87284b504d..1b8448f4609f 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -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
 
     }
 }


More information about the Libreoffice-commits mailing list