d02c9f8bc6
* chore: bump chromium in DEPS to 111.0.5522.0 * chore: bump chromium in DEPS to 111.0.5524.0 * chore: bump chromium in DEPS to 111.0.5526.0 * chore: bump chromium in DEPS to 111.0.5528.0 * chore: update patches/chromium/mas_avoid_usage_of_private_macos_apis.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4132807 Fix simple code shear * chore: update patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4130675 Fix simple code shear * chore: update patches/chromium/hack_plugin_response_interceptor_to_point_to_electron.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4144281 Fix simple code shear; applied cleanly w/patch-fuzz * chore: update patches/chromium/disable_unload_metrics.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4126173 Fix simple code shear; applied cleanly w/patch-fuzz * chore: update patches/chromium/feat_add_data_parameter_to_processsingleton.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4144281 Fix simple code shear; applied cleanly w/patch-fuzz * chore: update patches/chromium/preconnect_manager.patch https://chromium-review.googlesource.com/c/chromium/src/+/4144281 Fix simple code shear; applied cleanly w/patch-fuzz * chore: update patches/v8/force_cppheapcreateparams_to_be_noncopyable.patch https://chromium-review.googlesource.com/c/v8/v8/+/3533019 Fix simple code shear; applied cleanly w/patch-fuzz * chore: update patches * chore: update patches/chromium/add_maximized_parameter_to_linuxui_getwindowframeprovider.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4128765 Upstream added a new call to HeaderContext(), whose signature we have patched * chore: bump chromium in DEPS to 111.0.5530.0 * chore: update patches * Move ChildProcessHost* from content/common to content/browser Xref: Move ChildProcessHost* from content/common to content/browser * Remove RenderViewHostChanged Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4134103 [upstream removal of RenderViewHostChanged] Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4092763 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4093234 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133892 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4134103 [examples of upstream code adjusting to the change] Upstream handles this change in roughly two approaches: 1. Move the code over to RenderFrameHostChanged(old_host, new_host) but test for new_host->IsInPrimaryMainFrame() before acting 2. Migrate to the PrimaryPageChanged(page) API and use page.GetMainDocument() to get the RenderFrameHost. I've chosen 1. because electron_api_web_contents needed that pointer to old_host to call RemoveInputEventListener(), but I may be missing some context & would appreciate review on this commit. * Make electron/shell/browser/relauncher_win.cc use <winternl.h> Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4129135 Many internal Windows types are now available in winternl.h so upstrem no longer defines the types themselves. * Move ChildProcessHost* from content/common to content/browser Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4134795 * fixup! Make electron/shell/browser/relauncher_win.cc use <winternl.h> winternl.h does not define the field we need, so clone the struct Chromium was using into unnamed namespace * fixup! Move ChildProcessHost* from content/common to content/browser chore: update #includes too * chore: bump chromium in DEPS to 111.0.5532.0 * chore: sync patches/chromium/pepper_plugin_support.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133323 manually reync patch; no code changes * chore: sync patches/chromium/mas_no_private_api.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4143865 the content/common/pseudonymization_salt.cc patch is no longer needed * chore: sync patches/chromium/mas_disable_remote_accessibility.patch patch-fuzz update; no manual changes * chore: sync patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4111725 manually reync patch; no code changes * chore: sync patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133323 manually reync patch; no code changes * chore: sync patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch Xref: https://chromium-review.googlesource.com/c/v8/v8/+/4127230 patch-fuzz update; no manual changes * chore: rebuild patches * fixup! Remove RenderViewHostChanged Use PrimaryPageChanged() * chore: remove unused method TabsUpdateFunction::OnExecuteCodeFinished() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133991 This private, already-unused function showed up as a FTBFS because it took a base::ListValue parameter and ListValue was removed upstream. * task posting v3: remove includes of runner handles and IWYU task runners Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4133323 * chore: lint * chore: more lint * fixup! task posting v3: remove includes of runner handles and IWYU task runners macOS, too * fixup! task posting v3: remove includes of runner handles and IWYU task runners * chore: bump chromium in DEPS to 111.0.5534.0 * chore: sync patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4141862 patch-fuzz update; no manual changes * chore: sync patches/chromium/logging_win32_only_create_a_console_if_logging_to_stderr.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4153110 Sync to minor upstream changes. Add const correctness. * chore: sync electron/patches/chromium/feat_configure_launch_options_for_service_process.patch https://chromium-review.googlesource.com/c/chromium/src/+/4141862 patch-fuzz update; no manual changes * chore: patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch sync https://chromium-review.googlesource.com/c/v8/v8/+/4147787 patch-fuzz update; no manual changes * chore: update patches * chore: bump chromium in DEPS to 111.0.5536.0 * chore: sync patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4141863 Sync with upstream code changes. Minor code golf for readability. Note: upstream is laying groundwork for being able to work off of env vars instead of switches. Doesn't affect us yet but worth being aware of. > + // Environment variables could be supported in the future, but are not > + // currently supported when launching with the zygote. * chore: update patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4126836 patch-fuzz update; no manual changes * chore: sync electron/patches/chromium/feat_configure_launch_options_for_service_process.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4141863 manual sync * chore: sync electron/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch https://chromium-review.googlesource.com/c/v8/v8/+/4147788 fuzz-patch * chore: rebuild patches * chore: bump chromium in DEPS to 111.0.5538.0 * chore: bump chromium in DEPS to 111.0.5540.0 * chore: update patches * Remove sdk_forward_declarations https://chromium-review.googlesource.com/c/chromium/src/+/4166680 * task posting v3: Remove task runner handles from codebase entirely Refs https://chromium-review.googlesource.com/c/chromium/src/+/4150928 * Cleanup child_process_launcher_helper* Refs https://chromium-review.googlesource.com/c/chromium/src/+/4141863 * fix: utilityprocess spec on macOS * fix: build on windows Refs https://chromium-review.googlesource.com/c/chromium/src/+/4141863 * chore: fix lint * chore: bump chromium 111.0.5544.3 * chore: gen filenames.libcxx.gni * Add check for Executable+Writable handles in renderer processes. Refs https://chromium-review.googlesource.com/c/chromium/src/+/3774416 * fixup! Add check for Executable+Writable handles in renderer processes. * 4143761: [110] Disable SwiftShader for WebGL on M1 Macs. https://chromium-review.googlesource.com/c/chromium/src/+/4143761 (cherry picked from commit 2f74db3c2139424c416f92d9169aeaa8a2f9c1ec) * chore: bump chromium to 111.0.5555.0 * 56085: Remove hmac.h include from ssl.h. https://boringssl-review.googlesource.com/c/boringssl/+/56085 * 4167020: Remove forwarding headers https://chromium-review.googlesource.com/c/chromium/src/+/4167020 * chore: bump chromium to 111.0.5559.0 * 4181044: Restrict WebCursor usage to RenderWidgetHostViewAura https://chromium-review.googlesource.com/c/chromium/src/+/4181044 * 4189437: views: rename ink_drop_host_view to ink_drop_host https://chromium-review.googlesource.com/c/chromium/src/+/4189437 * chore: bump chromium to 111.0.5560.0 * 4167016: win7dep: remove non aeroglass code https://chromium-review.googlesource.com/c/chromium/src/+/4167016 * fixup after rebase: Remove forwarding header s https://chromium-review.googlesource.com/c/chromium/src/+/4167020 * 4125755: Reland "Reject getDisplayMedia calls without user activation" https://chromium-review.googlesource.com/c/chromium/src/+/4125755 * test: add workaround * chore: update patches * fix: alter coreModuleRegExp to prevent arm crash * Revert "fix: alter coreModuleRegExp to prevent arm crash" This reverts commit 7e50630c98137831a711c5abdbc8809e60cf1d73. * 4218354: Disable the use of preserve_most on arm64 Windows https://chromium-review.googlesource.com/c/v8/v8/+/4218354 * chore: review changes --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
364 lines
18 KiB
Diff
364 lines
18 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jeremy Apthorp <jeremya@chromium.org>
|
|
Date: Wed, 10 Oct 2018 15:07:34 -0700
|
|
Subject: command-ismediakey.patch
|
|
|
|
Override MediaKeysListener::IsMediaKeycode and associated functions to also listen for
|
|
Volume Up, Volume Down, and Mute.
|
|
|
|
Also apply electron/electron@0f67b1866a9f00b852370e721affa4efda623f3a
|
|
and electron/electron@d2368d2d3b3de9eec4cc32b6aaf035cc89921bf1 as
|
|
patches.
|
|
|
|
diff --git a/chrome/browser/extensions/global_shortcut_listener_ozone.cc b/chrome/browser/extensions/global_shortcut_listener_ozone.cc
|
|
index 2ac08809148beeb6bacccfc5e9f032c3a88eabe7..025082e5fa644f89cec42fd8a2b97d6f764f375f 100644
|
|
--- a/chrome/browser/extensions/global_shortcut_listener_ozone.cc
|
|
+++ b/chrome/browser/extensions/global_shortcut_listener_ozone.cc
|
|
@@ -58,7 +58,8 @@ bool GlobalShortcutListenerOzone::RegisterAcceleratorImpl(
|
|
const bool registered =
|
|
platform_global_shortcut_listener_->RegisterAccelerator(
|
|
accelerator.key_code(), accelerator.IsAltDown(),
|
|
- accelerator.IsCtrlDown(), accelerator.IsShiftDown());
|
|
+ accelerator.IsCtrlDown(), accelerator.IsShiftDown(),
|
|
+ accelerator.IsCmdDown());
|
|
if (registered)
|
|
registered_hot_keys_.insert(accelerator);
|
|
return registered;
|
|
@@ -72,14 +73,15 @@ void GlobalShortcutListenerOzone::UnregisterAcceleratorImpl(
|
|
|
|
platform_global_shortcut_listener_->UnregisterAccelerator(
|
|
accelerator.key_code(), accelerator.IsAltDown(), accelerator.IsCtrlDown(),
|
|
- accelerator.IsShiftDown());
|
|
+ accelerator.IsShiftDown(), accelerator.IsCmdDown());
|
|
registered_hot_keys_.erase(accelerator);
|
|
}
|
|
|
|
void GlobalShortcutListenerOzone::OnKeyPressed(ui::KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) {
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) {
|
|
int modifiers = 0;
|
|
if (is_alt_down)
|
|
modifiers |= ui::EF_ALT_DOWN;
|
|
@@ -87,6 +89,8 @@ void GlobalShortcutListenerOzone::OnKeyPressed(ui::KeyboardCode key_code,
|
|
modifiers |= ui::EF_CONTROL_DOWN;
|
|
if (is_shift_down)
|
|
modifiers |= ui::EF_SHIFT_DOWN;
|
|
+ if (is_cmd_down)
|
|
+ modifiers |= ui::EF_COMMAND_DOWN;
|
|
|
|
NotifyKeyPressed(ui::Accelerator(key_code, modifiers));
|
|
}
|
|
diff --git a/chrome/browser/extensions/global_shortcut_listener_ozone.h b/chrome/browser/extensions/global_shortcut_listener_ozone.h
|
|
index 3c2fc1707e38345c114e140104ffc5a93d704918..40dac9fd7beb7a1a589a479a8035391d4a32cbb8 100644
|
|
--- a/chrome/browser/extensions/global_shortcut_listener_ozone.h
|
|
+++ b/chrome/browser/extensions/global_shortcut_listener_ozone.h
|
|
@@ -46,7 +46,8 @@ class GlobalShortcutListenerOzone
|
|
void OnKeyPressed(ui::KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) override;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) override;
|
|
void OnPlatformListenerDestroyed() override;
|
|
|
|
bool is_listening_ = false;
|
|
diff --git a/chrome/browser/extensions/global_shortcut_listener_win.cc b/chrome/browser/extensions/global_shortcut_listener_win.cc
|
|
index 943168e2c72c0aeb59f1ea21b14f2dc8e6cfd7e0..db3ca2ed0ba0994caa4d26436b942166a2d4b1a4 100644
|
|
--- a/chrome/browser/extensions/global_shortcut_listener_win.cc
|
|
+++ b/chrome/browser/extensions/global_shortcut_listener_win.cc
|
|
@@ -62,6 +62,8 @@ void GlobalShortcutListenerWin::OnWndProc(HWND hwnd,
|
|
modifiers |= (LOWORD(lparam) & MOD_SHIFT) ? ui::EF_SHIFT_DOWN : 0;
|
|
modifiers |= (LOWORD(lparam) & MOD_ALT) ? ui::EF_ALT_DOWN : 0;
|
|
modifiers |= (LOWORD(lparam) & MOD_CONTROL) ? ui::EF_CONTROL_DOWN : 0;
|
|
+ modifiers |= (LOWORD(lparam) & MOD_WIN) ? ui::EF_COMMAND_DOWN : 0;
|
|
+
|
|
ui::Accelerator accelerator(
|
|
ui::KeyboardCodeForWindowsKeyCode(key_code), modifiers);
|
|
|
|
@@ -92,6 +94,7 @@ bool GlobalShortcutListenerWin::RegisterAcceleratorImpl(
|
|
modifiers |= accelerator.IsShiftDown() ? MOD_SHIFT : 0;
|
|
modifiers |= accelerator.IsCtrlDown() ? MOD_CONTROL : 0;
|
|
modifiers |= accelerator.IsAltDown() ? MOD_ALT : 0;
|
|
+ modifiers |= accelerator.IsCmdDown() ? MOD_WIN : 0;
|
|
|
|
// Create an observer that registers a hot key for |accelerator|.
|
|
std::unique_ptr<gfx::SingletonHwndHotKeyObserver> observer =
|
|
diff --git a/content/browser/media/media_keys_listener_manager_impl.cc b/content/browser/media/media_keys_listener_manager_impl.cc
|
|
index f855a6f083d7f0de1aa2ac26e6032917e2a984c8..2901d408d154a86f0df838314e54c17c208ac573 100644
|
|
--- a/content/browser/media/media_keys_listener_manager_impl.cc
|
|
+++ b/content/browser/media/media_keys_listener_manager_impl.cc
|
|
@@ -297,6 +297,11 @@ void MediaKeysListenerManagerImpl::UpdateSystemMediaControlsEnabledControls() {
|
|
case ui::VKEY_MEDIA_STOP:
|
|
system_media_controls_->SetIsStopEnabled(should_enable);
|
|
break;
|
|
+ case ui::VKEY_VOLUME_DOWN:
|
|
+ case ui::VKEY_VOLUME_UP:
|
|
+ case ui::VKEY_VOLUME_MUTE:
|
|
+ // Do nothing.
|
|
+ break;
|
|
default:
|
|
NOTREACHED();
|
|
}
|
|
diff --git a/ui/base/accelerators/media_keys_listener.cc b/ui/base/accelerators/media_keys_listener.cc
|
|
index db596585cbb44b3710636e3fc013f288966f604f..6d5557ee1a2c35ee15e695e024834184a525e2a7 100644
|
|
--- a/ui/base/accelerators/media_keys_listener.cc
|
|
+++ b/ui/base/accelerators/media_keys_listener.cc
|
|
@@ -13,7 +13,8 @@ MediaKeysListener::~MediaKeysListener() = default;
|
|
// static
|
|
bool MediaKeysListener::IsMediaKeycode(KeyboardCode key_code) {
|
|
return key_code == VKEY_MEDIA_PLAY_PAUSE || key_code == VKEY_MEDIA_STOP ||
|
|
- key_code == VKEY_MEDIA_PREV_TRACK || key_code == VKEY_MEDIA_NEXT_TRACK;
|
|
+ key_code == VKEY_MEDIA_PREV_TRACK || key_code == VKEY_MEDIA_NEXT_TRACK ||
|
|
+ key_code == VKEY_VOLUME_UP || key_code == VKEY_VOLUME_DOWN || key_code == VKEY_VOLUME_MUTE;
|
|
}
|
|
|
|
} // namespace ui
|
|
diff --git a/ui/base/accelerators/media_keys_listener_mac.mm b/ui/base/accelerators/media_keys_listener_mac.mm
|
|
index 49cdcc41ccc1d1f005520e7f26700a98e5123476..7710129240b17124c8a845e513e49c16daa839a0 100644
|
|
--- a/ui/base/accelerators/media_keys_listener_mac.mm
|
|
+++ b/ui/base/accelerators/media_keys_listener_mac.mm
|
|
@@ -34,6 +34,12 @@ KeyboardCode MediaKeyCodeToKeyboardCode(int key_code) {
|
|
case NX_KEYTYPE_NEXT:
|
|
case NX_KEYTYPE_FAST:
|
|
return VKEY_MEDIA_NEXT_TRACK;
|
|
+ case NX_KEYTYPE_SOUND_UP:
|
|
+ return VKEY_VOLUME_UP;
|
|
+ case NX_KEYTYPE_SOUND_DOWN:
|
|
+ return VKEY_VOLUME_DOWN;
|
|
+ case NX_KEYTYPE_MUTE:
|
|
+ return VKEY_VOLUME_MUTE;
|
|
}
|
|
return VKEY_UNKNOWN;
|
|
}
|
|
@@ -194,7 +200,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
|
|
int key_code = (data1 & 0xFFFF0000) >> 16;
|
|
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
|
|
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
|
|
- key_code != NX_KEYTYPE_REWIND) {
|
|
+ key_code != NX_KEYTYPE_REWIND &&
|
|
+ key_code != NX_KEYTYPE_SOUND_UP &&
|
|
+ key_code != NX_KEYTYPE_SOUND_DOWN &&
|
|
+ key_code != NX_KEYTYPE_MUTE) {
|
|
return event;
|
|
}
|
|
|
|
diff --git a/ui/base/x/x11_global_shortcut_listener.cc b/ui/base/x/x11_global_shortcut_listener.cc
|
|
index 8b0bcbe458f44431385cedb89f988756d89636b6..bc10cf442edf14cd43714707565aae9475cb8112 100644
|
|
--- a/ui/base/x/x11_global_shortcut_listener.cc
|
|
+++ b/ui/base/x/x11_global_shortcut_listener.cc
|
|
@@ -31,11 +31,13 @@ const x11::ModMask kModifiersMasks[] = {
|
|
|
|
x11::ModMask GetNativeModifiers(bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) {
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) {
|
|
constexpr auto kNoMods = x11::ModMask{};
|
|
return (is_shift_down ? x11::ModMask::Shift : kNoMods) |
|
|
(is_ctrl_down ? x11::ModMask::Control : kNoMods) |
|
|
- (is_alt_down ? x11::ModMask::c_1 : kNoMods);
|
|
+ (is_alt_down ? x11::ModMask::c_1 : kNoMods) |
|
|
+ (is_cmd_down ? x11::ModMask::c_4 : kNoMods);
|
|
}
|
|
|
|
} // namespace
|
|
@@ -81,8 +83,9 @@ uint32_t XGlobalShortcutListener::DispatchEvent(const PlatformEvent& event) {
|
|
bool XGlobalShortcutListener::RegisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) {
|
|
- auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down);
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) {
|
|
+ auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
|
|
auto keysym = XKeysymForWindowsKeyCode(key_code, false);
|
|
auto keycode = connection_->KeysymToKeycode(keysym);
|
|
|
|
@@ -107,7 +110,7 @@ bool XGlobalShortcutListener::RegisterAccelerator(KeyboardCode key_code,
|
|
}
|
|
|
|
registered_combinations_.insert(
|
|
- Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down));
|
|
+ Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down));
|
|
|
|
return true;
|
|
}
|
|
@@ -115,8 +118,9 @@ bool XGlobalShortcutListener::RegisterAccelerator(KeyboardCode key_code,
|
|
void XGlobalShortcutListener::UnregisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) {
|
|
- auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down);
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) {
|
|
+ auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
|
|
auto keysym = XKeysymForWindowsKeyCode(key_code, false);
|
|
auto keycode = connection_->KeysymToKeycode(keysym);
|
|
|
|
@@ -124,7 +128,7 @@ void XGlobalShortcutListener::UnregisterAccelerator(KeyboardCode key_code,
|
|
connection_->UngrabKey({keycode, x_root_window_, modifiers | mask});
|
|
|
|
registered_combinations_.erase(
|
|
- Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down));
|
|
+ Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down));
|
|
}
|
|
|
|
void XGlobalShortcutListener::OnKeyPressEvent(const KeyEvent& event) {
|
|
@@ -134,14 +138,15 @@ void XGlobalShortcutListener::OnKeyPressEvent(const KeyEvent& event) {
|
|
const bool is_alt_down = event.flags() & EF_ALT_DOWN;
|
|
const bool is_ctrl_down = event.flags() & EF_CONTROL_DOWN;
|
|
const bool is_shift_down = event.flags() & EF_SHIFT_DOWN;
|
|
+ const bool is_cmd_down = event.flags() & EF_COMMAND_DOWN;
|
|
|
|
if (!base::Contains(
|
|
registered_combinations_,
|
|
- Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down))) {
|
|
+ Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down))) {
|
|
return;
|
|
}
|
|
|
|
- OnKeyPressed(key_code, is_alt_down, is_ctrl_down, is_shift_down);
|
|
+ OnKeyPressed(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
|
|
}
|
|
|
|
} // namespace ui
|
|
diff --git a/ui/base/x/x11_global_shortcut_listener.h b/ui/base/x/x11_global_shortcut_listener.h
|
|
index 7165e88ef78e0e1b4683a2ead588dc6529d085b8..a605cd8c1468be78172fed09eb227722b4832227 100644
|
|
--- a/ui/base/x/x11_global_shortcut_listener.h
|
|
+++ b/ui/base/x/x11_global_shortcut_listener.h
|
|
@@ -41,18 +41,21 @@ class COMPONENT_EXPORT(UI_BASE_X) XGlobalShortcutListener
|
|
virtual void OnKeyPressed(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) = 0;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) = 0;
|
|
|
|
void StartListening();
|
|
void StopListening();
|
|
bool RegisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down);
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down);
|
|
void UnregisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down);
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down);
|
|
|
|
private:
|
|
// Due to how system key grabbing works on X11, we have to be a bit greedy and
|
|
@@ -61,7 +64,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XGlobalShortcutListener
|
|
// and filter the incoming events against that registry before notifying the
|
|
// observer. This tuple describes the meaningful parts of the event; booleans
|
|
// 1, 2, and 3 hold states of Alt, Control, and Shift keys, respectively.
|
|
- using Accelerator = std::tuple<KeyboardCode, bool, bool, bool>;
|
|
+ using Accelerator = std::tuple<KeyboardCode, bool, bool, bool, bool>;
|
|
|
|
// Invoked when a global shortcut is pressed.
|
|
void OnKeyPressEvent(const KeyEvent& event);
|
|
diff --git a/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.cc b/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.cc
|
|
index d23310746bca13981d0099ce74c62459471db0e5..6ad79156e62dc60bdf20ef1acf53ec2425cb2bfe 100644
|
|
--- a/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.cc
|
|
+++ b/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.cc
|
|
@@ -26,27 +26,30 @@ void X11GlobalShortcutListenerOzone::StopListening() {
|
|
bool X11GlobalShortcutListenerOzone::RegisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) {
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) {
|
|
return XGlobalShortcutListener::RegisterAccelerator(
|
|
- key_code, is_alt_down, is_ctrl_down, is_shift_down);
|
|
+ key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
|
|
}
|
|
|
|
void X11GlobalShortcutListenerOzone::UnregisterAccelerator(
|
|
KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) {
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) {
|
|
return XGlobalShortcutListener::UnregisterAccelerator(
|
|
- key_code, is_alt_down, is_ctrl_down, is_shift_down);
|
|
+ key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
|
|
}
|
|
|
|
void X11GlobalShortcutListenerOzone::OnKeyPressed(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) {
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) {
|
|
if (delegate()) {
|
|
delegate()->OnKeyPressed(key_code, is_alt_down, is_ctrl_down,
|
|
- is_shift_down);
|
|
+ is_shift_down, is_cmd_down);
|
|
}
|
|
}
|
|
|
|
diff --git a/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.h b/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.h
|
|
index 4f7392e2019828caf374d7008068222aa366815f..bc1fcbb68c15d999caa991d678a6bb7473496d39 100644
|
|
--- a/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.h
|
|
+++ b/ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.h
|
|
@@ -28,17 +28,20 @@ class X11GlobalShortcutListenerOzone : public PlatformGlobalShortcutListener,
|
|
bool RegisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) override;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) override;
|
|
void UnregisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) override;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) override;
|
|
|
|
// ui::XGlobalShortcutListener:
|
|
void OnKeyPressed(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) override;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) override;
|
|
};
|
|
|
|
} // namespace ui
|
|
diff --git a/ui/ozone/public/platform_global_shortcut_listener.h b/ui/ozone/public/platform_global_shortcut_listener.h
|
|
index dd8bf45d0b7072178d97678565c023c0a6f9a6db..c6af8dbe1dee2d9c1552383b17c81ae12b5cc05c 100644
|
|
--- a/ui/ozone/public/platform_global_shortcut_listener.h
|
|
+++ b/ui/ozone/public/platform_global_shortcut_listener.h
|
|
@@ -20,7 +20,8 @@ class COMPONENT_EXPORT(OZONE_BASE) PlatformGlobalShortcutListenerDelegate {
|
|
virtual void OnKeyPressed(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) = 0;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) = 0;
|
|
// Called back when the platform implementation is destroyed.
|
|
virtual void OnPlatformListenerDestroyed() = 0;
|
|
|
|
@@ -52,11 +53,13 @@ class COMPONENT_EXPORT(OZONE_BASE) PlatformGlobalShortcutListener {
|
|
virtual bool RegisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) = 0;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) = 0;
|
|
virtual void UnregisterAccelerator(KeyboardCode key_code,
|
|
bool is_alt_down,
|
|
bool is_ctrl_down,
|
|
- bool is_shift_down) = 0;
|
|
+ bool is_shift_down,
|
|
+ bool is_cmd_down) = 0;
|
|
|
|
protected:
|
|
PlatformGlobalShortcutListenerDelegate* delegate() { return delegate_; }
|