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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Wed Oct 14 09:27:51 PDT 2015


 vcl/inc/unx/gtk/gtkdata.hxx        |    3 +++
 vcl/unx/gtk/app/gtkdata.cxx        |   16 ++++++++++++++++
 vcl/unx/gtk/window/gtksalframe.cxx |    8 ++++++++
 vcl/unx/gtk/window/gtksalmenu.cxx  |    6 +++++-
 4 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit c9bcb29f3b733a1230f78e7a03aac1a02d856cf7
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Oct 14 15:39:11 2015 +0100

    bring Unity menues to gtk3 too
    
    Change-Id: I4eb9f4bf423febce89635654c0cf1199b79d6fb8

diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 6490eda..43ec0e1 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -179,6 +179,9 @@ public:
 #if !GTK_CHECK_VERSION(3,0,0)
     virtual bool Dispatch( XEvent *pEvent ) override;
 #endif
+#if GTK_CHECK_VERSION(3,0,0)
+    void RefreshMenusUnity();
+#endif
 };
 
 inline GtkData* GetGtkSalData()
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index e203392..7c2db5e 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -33,6 +33,7 @@
 #include <unx/gtk/gtkdata.hxx>
 #include <unx/gtk/gtkinst.hxx>
 #include <unx/gtk/gtkframe.hxx>
+#include <unx/gtk/gtksalmenu.hxx>
 #include <unx/salobj.h>
 #include <generic/geninst.h>
 #include <osl/thread.h>
@@ -1017,4 +1018,19 @@ void GtkSalDisplay::deregisterFrame( SalFrame* pFrame )
     SalGenericDisplay::deregisterFrame( pFrame );
 }
 
+#if GTK_CHECK_VERSION(3,0,0)
+void GtkSalDisplay::RefreshMenusUnity()
+{
+    for(auto pSalFrame : m_aFrames) {
+        auto pGtkSalFrame( static_cast<GtkSalFrame*>(pSalFrame));
+        GtkSalMenu* pSalMenu = static_cast<GtkSalMenu*>(pGtkSalFrame->GetMenu());
+        if(pSalMenu) {
+            pSalMenu->Activate();
+            pSalMenu->UpdateFull();
+        }
+    }
+
+}
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 6e52a13..1f1bf2c 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -669,7 +669,9 @@ gboolean ensure_dbus_setup( gpointer data )
         if(!pSessionBus)
             pSessionBus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
         if( !pSessionBus )
+        {
             return FALSE;
+        }
 
         // Create menu model and action group attached to this frame.
         GMenuModel* pMenuModel = G_MENU_MODEL( g_lo_menu_new() );
@@ -1462,6 +1464,12 @@ void GtkSalFrame::Init( SalFrame* pParent, SalFrameStyleFlags nStyle )
         }
         lcl_set_user_time(GTK_WINDOW(m_pWindow), nUserTime);
     }
+#else
+    if( eWinType == GTK_WINDOW_TOPLEVEL )
+    {
+        // Enable DBus native menu if available.
+        ensure_dbus_setup( this );
+    }
 #endif
 
     if( bDecoHandling )
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index bb53b14..d34a98e 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -13,6 +13,7 @@
 
 #include <generic/gendata.hxx>
 #include <unx/saldisp.hxx>
+#include <unx/gtk/gtkdata.hxx>
 #include <unx/gtk/glomenu.h>
 #include <unx/gtk/gloactiongroup.h>
 #include <vcl/menu.hxx>
@@ -375,7 +376,9 @@ static bool bInvalidMenus = false;
 static gboolean RefreshMenusUnity(gpointer)
 {
     SolarMutexGuard g;
-
+#if GTK_CHECK_VERSION(3,0,0)
+    GetGtkSalData()->GetGtkDisplay()->RefreshMenusUnity();
+#else
     SalDisplay* pSalDisplay = vcl_sal::getSalDisplay(GetGenericData());
     std::list< SalFrame* >::const_iterator pSalFrame = pSalDisplay->getFrames().begin();
     std::list< SalFrame* >::const_iterator pEndSalFrame = pSalDisplay->getFrames().end();
@@ -388,6 +391,7 @@ static gboolean RefreshMenusUnity(gpointer)
             pSalMenu->UpdateFull();
         }
     }
+#endif
     bInvalidMenus = false;
     return FALSE;
 }


More information about the Libreoffice-commits mailing list