Skip to content

Using OA+O while menu showing is treated as OA+SA+O #796

@inexorabletash

Description

@inexorabletash

Describe the bug
MGTK supports using shortcuts (e.g. OA+O) while a menu is showing.

If the menu is invoked using the mouse, but then the shortcut is used, DeskTop gets confused about how to interpret the modifiers.

To Reproduce
Steps to reproduce the behavior:

  1. Start DeskTop
  2. Open a volume window
  3. Select a folder
  4. Using the mouse, click on the Apple Menu
  5. Hold Open Apple and press O

Expected behavior
The folder window opens.

Actual behavior
The folder window opens, but then the volume window closes!

Root cause
DeskTop sets a flag (menu_kbd_flag) before invoking MGTK::MenuSelect (false) or MGTK::MenuKey (true) and then checks it in CmdOpen:

  • If menu_kbd_flag is false, then the menu was invoked with the mouse:
    • If no modifier is down, treat this as CmdOpen
    • If a modifier is down, treat this as CmdOpenThenCloseCurrent
  • If menu_kbd_flag is true, then the menu was invoked with the keyboard; the caller already distinguished between single modifier as CmdOpen and double-modifier as CmdOpenThenCloseCurrent

This falls apart if the menu is invoked with the mouse, then the shortcut is used. MGTK doesn't tell the caller how the menu item was invoked, just which item was invoked.

This dates back to at least 1.3 so it isn't a regression, and I can't think of a safe fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeskTopDeskTop bugs or feature requestsbug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions