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

Unified Diff: ui/views/widget/widget.cc

Issue 1297373004: Don't synthesize mousemove events if the mouse cursor is not on the widget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change the property name and add a test Created 5 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/views/widget/widget.h ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 280969a84e5e7d0067d1f10378dec9d6d15061fb..c02d4ed2b25808ab5c3c3140d62ca87b39e51cf5 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -169,6 +169,7 @@ Widget::Widget()
is_top_level_(false),
native_widget_initialized_(false),
native_widget_destroyed_(false),
+ is_mouse_on_widget_(false),
is_mouse_button_pressed_(false),
ignore_capture_loss_(false),
last_mouse_event_was_move_(false),
@@ -988,6 +989,9 @@ gfx::Rect Widget::GetWorkAreaBoundsInScreen() const {
}
void Widget::SynthesizeMouseMoveEvent() {
+ if (!is_mouse_on_widget_)
+ return;
+
last_mouse_event_was_move_ = false;
ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, last_mouse_event_position_,
last_mouse_event_position_, ui::EventTimeForNow(),
@@ -1230,7 +1234,12 @@ void Widget::OnMouseEvent(ui::MouseEvent* event) {
}
return;
+ case ui::ET_MOUSE_ENTERED:
+ is_mouse_on_widget_ = true;
+ return;
+
case ui::ET_MOUSE_EXITED:
+ is_mouse_on_widget_ = false;
sky 2015/08/20 18:03:12 I'm worried we won't always get here. Say you clic
oshima 2015/08/21 01:00:15 For drag case, the mouse location is outside of th
last_mouse_event_was_move_ = false;
if (root_view)
root_view->OnMouseExited(*event);
« no previous file with comments | « ui/views/widget/widget.h ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698