diff options
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/gtkinst.cxx | 19 | ||||
-rw-r--r-- | vcl/unx/gtk/gtksalmenu.cxx | 28 |
2 files changed, 16 insertions, 31 deletions
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx index 0bdaf3ee7a9f..368cdfb2c577 100644 --- a/vcl/unx/gtk/gtkinst.cxx +++ b/vcl/unx/gtk/gtkinst.cxx @@ -32,7 +32,6 @@ #include <headless/svpvd.hxx> #include <headless/svpbmp.hxx> #include <vcl/inputtypes.hxx> -#include <vcl/syswin.hxx> #include <unx/genpspgraphics.h> #include <rtl/strbuf.hxx> #include <rtl/uri.hxx> @@ -348,24 +347,10 @@ SalBitmap* GtkInstance::CreateSalBitmap() #ifdef ENABLE_GMENU_INTEGRATION -SalMenu* GtkInstance::CreateMenu( bool bMenuBar, Menu* pVCLMenu, SystemWindow* pAssociatedSystemWindow ) +SalMenu* GtkInstance::CreateMenu( bool bMenuBar, Menu* pVCLMenu ) { EnsureInit(); - - GtkSalFrame *pFrame = pAssociatedSystemWindow ? dynamic_cast<GtkSalFrame*>(pAssociatedSystemWindow->ImplGetFrame()) - : nullptr; - - GActionGroup* pActionGroup; - if (pFrame) - { - GtkWidget* pWidget = pFrame->getWindow(); - GdkWindow* gdkWindow = gtk_widget_get_window( pWidget ); - pActionGroup = G_ACTION_GROUP( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-action-group" ) ); - } - else - pActionGroup = nullptr; - - GtkSalMenu* pSalMenu = new GtkSalMenu(bMenuBar, pActionGroup); + GtkSalMenu* pSalMenu = new GtkSalMenu( bMenuBar ); pSalMenu->SetMenu( pVCLMenu ); return pSalMenu; } diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx index 6c904ced957e..44e555918f0a 100644 --- a/vcl/unx/gtk/gtksalmenu.cxx +++ b/vcl/unx/gtk/gtksalmenu.cxx @@ -456,26 +456,16 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const Rectangle& rRec * GtkSalMenu */ -GtkSalMenu::GtkSalMenu( bool bMenuBar, GActionGroup *pActionGroup ) : +GtkSalMenu::GtkSalMenu( bool bMenuBar ) : mbMenuBar( bMenuBar ), mpMenuBarWidget( nullptr ), mpCloseButton( nullptr ), mpVCLMenu( nullptr ), mpParentSalMenu( nullptr ), mpFrame( nullptr ), - mpActionGroup(pActionGroup) + mpMenuModel( nullptr ), + mpActionGroup( nullptr ) { - if (bMenuBar) - mpMenuModel = G_MENU_MODEL(g_lo_menu_new()); - else - mpMenuModel = nullptr; - - GLOActionGroup* pLOActionGroup = G_LO_ACTION_GROUP( mpActionGroup ); - if (pLOActionGroup) - { - g_lo_action_group_clear(pLOActionGroup); - g_lo_action_group_set_top_menu(pLOActionGroup, static_cast<gpointer>(this)); - } } void GtkSalMenu::SetMenuModel(GMenuModel* pMenuModel) @@ -674,12 +664,22 @@ void GtkSalMenu::SetFrame(const SalFrame* pFrame) GdkWindow* gdkWindow = gtk_widget_get_window( pWidget ); GLOMenu* pMenuModel = G_LO_MENU( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-menubar" ) ); - SAL_INFO("vcl.unity", "Found menu model: " << pMenuModel); + GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-action-group" ) ); + SAL_INFO("vcl.unity", "Found menu model: " << pMenuModel << " and action group: " << pActionGroup); if ( pMenuModel ) { if ( g_menu_model_get_n_items( G_MENU_MODEL( pMenuModel ) ) > 0 ) g_lo_menu_remove( pMenuModel, 0 ); + + mpMenuModel = G_MENU_MODEL( g_lo_menu_new() ); + } + + if ( pActionGroup ) + { + g_lo_action_group_clear( pActionGroup ); + g_lo_action_group_set_top_menu(pActionGroup, static_cast<gpointer>(this)); + mpActionGroup = G_ACTION_GROUP( pActionGroup ); } // Generate the main menu structure. |