← Back to team overview

kicad-developers team mailing list archive

Re: Strange behavior of draw panel gal focus.

 

Hi Jean-Pierre,

Everything works as expected on Linux, with or without the patch. I
recall having some other focus problems in the past, so there are more
workarounds in common/draw_panel_gal.cpp.

Perhaps there is a way to simplify the code related to focus handling or
the event handlers setup is incorrect? IIRC, I added the workarounds to
make the Tool Dispatcher receive key up/down events.

Regards,
Orson

On 10/30/2017 11:54 AM, jp charras wrote:
> Hi Orson,
> 
> Could you have a look into this patch?
> 
> It fixes (this it only a workaround) a very strange behavior of focus, for the draw panel GAL.
> Sometimes the draw panel do not have the focus (and moreover do not accept the focus) on W7 32 bits.
> 
> It happens when 2 EDA_FRAME are opened, for instance the board editor and the footprint viewer.
> 
> When the 2 frame are shown on screen, no problem.
> But if you iconize one frame (for instance the footprint viewer) the remaining frame does not
> receive some events (key events and mousewheel event).
> 
> I had a look into this strange behavior and found 2 problems:
> 1 - When happens, the wxWindow::FindFocus() method returns nullptr (that explains why some events
> are no longer received)
> 2 - And the active draw panel gal does not accept the focus (SetFocus() do nothing). Only the main
> Draw Frame accepts SetFocus().
> 
> This small patch gives the Focus to the main Draw Frame when wxWindow::FindFocus() method returns
> nullptr.
> 
> More strange:
> The first time the footprint viewer is iconized, the focus is lost.
> but if you raise and iconize the footprint viewer, the focus is OK.
> 
> In short when iconizing n times the footprint viewer, if n is odd, the focus is lost, and if n is
> even, the focus is OK.
> 
> I also noticed (when reading the tool_dispatcher.cpp source) there is a similar focus issue on OSX.
> 
> Perhaps my workaround also fixes this OSX issue.
> 
> Thanks.
> 


Attachment: signature.asc
Description: OpenPGP digital signature


References