Index: ui/aura/root_window.cc |
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc |
index d7fb311be6419908602e5bff51d1fb109d8a2c59..da96dd28a37978c3fc928fd003e3c5a3700283c6 100644 |
--- a/ui/aura/root_window.cc |
+++ b/ui/aura/root_window.cc |
@@ -231,8 +231,13 @@ void RootWindow::SetCursor(gfx::NativeCursor cursor) { |
} |
void RootWindow::ShowCursor(bool show) { |
- cursor_shown_ = show; |
- host_->ShowCursor(show); |
+ // Send entered / exited so that visual state can be updated to match |
+ // cursor state. |
+ if (show != cursor_shown_) { |
+ cursor_shown_ = show; |
+ host_->ShowCursor(show); |
+ GetRootWindow()->SynthesizeMouseEvent(ui::ET_MOUSE_MOVED, show); |
+ } |
oshima
2012/08/06 03:24:24
I think it's better to change last_mouse_location
|
} |
void RootWindow::MoveCursorTo(const gfx::Point& location_in_dip) { |
@@ -1016,29 +1021,39 @@ void RootWindow::PostMouseMoveEventAfterWindowChange() { |
event_factory_.GetWeakPtr())); |
} |
-void RootWindow::SynthesizeMouseMoveEvent() { |
- if (!synthesize_mouse_move_) |
- return; |
- synthesize_mouse_move_ = false; |
+void RootWindow::SynthesizeMouseEvent(ui::EventType event_type, |
+ bool use_current_position) { |
#if !defined(OS_WIN) |
// Temporarily disabled for windows. See crbug.com/112222. |
- gfx::Point3f point(GetLastMouseLocationInRoot()); |
+ gfx::Point previous_last_mouse_position = |
+ Env::GetInstance()->last_mouse_location(); |
+ |
+ gfx::Point3f point(use_current_position ? |
+ GetLastMouseLocationInRoot() : gfx::Point(-1, -1)); |
oshima
2012/08/06 03:24:24
-1, -1 may still overlap a views' component. I'd s
|
ui::Transform transform = layer()->transform(); |
float scale = ui::GetDeviceScaleFactor(layer()); |
transform.ConcatScale(scale, scale); |
transform.TransformPoint(point); |
- gfx::Point orig_mouse_location = point.AsPoint(); |
+ gfx::Point mouse_location = point.AsPoint(); |
// TODO(derat|oshima): Don't use mouse_button_flags_ as it's |
// currently broken. See/ crbug.com/107931. |
- MouseEvent event(ui::ET_MOUSE_MOVED, |
- orig_mouse_location, |
- orig_mouse_location, |
+ MouseEvent event(event_type, |
+ mouse_location, |
+ mouse_location, |
ui::EF_IS_SYNTHESIZED); |
OnHostMouseEvent(&event); |
+ SetLastMouseLocation(this, previous_last_mouse_position); |
#endif |
} |
+void RootWindow::SynthesizeMouseMoveEvent() { |
+ if (!synthesize_mouse_move_) |
+ return; |
+ synthesize_mouse_move_ = false; |
+ SynthesizeMouseEvent(ui::ET_MOUSE_MOVED, true); |
+} |
+ |
void RootWindow::UnlockCompositor() { |
DCHECK(compositor_lock_); |
compositor_lock_ = NULL; |