Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: ui/wm/core/accelerator_filter.cc

Issue 1117173003: Converting (Alt+LeftClick -> RightClick) to (Search+LeftClick -> RightClick) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a test case for ignoring synthesized mouse events. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/wm/core/accelerator_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/accelerator_filter.cc
diff --git a/ui/wm/core/accelerator_filter.cc b/ui/wm/core/accelerator_filter.cc
index 12e91316d21ce81ce0c8906c851bf13f24cedf83..b2d11201cc9054739a84c5806a22fbd1bc15bb62 100644
--- a/ui/wm/core/accelerator_filter.cc
+++ b/ui/wm/core/accelerator_filter.cc
@@ -71,6 +71,19 @@ void AcceleratorFilter::OnKeyEvent(ui::KeyEvent* event) {
event->StopPropagation();
}
+void AcceleratorFilter::OnMouseEvent(ui::MouseEvent* event) {
+ // When a mouse event is interleaved between two key accelerators, we must
+ // store this event as an empty default accelerator in the accelerator
+ // history, so that the |AcceleratorController| can notice that something
+ // actually happened between those two key accelerators.
+ // Non-real synthesized mouse events should be ignored because we don't want
+ // them to interfere with tracking the key accelerator.
+ if (event->flags() & ui::EF_IS_SYNTHESIZED)
+ return;
+
+ accelerator_history_->StoreCurrentAccelerator(ui::Accelerator());
+}
+
ui::Accelerator CreateAcceleratorFromKeyEvent(const ui::KeyEvent& key_event) {
const int kModifierFlagMask =
(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN);
« no previous file with comments | « ui/wm/core/accelerator_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698