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

Unified Diff: chrome/browser/ui/ash/event_rewriter.cc

Issue 144423006: Rewrite release event only if press event was rewritten for a given device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « chrome/browser/ui/ash/event_rewriter.h ('k') | chrome/browser/ui/ash/event_rewriter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/event_rewriter.cc
diff --git a/chrome/browser/ui/ash/event_rewriter.cc b/chrome/browser/ui/ash/event_rewriter.cc
index d323f7404dcd7a6ac0a2a04835913bec51655c64..5912b1ee76bb4ab13ed4e5db0d88af7d467ff803 100644
--- a/chrome/browser/ui/ash/event_rewriter.cc
+++ b/chrome/browser/ui/ash/event_rewriter.cc
@@ -1003,15 +1003,20 @@ void EventRewriter::RewriteLocatedEvent(ui::LocatedEvent* event) {
xievent->mods.effective = remapped_native_modifiers;
// Then, remap Alt+Button1 to Button3.
- if ((xievent->mods.effective & Mod1Mask) && xievent->detail == 1) {
+ if ((xievent->evtype == XI_ButtonPress ||
+ pressed_device_ids_.count(xievent->sourceid)) &&
+ (xievent->mods.effective & Mod1Mask) && xievent->detail == Button1) {
xievent->mods.effective &= ~Mod1Mask;
- xievent->detail = 3;
+ xievent->detail = Button3;
if (xievent->evtype == XI_ButtonRelease) {
// On the release clear the left button from the existing state and the
// mods, and set the right button.
- XISetMask(xievent->buttons.mask, 3);
- XIClearMask(xievent->buttons.mask, 1);
+ XISetMask(xievent->buttons.mask, Button3);
+ XIClearMask(xievent->buttons.mask, Button1);
xievent->mods.effective &= ~Button1Mask;
+ pressed_device_ids_.erase(xievent->sourceid);
+ } else {
+ pressed_device_ids_.insert(xievent->sourceid);
}
}
« no previous file with comments | « chrome/browser/ui/ash/event_rewriter.h ('k') | chrome/browser/ui/ash/event_rewriter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698