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
|
@ -14,7 +14,6 @@
|
|||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "ui/base/models/simple_menu_model.h"
|
||||
|
||||
namespace accelerator_util {
|
||||
|
||||
|
@ -69,16 +68,17 @@ bool StringToAccelerator(const std::string& shortcut,
|
|||
return true;
|
||||
}
|
||||
|
||||
void GenerateAcceleratorTable(AcceleratorTable* table, ui::MenuModel* model) {
|
||||
void GenerateAcceleratorTable(AcceleratorTable* table,
|
||||
atom::AtomMenuModel* model) {
|
||||
int count = model->GetItemCount();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
ui::MenuModel::ItemType type = model->GetTypeAt(i);
|
||||
if (type == ui::MenuModel::TYPE_SUBMENU) {
|
||||
ui::MenuModel* submodel = model->GetSubmenuModelAt(i);
|
||||
atom::AtomMenuModel::ItemType type = model->GetTypeAt(i);
|
||||
if (type == atom::AtomMenuModel::TYPE_SUBMENU) {
|
||||
auto submodel = model->GetSubmenuModelAt(i);
|
||||
GenerateAcceleratorTable(table, submodel);
|
||||
} else {
|
||||
ui::Accelerator accelerator;
|
||||
if (model->GetAcceleratorAt(i, &accelerator)) {
|
||||
if (model->GetAcceleratorAtWithParams(i, true, &accelerator)) {
|
||||
MenuItem item = { i, model };
|
||||
(*table)[accelerator] = item;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue