Don't use the accelerator table in the menubars
It seems that the accelerator table causes issues with keyboard events on MSW. Fixes https://gitlab.com/kicad/code/kicad/issues/1941
This commit is contained in:
parent
94cd0cf3ad
commit
9d0ea66a96
|
@ -32,6 +32,7 @@
|
|||
#include <3d_viewer/tools/3d_actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::CreateMenuBar()
|
||||
|
@ -39,7 +40,7 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
|||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CreateMenuBar" );
|
||||
|
||||
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
|
||||
wxMenuBar* menuBar = new wxMenuBar;
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
|
||||
//-- File menu -----------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <tools/cvpcb_actions.h>
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||
|
@ -39,7 +40,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
//-- File menu -----------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <tools/ee_selection_tool.h>
|
||||
#include <lib_manager.h>
|
||||
#include "lib_edit_frame.h"
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
|
@ -39,7 +40,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
||||
LIB_ID libId = getTargetLibId();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <tools/ee_actions.h>
|
||||
#include "eeschema_id.h"
|
||||
#include "sch_edit_frame.h"
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
extern void AddMenuLanguageList( CONDITIONAL_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
|
||||
|
||||
|
@ -45,7 +46,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
auto modifiedDocumentCondition = [&]( const SELECTION& sel )
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <tools/lib_control.h>
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
void LIB_VIEW_FRAME::ReCreateHToolbar()
|
||||
{
|
||||
|
@ -99,7 +100,7 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the OSX Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
//-- File menu -----------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/gerbview_actions.h>
|
||||
#include <tools/gerbview_selection_tool.h>
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||
|
@ -41,7 +42,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
//-- File menu -------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef WX_MENUBAR_H_
|
||||
#define WX_MENUBAR_H_
|
||||
|
||||
#include <wx/accel.h>
|
||||
#include <wx/menu.h>
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
|
||||
*
|
||||
* It appears that on MSW the accelerator table of a wxMenuBar will be searched before key events are
|
||||
* passed to other items. To work around this, simply don't let the menubar have an accelerator table.
|
||||
* See https://gitlab.com/kicad/code/kicad/-/issues/1941
|
||||
*/
|
||||
class WX_MENUBAR : public wxMenuBar
|
||||
{
|
||||
public:
|
||||
// Just take all constructors
|
||||
using wxMenuBar::wxMenuBar;
|
||||
|
||||
void SetAcceleratorTable( const wxAcceleratorTable& aTable ) override
|
||||
{
|
||||
// Don't use the passed in accelerator table, create a new empty one
|
||||
wxMenuBar::SetAcceleratorTable( wxAcceleratorTable() );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // COMMON_WIDGETS_WX_BUSY_INDICATOR__H
|
|
@ -34,6 +34,7 @@
|
|||
#include "kicad_manager_frame.h"
|
||||
#include "pgm_kicad.h"
|
||||
#include "kicad_id.h"
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
||||
|
@ -42,7 +43,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
//-- File menu -----------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <tools/pl_selection_tool.h>
|
||||
#include "pl_editor_frame.h"
|
||||
#include "pl_editor_id.h"
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||
|
@ -42,7 +43,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
||||
return IsContentModified();
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/selection_tool.h>
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||
|
@ -44,7 +45,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
auto modifiedDocumentCondition = [this]( const SELECTION& sel ) {
|
||||
return IsContentModified();
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/selection_tool.h>
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||
|
@ -48,7 +49,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
||||
return IsContentModified();
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <tools/pcb_actions.h>
|
||||
#include "footprint_viewer_frame.h"
|
||||
#include "pcbnew_id.h"
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
|
||||
|
@ -161,7 +162,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
|||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
//----- File menu -----------------------------------------------------------
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue