Opened 4 years ago

Closed 4 years ago

#15985 closed enhancement (duplicate)

Allow BMenuItem shorcuts without the B_COMMAND_KEY modifier

Reported by: Manuel Owned by: stippi
Priority: normal Milestone: Unscheduled
Component: User Interface Version: R1/Development
Keywords: B_COMMAND_KEY, modifiers, shortcuts Cc:
Blocked By: Blocking: #7078
Platform: All

Description

There is no way to create a shorcut for a BMenuItem without the B_COMMAND_KEY modifier because the BMenuItem constructor always OR'es the B_COMMAND_KEY mask to the modifier argument. This prevents the use of the Pause key, F1, F2, F3..., and many others by themselves, without modifiers, as keyboard shortcuts. For example, I am porting my NES emulator to Haiku, and on Linux and Windows I use the Pause key to pause the emulation, and F11 to switch to full screen.

The documentation states that B_COMMAND_KEY is assumed in absence of modifiers, so this behaviour can not be changed without breaking compatibility with existing applications that do not explicitly specify B_COMMAND_KEY as modifier when constructing a BMenuItem.

I think the usability loss is very serious and, as far the desired shortcut is not used by the system, for input focus change or navigation control, the programmer should be able to specify shortcuts without modifier keys or with modifiers not including B_COMMAND_KEY.

The BWindow::_HandleKeyDown member function takes care of detecting all those cases before handling BMenuItem shortcuts, which is the last thing it does before returning. So I think it's safe to allow shorcuts without modifiers and with modifier keys not including B_COMMAND_KEY without breaking compatibility with existing sofware.

I propose to add a new modifier mask, for example B_NO_COMMAND_KEY to instruct BMenuItem::BMenuItem to not do "modifiers | B_COMMAND_KEY", and to change BWindow::_HandleKeyDown to make it recognice shortcuts without "(modifiers & B_COMMAND_KEY) != 0".

Change History (1)

comment:1 by pulkomandy, 4 years ago

Blocking: 7078 added
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.