[haiku-bugs] [Haiku] #15985: Allow BMenuItem shorcuts without the B_COMMAND_KEY modifier

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Fri, 08 May 2020 00:25:05 -0000

#15985: Allow BMenuItem shorcuts without the B_COMMAND_KEY modifier
-------------------------------------------------+-------------------------
 Reporter:  Manuel                               |       Owner:  stippi
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:
                                                 |  Unscheduled
Component:  User Interface                       |     Version:
                                                 |  R1/Development
 Keywords:  B_COMMAND_KEY, modifiers, shortcuts  |  Blocked By:
 Blocking:                                       |    Platform:  All
-------------------------------------------------+-------------------------
 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".
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/15985>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: