Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
index 4bf96b13e64f48665d2ce3efc5bad67496c5973c..3fe19bcff10f83ea12bfdeaffc59d153c3a6146a 100644 |
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
@@ -921,6 +921,9 @@ gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { |
} |
void DesktopWindowTreeHostX11::SetCapture() { |
+ if (HasCapture()) |
+ return; |
+ |
// Grabbing the mouse is asynchronous. However, we synchronously start |
// forwarding all mouse events received by Chrome to the |
// aura::WindowEventDispatcher which has capture. This makes capture |
@@ -928,9 +931,10 @@ void DesktopWindowTreeHostX11::SetCapture() { |
// - |g_current_capture|'s X window has capture. |
// OR |
// - The topmost window underneath the mouse is managed by Chrome. |
- if (g_current_capture) |
- g_current_capture->OnHostLostWindowCapture(); |
+ DesktopWindowTreeHostX11* old_capturer = g_current_capture; |
g_current_capture = this; |
+ if (old_capturer) |
+ old_capturer->OnHostLostWindowCapture(); |
unsigned int event_mask = PointerMotionMask | ButtonReleaseMask | |
ButtonPressMask; |