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

Unified Diff: ui/aura/desktop.cc

Issue 8526020: aura: Track mouse button state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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/desktop.h ('k') | ui/aura/desktop_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/desktop.cc
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
index f502fde85052fcc3c1dc2358d071e4a595b7d99d..010acf4f3a55d6dca455c4d78cc62f3affcde5b7 100644
--- a/ui/aura/desktop.cc
+++ b/ui/aura/desktop.cc
@@ -151,6 +151,7 @@ Desktop::Desktop()
stacking_client_(new DefaultStackingClient(this))),
ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
active_window_(NULL),
+ mouse_button_flags_(0),
last_cursor_(kCursorNull),
in_destructor_(false),
screen_(new ScreenAura),
@@ -231,6 +232,11 @@ void Desktop::Draw() {
}
bool Desktop::DispatchMouseEvent(MouseEvent* event) {
+ static const int kMouseButtonFlagMask =
+ ui::EF_LEFT_BUTTON_DOWN |
+ ui::EF_MIDDLE_BUTTON_DOWN |
+ ui::EF_RIGHT_BUTTON_DOWN;
+
event->UpdateForTransform(layer()->transform());
last_mouse_location_ = event->location();
@@ -246,9 +252,11 @@ bool Desktop::DispatchMouseEvent(MouseEvent* event) {
case ui::ET_MOUSE_PRESSED:
if (!mouse_pressed_handler_)
mouse_pressed_handler_ = target;
+ mouse_button_flags_ = event->flags() & kMouseButtonFlagMask;
break;
case ui::ET_MOUSE_RELEASED:
mouse_pressed_handler_ = NULL;
+ mouse_button_flags_ = event->flags() & kMouseButtonFlagMask;
break;
default:
break;
@@ -399,6 +407,10 @@ void Desktop::RemoveObserver(DesktopObserver* observer) {
observers_.RemoveObserver(observer);
}
+bool Desktop::IsMouseButtonDown() const {
+ return mouse_button_flags_ != 0;
+}
+
void Desktop::SetCapture(Window* window) {
if (capture_window_ == window)
return;
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura/desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698