From f7b8ac52e175399257776861bedf35ee105bfe80 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 14 Sep 2015 09:58:31 +0200 Subject: [PATCH] Disable proxy menu in Unity window manager. Only usual menubar works with wxWidgets (at least <= 3.1). When the proxy menu menubar is enable, some important things for us do not work: menuitems UI events and shortcuts. Also issues when switching from Legacy to GAL display mode. --- common/single_top.cpp | 14 ++++++++++++++ kicad/kicad.cpp | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/common/single_top.cpp b/common/single_top.cpp index 1de8cd05a7..c3dbe05210 100644 --- a/common/single_top.cpp +++ b/common/single_top.cpp @@ -115,6 +115,20 @@ PGM_BASE& Pgm() */ struct APP_SINGLE_TOP : public wxApp { +#if defined (__LINUX__) + APP_SINGLE_TOP(): wxApp() + { + // Disable proxy menu in Unity window manager. Only usual menubar works with wxWidgets (at least <= 3.1) + // When the proxy menu menubar is enable, some important things for us do not work: menuitems UI events and shortcuts. + wxString wm; + + if( wxGetEnv( wxT( "XDG_CURRENT_DESKTOP" ), &wm ) && wm.CmpNoCase( wxT( "Unity" ) ) == 0 ) + { + wxSetEnv ( wxT("UBUNTU_MENUPROXY" ), wxT( "0" ) ); + } + } +#endif + bool OnInit() // overload wxApp virtual { try diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index e166e2b49c..21f103983e 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -6,7 +6,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -249,6 +249,20 @@ KIWAY Kiway( &Pgm(), KFCTL_CPP_PROJECT_SUITE ); */ struct APP_KICAD : public wxApp { +#if defined (__LINUX__) + APP_KICAD(): wxApp() + { + // Disable proxy menu in Unity window manager. Only usual menubar works with wxWidgets (at least <= 3.1) + // When the proxy menu menubar is enable, some important things for us do not work: menuitems UI events and shortcuts. + wxString wm; + + if( wxGetEnv( wxT( "XDG_CURRENT_DESKTOP" ), &wm ) && wm.CmpNoCase( wxT( "Unity" ) ) == 0 ) + { + wxSetEnv ( wxT("UBUNTU_MENUPROXY" ), wxT( "0" ) ); + } + } +#endif + bool OnInit() // overload wxApp virtual { // if( Kiways.OnStart( this ) )