summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-10-14 15:39:11 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-10-14 17:26:38 +0100
commitc9bcb29f3b733a1230f78e7a03aac1a02d856cf7 (patch)
tree47c598639b35f39597fd5c13958690ab933b7e73 /vcl/unx
parent3a9eabc9a1959ef08a85001991a940ddf01d9afb (diff)
bring Unity menues to gtk3 too
Change-Id: I4eb9f4bf423febce89635654c0cf1199b79d6fb8
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx16
-rw-r--r--vcl/unx/gtk/window/gtksalframe.cxx8
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx6
3 files changed, 29 insertions, 1 deletions
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index e20339287c3a..7c2db5ead1fb 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 6e52a130e35e..1f1bf2c34ab0 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 bb53b14ff341..d34a98e7bce9 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;
}