From 4385f739962c852de851cf28145d96d001f48b33 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 25 Aug 2013 19:40:00 -0400 Subject: [PATCH] Revert "Menu: check numBytes == 1 on KeyDown" This reverts commit 44dc533861d5e6c8c80f3ed89d6dfb4b8a30c724. --- headers/os/interface/Menu.h | 1 - src/kits/interface/Menu.cpp | 35 +++++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/headers/os/interface/Menu.h b/headers/os/interface/Menu.h index bc808197df..bbca5c4d6d 100644 --- a/headers/os/interface/Menu.h +++ b/headers/os/interface/Menu.h @@ -268,7 +268,6 @@ private: int _State(BMenuItem** _item = NULL) const; void _InvokeItem(BMenuItem* item, bool now = false); - void _InvokeTrigger(const char* bytes); void _QuitTracking(bool onlyThis = true); static menu_info sMenuInfo; diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 202bd00f08..c80d4da80f 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -477,11 +477,6 @@ BMenu::MessageReceived(BMessage* msg) void BMenu::KeyDown(const char* bytes, int32 numBytes) { - if (numBytes != 1) { - _InvokeTrigger(bytes); - return; - } - // TODO: Test how it works on BeOS R5 and implement this correctly switch (bytes[0]) { case B_UP_ARROW: @@ -580,7 +575,19 @@ BMenu::KeyDown(const char* bytes, int32 numBytes) break; default: - _InvokeTrigger(bytes); + { + uint32 trigger = UTF8ToCharCode(&bytes); + + for (uint32 i = CountItems(); i-- > 0;) { + BMenuItem* item = ItemAt(i); + if (item->fTriggerIndex < 0 || item->fTrigger != trigger) + continue; + + _InvokeItem(item); + break; + } + break; + } } } @@ -2461,22 +2468,6 @@ BMenu::_InvokeItem(BMenuItem* item, bool now) } -void -BMenu::_InvokeTrigger(const char* bytes) -{ - uint32 trigger = UTF8ToCharCode(&bytes); - - for (uint32 i = CountItems(); i-- > 0;) { - BMenuItem* item = ItemAt(i); - if (item->fTriggerIndex < 0 || item->fTrigger != trigger) - continue; - - _InvokeItem(item); - break; - } -} - - bool BMenu::_OverSuper(BPoint location) {