Only use default accelerator in Windows/Linux app menu
This commit is contained in:
parent
6381f44f26
commit
2faf00dc19
21 changed files with 125 additions and 69 deletions
28
atom/browser/ui/views/menu_model_adapter.cc
Normal file
28
atom/browser/ui/views/menu_model_adapter.cc
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2016 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/views/menu_model_adapter.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
MenuModelAdapter::MenuModelAdapter(AtomMenuModel* menu_model)
|
||||
: views::MenuModelAdapter(menu_model),
|
||||
menu_model_(menu_model) {
|
||||
}
|
||||
|
||||
MenuModelAdapter::~MenuModelAdapter() {
|
||||
}
|
||||
|
||||
bool MenuModelAdapter::GetAccelerator(int id,
|
||||
ui::Accelerator* accelerator) const {
|
||||
ui::MenuModel* model = menu_model_;
|
||||
int index = 0;
|
||||
if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) {
|
||||
return static_cast<AtomMenuModel*>(model)->
|
||||
GetAcceleratorAtWithParams(index, true, accelerator);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace atom
|
Loading…
Add table
Add a link
Reference in a new issue