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

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: 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
Index: ui/aura/desktop.cc
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
index d08a062c1888b750b34f309433c89db179e8f453..1f068ed652010ac68a9ca8d739efe481986ed8db 100644
--- a/ui/aura/desktop.cc
+++ b/ui/aura/desktop.cc
@@ -149,6 +149,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),
@@ -229,6 +230,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();
@@ -244,9 +250,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;
@@ -395,6 +403,10 @@ void Desktop::RemoveObserver(DesktopObserver* observer) {
observers_.RemoveObserver(observer);
}
+bool Desktop::IsMouseButtonDown() const {
+ return mouse_button_flags_;
+}
+
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') | ui/aura/window_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698