Eeschema: fix incorrect handling of Escape key.

Key events do not have to be skipped after they are handled.
This commit is contained in:
jean-pierre charras 2019-03-27 10:09:16 +01:00
parent bbcea3c98d
commit 9e5bc5d2d3
1 changed files with 7 additions and 4 deletions

View File

@ -3,6 +3,7 @@
* *
* Copyright (C) 2014-2019 CERN * Copyright (C) 2014-2019 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -626,9 +627,8 @@ void SCH_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event ) void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
{ {
int localkey; int localkey = event.GetKeyCode();
bool keyWasHandled = false;
localkey = event.GetKeyCode();
switch( localkey ) switch( localkey )
{ {
@ -642,6 +642,8 @@ void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
EndMouseCapture(); EndMouseCapture();
else else
EndMouseCapture( ID_NO_TOOL_SELECTED, 0 /*m_defaultCursor*/, wxEmptyString ); EndMouseCapture( ID_NO_TOOL_SELECTED, 0 /*m_defaultCursor*/, wxEmptyString );
keyWasHandled = true; // The key is captured: the key event will be not skipped
break; break;
} }
@ -683,7 +685,8 @@ void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
GetParent()->SetMousePosition( pos ); GetParent()->SetMousePosition( pos );
if( !GetParent()->GeneralControl( nullptr, pos, localkey ) ) // a Key event has to be skipped only if it is not handled:
if( !GetParent()->GeneralControl( nullptr, pos, localkey ) && !keyWasHandled )
event.Skip(); event.Skip();
} }