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) |
@@ -71,6 +71,7 @@ |
#include "ui/events/gestures/gesture_recognizer.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/display.h" |
+#include "ui/gfx/rect.h" |
#include "ui/gfx/rect_conversions.h" |
#include "ui/gfx/screen.h" |
#include "ui/gfx/size_conversions.h" |
@@ -2194,6 +2195,10 @@ |
} |
if (aura::client::GetTooltipClient(root_window)) |
aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); |
+#if defined(OS_WIN) |
+ RECT window_rect = window_->GetBoundsInScreen().ToRECT(); |
+ ::ClipCursor(&window_rect); |
scheib
2013/10/30 18:16:45
Yes, clipping to the window is necessary. It's als
ananta
2013/10/30 20:47:29
Good point. We have the ConfineCursorToWindow and
|
+#endif |
return true; |
} |
@@ -2218,6 +2223,9 @@ |
if (aura::client::GetTooltipClient(root_window)) |
aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); |
+#if defined(OS_WIN) |
+ ::ClipCursor(NULL); |
+#endif |
host_->LostMouseLock(); |
} |
@@ -2730,9 +2738,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) { |
scheib
2013/10/30 18:16:45
I can't comment here because I don't understand NO
|
+ 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(); |