From 06cfcd612da7bed8b14df7f0f697a91340abd504 Mon Sep 17 00:00:00 2001 From: liusi Date: Mon, 14 Nov 2016 12:29:27 +0800 Subject: [PATCH] disable accelerator when menu item is disabled --- atom/browser/ui/accelerator_util.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/atom/browser/ui/accelerator_util.cc b/atom/browser/ui/accelerator_util.cc index eb89bf0c35f5..a7877a9c90ae 100644 --- a/atom/browser/ui/accelerator_util.cc +++ b/atom/browser/ui/accelerator_util.cc @@ -90,11 +90,12 @@ bool TriggerAcceleratorTableCommand(AcceleratorTable* table, const ui::Accelerator& accelerator) { if (ContainsKey(*table, accelerator)) { const accelerator_util::MenuItem& item = (*table)[accelerator]; - item.model->ActivatedAt(item.position); - return true; - } else { - return false; + if (item.model->IsEnabledAt(item.position)) { + item.model->ActivatedAt(item.position); + return true; + } } + return false; } } // namespace accelerator_util