Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
=================================================================== |
--- content/browser/renderer_host/render_widget_host_view_aura.cc (revision 231601) |
+++ content/browser/renderer_host/render_widget_host_view_aura.cc (working copy) |
@@ -2170,7 +2170,8 @@ |
} |
bool RenderWidgetHostViewAura::LockMouse() { |
- aura::Window* root_window = window_->GetRootWindow(); |
+ aura::RootWindow* root_window = |
+ static_cast<aura::RootWindow*>(window_->GetRootWindow()); |
scheib
2013/10/30 21:23:07
Why doesn't GetRootWindow() return a RootWindow?
ananta
2013/10/30 21:43:15
Checked with sky and ben. The RootWindow class is
|
if (!root_window) |
return false; |
@@ -2194,11 +2195,14 @@ |
} |
if (aura::client::GetTooltipClient(root_window)) |
aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); |
+ |
+ root_window->ConfineCursorToWindow(); |
return true; |
} |
void RenderWidgetHostViewAura::UnlockMouse() { |
- aura::Window* root_window = window_->GetRootWindow(); |
+ aura::RootWindow* root_window = |
+ static_cast<aura::RootWindow*>(window_->GetRootWindow()); |
if (!mouse_locked_ || !root_window) |
return; |
@@ -2219,6 +2223,7 @@ |
aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); |
host_->LostMouseLock(); |
+ root_window->UnConfineCursor(); |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -2730,9 +2735,19 @@ |
return; |
} |
- WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); |
gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); |
+ // If we receive non client mouse messages while we are in the locked state |
+ // it probably means that the mouse left the borders of our window and |
+ // needs to be moved back to the center. |
+ if (event->flags() & ui::EF_IS_NON_CLIENT) { |
+ synthetic_move_sent_ = true; |
+ window_->MoveCursorTo(center); |
+ return; |
+ } |
+ |
+ WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); |
+ |
bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED || |
event->type() == ui::ET_MOUSE_DRAGGED) && |
mouse_event.x == center.x() && mouse_event.y == center.y(); |