BWindow: Only try to install new menu shortcuts if B_COMMAND_KEY is down.

This is too expensive to do on every key press, and became a problem
when #7078 was fixed in hrev58589. Fixes #19580.

Change-Id: Iff2d2c208fa976f1f5db6a369820d8210f2e4c4e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10706
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
John Scipione
2026-04-10 02:06:13 +00:00
committed by waddlesplash
parent bc415d41f1
commit 78afa49561
+6 -2
View File
@@ -3745,7 +3745,10 @@ BWindow::_HandleKeyDown(BMessage* event)
// chance to update its menus. This may install new shortcuts,
// which is why we have to call it here, before trying to find
// a shortcut for the given key.
MenusBeginning();
// Only do this if Command key is down, it's too expensive to
// do this on every key press.
if ((modifiers & B_COMMAND_KEY) != 0)
MenusBeginning();
Shortcut* shortcut = _FindShortcut(key, modifiers
| (((modifiers & B_COMMAND_KEY) == 0) ? B_NO_COMMAND_KEY : 0));
@@ -3781,7 +3784,8 @@ BWindow::_HandleKeyDown(BMessage* event)
}
}
MenusEnded();
if ((modifiers & B_COMMAND_KEY) != 0)
MenusEnded();
if (shortcut != NULL)
return true;