diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkdata.hxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalmenu.cxx | 6 |
4 files changed, 32 insertions, 1 deletions
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 6490edaa911c..43ec0e1dbdb7 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 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; } |