From 78afa495614fae7b0cd44f0b501b03daadf39ef9 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Thu, 9 Apr 2026 15:02:00 -0400 Subject: [PATCH] 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 Tested-by: Commit checker robot --- src/kits/interface/Window.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 602945481f..2bb6f06ace 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -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;