Skip to content

Commit

Permalink
fix: Fix broken globalShortcuts.registerAll() on non-macOS platforms (#…
Browse files Browse the repository at this point in the history
…20984)

This was a regression in #16125, which unintentionally put
`GlobalShortcutListener::RegisterAccelerator` into a
`#if defined(OS_MACOSX)` block.

Notes: Fix broken `globalShortcut.registerAll()` on Windows and Linux
  • Loading branch information
trop[bot] authored and codebytere committed Nov 7, 2019
1 parent ab6d22c commit bcabc25
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions shell/browser/api/atom_api_global_shortcut.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,13 @@ bool GlobalShortcut::RegisterAll(
std::vector<ui::Accelerator> registered;

for (auto& accelerator : accelerators) {
#if defined(OS_MACOSX)
if (RegisteringMediaKeyForUntrustedClient(accelerator))
return false;

GlobalShortcutListener* listener = GlobalShortcutListener::GetInstance();
if (!listener->RegisterAccelerator(accelerator, this)) {
if (!Register(accelerator, callback)) {
// unregister all shortcuts if any failed
UnregisterSome(registered);
return false;
}
#endif

registered.push_back(accelerator);
accelerator_callback_map_[accelerator] = callback;
}
return true;
}
Expand Down

0 comments on commit bcabc25

Please sign in to comment.