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

Unified Diff: ui/base/event.h

Issue 10830293: Fixes bug where Env/RootWindow would cache the wrong button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to trunk Created 8 years, 4 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/aura/root_window.cc ('k') | ui/base/event.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/event.h
diff --git a/ui/base/event.h b/ui/base/event.h
index ef468e7092923550dae0eb618ef6a593a4080403..ef53a19a6db31c6acf27b7842eeed96913740f55 100644
--- a/ui/base/event.h
+++ b/ui/base/event.h
@@ -187,7 +187,8 @@ class UI_EXPORT MouseEvent : public LocatedEvent {
// converted from |source| coordinate system to |target| coordinate system.
template <class T>
MouseEvent(const MouseEvent& model, T* source, T* target)
- : LocatedEvent(model, source, target) {
+ : LocatedEvent(model, source, target),
+ changed_button_flags_(model.changed_button_flags_) {
}
template <class T>
@@ -196,7 +197,8 @@ class UI_EXPORT MouseEvent : public LocatedEvent {
T* target,
EventType type,
int flags)
- : LocatedEvent(model, source, target) {
+ : LocatedEvent(model, source, target),
+ changed_button_flags_(model.changed_button_flags_) {
set_type(type);
set_flags(flags);
}
@@ -247,16 +249,27 @@ class UI_EXPORT MouseEvent : public LocatedEvent {
// Set the click count for a mousedown message. Can be 1, 2 or 3.
void SetClickCount(int click_count);
+ // Identifies the button that changed. During a press this corresponds to the
+ // button that was pressed and during a release this corresponds to the button
+ // that was released.
+ // NOTE: during a press and release flags() contains the complete set of
+ // flags. Use this to determine the button that was pressed or released.
+ int changed_button_flags() const { return changed_button_flags_; }
+
protected:
explicit MouseEvent(const MouseEvent& model);
private:
- gfx::Point root_location_;
-
- static MouseEvent* last_click_event_;
// Returns the repeat count based on the previous mouse click, if it is
// recent enough and within a small enough distance.
static int GetRepeatCount(const MouseEvent& click_event);
+
+ gfx::Point root_location_;
+
+ // See description above getter for details.
+ int changed_button_flags_;
+
+ static MouseEvent* last_click_event_;
};
class UI_EXPORT TouchEvent : public LocatedEvent {
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/base/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698