diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-14 19:17:35 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-14 19:17:35 +0000 |
commit | 56df4a026e3fe04bcd9de0d5a917378ae716aa9b (patch) | |
tree | 2a41c088c5e34efcd441c08fc3568ea34d51d90c /ui/base/x | |
parent | 615fa664ca14392b278777f27eb87a930cbafea1 (diff) | |
download | chromium_src-56df4a026e3fe04bcd9de0d5a917378ae716aa9b.zip chromium_src-56df4a026e3fe04bcd9de0d5a917378ae716aa9b.tar.gz chromium_src-56df4a026e3fe04bcd9de0d5a917378ae716aa9b.tar.bz2 |
Fixes bug where Env/RootWindow would cache the wrong button
state. Specifically on a release they would cache MouseEvent::flags(),
which includes the buttons that were released. I've plumbed through
the ability to identify the button that was pressed/released.
I'll implement windows in a separate patch.
BUG=140102
TEST=none
R=ben@chromium.org, sadrul@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10830293
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/x')
-rw-r--r-- | ui/base/x/events_x.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc index bb36d92..fa55e5d 100644 --- a/ui/base/x/events_x.cc +++ b/ui/base/x/events_x.cc @@ -863,6 +863,29 @@ bool IsMouseEvent(const base::NativeEvent& native_event) { return false; } +int GetChangedMouseButtonFlagsFromNative( + const base::NativeEvent& native_event) { + switch (native_event->type) { + case ButtonPress: + case ButtonRelease: + return GetEventFlagsFromXState(native_event->xbutton.state); + case GenericEvent: { + XIDeviceEvent* xievent = + static_cast<XIDeviceEvent*>(native_event->xcookie.data); + switch (xievent->evtype) { + case XI_ButtonPress: + case XI_ButtonRelease: + return GetEventFlagsForButton(EventButtonFromNative(native_event)); + default: + break; + } + } + default: + break; + } + return 0; +} + int GetMouseWheelOffset(const base::NativeEvent& native_event) { int button = native_event->type == GenericEvent ? EventButtonFromNative(native_event) : native_event->xbutton.button; |