Alt+3 does not open 3D view

Bug #1830969 reported by Oleg Endo
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Low
Jeff Young

Bug Description

Pushing the hotkey (default Alt+3) to open the 3D viewer after pcbnew has been started does nothing. It can be opened through the menu, though. After the 3D view has been opened once, the hotkey works normally.

This started happening not long ago (perhaps 2 weeks?)

Application: Pcbnew
Version: 6.0.0-unknown-59b729c~86~ubuntu18.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-50-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.4.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Tags: pcbnew
Revision history for this message
Nick Østergaard (nickoe) wrote :

I also see this on archlinux with
Version: (5.1.0-776-g48899a4c9), debug build

It looks like the if I activate the top menu with the mouse or by holding alt-key down for a second, and pressing for example v for the view menu, and cancel that. Then it works with alt+3.

Changed in kicad:
milestone: none → 6.0.0-rc1
Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1830969] Re: Alt+3 does not open 3D view

Never mind. I checked out branch tom-crash-reporter instead of
tom-crash-repoter-may27.

On 5/29/2019 5:28 PM, Nick Østergaard wrote:
> I also see this on archlinux with
> Version: (5.1.0-776-g48899a4c9), debug build
>
> It looks like the if I activate the top menu with the mouse or by
> holding alt-key down for a second, and pressing for example v for the
> view menu, and cancel that. Then it works with alt+3.
>
>
> ** Changed in: kicad
> Milestone: None => 6.0.0-rc1
>

tags: added: pcbnew
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I'm seeing this on windows as well. Works fine on 5.1.2. Something must have changed in the master branch recently to break this.

Changed in kicad:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Nick Østergaard (nickoe) wrote :

I have not verified this, but I think it started to appear in the big refactoring mentioned in:

https://bugs.launchpad.net/kicad/+bug/1831333/comments/5

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I am thinking the issue comes from the change in menubar (related to CONDITIONAL_MENU use)
Now the sub-menus of a CONDITIONAL_MENU are actually created the first time you click on a menubar CONDITIONAL_MENU menu.
Therefore Accelerator keys are not registered into wxWidgets before opening the submenu.
in Pcbnew, the 3D Viewer menuitem (indide the "View" menu) uses the Alt 3 accelerator key.

It will be inactive until you open and close the "view" menu (that is a CONDITIONAL_MENU menu).

Revision history for this message
Jeff Young (jeyjey) wrote :

@JP, the Hotkeys should be completely handled inside the TOOL_DISPATCHER; wxWidgets shouldn't be involved at all.

Are alt-keys handled differently? Does the bug reproduce if you assign a different hotkey?

Revision history for this message
Jeff Young (jeyjey) wrote :

The call-stack /should/ look like this:

TOOL_DISPATCHER::DispatchWxEvent()
TOOL_MANAGER::ProcessEvent()
TOOL_MANAGER::processEvent()
TOOL_MANAGER::dispatchStandardEvents()
ACTION_MANAGER::RunHotKey()

Revision history for this message
Jeff Young (jeyjey) wrote :

(and we should probably rename dispatchStandardEvents() to dispatchHotKeys()...)

Revision history for this message
jean-pierre charras (jp-charras) wrote :

The issue is not related to Alt key: any other key has this issue.

- If the CONDITIONAL_MENU View menu was not previously open, the RunHotKey() is called, but does not find any hotkey in list.
Where is stored the *hotkey* for the ID_OPEN_MODULE_VIEWER menuitem?
I am not able to find it (outside the menuitem created when creating the toolbar, but this menu is not in list until the first time the View menu is open).

- If the CONDITIONAL_MENU View menu was previously open, the RunHotKey() is *not* called on Windows, and the event associated to ID_OPEN_MODULE_VIEWER id is called by wxWidgets.

"the Hotkeys should be completely handled inside the TOOL_DISPATCHER"
True for hotkeys, false for accelerator keys (This is a long standing problem for us in Kicad)

On Windows, when a accelerator key is found in a menu, the OnChar key event is not generated.
(Not true on Linux, I don't know on OSX)

Revision history for this message
Jeff Young (jeyjey) wrote :

Ahh... so the issue is that there isn't a hotkey defined. It's just running an accelerator. I should be able to fix that.

(I think the "right" way to work around the accelerator issue is to ignore them -- everything should be a hotkey. Or would we just have other issues then?)

Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: Triaged → In Progress
Revision history for this message
Jeff Young (jeyjey) wrote :

Actually, the change I've already committed for the other GTK menu issues should fix this. But that's no reason not to make 3D Viewer a real hotkey....

Revision history for this message
Jeff Young (jeyjey) wrote :

I think my comment in #10 is wrong. There is a hotkey defined (pcbnew/hotkeys.cpp:240).

But there's no entry in the TranslateLegacyHotkeys() map (which appears to be needed if the hotkey isn't attached to an action).

Rather than add an entry in TranslateLegacyHotkeys() I'm just going to make 3D viewer an ACTION. Everything should be anyway.

I believe my comment in #11 is still correct, though.

Revision history for this message
Nick Østergaard (nickoe) wrote :

Fixed in 45a9544726fd6858a03ee4914ea60e0e3db7591a

Changed in kicad:
status: In Progress → Fix Committed
Revision history for this message
Oleg Endo (oleg.endo) wrote :

Now it opens a new 3D view every time when pressing Alt+3 or using the menu. Before it was activating the window if it was already open.

Sometimes it would also open 2 3D views when pressing Alt+3. However that behavior was gone after restarting pcbnew ...

Application: Pcbnew
Version: 6.0.0-unknown-15241b7~86~ubuntu18.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-51-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.4.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.