Index: ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
diff --git a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
index 20c061bd670c2914ab5836afc15edd6c790f8aa2..fd4b214e106f338a987c4ce486368dd5002b50c3 100644 |
--- a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
+++ b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
@@ -50,6 +50,7 @@ X11WholeScreenMoveLoop::X11WholeScreenMoveLoop( |
X11WholeScreenMoveLoopDelegate* delegate) |
: delegate_(delegate), |
in_move_loop_(false), |
+ should_reset_mouse_flags_(false), |
grab_input_window_(None) { |
} |
@@ -113,7 +114,11 @@ bool X11WholeScreenMoveLoop::RunMoveLoop(aura::Window* source, |
// We are handling a mouse drag outside of the aura::RootWindow system. We |
// must manually make aura think that the mouse button is pressed so that we |
// don't draw extraneous tooltips. |
- aura::Env::GetInstance()->set_mouse_button_flags(ui::EF_LEFT_MOUSE_BUTTON); |
+ aura::Env* env = aura::Env::GetInstance(); |
+ if (!env->IsMouseButtonDown()) { |
+ env->set_mouse_button_flags(ui::EF_LEFT_MOUSE_BUTTON); |
+ should_reset_mouse_flags_ = true; |
+ } |
base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop); |
@@ -133,7 +138,10 @@ void X11WholeScreenMoveLoop::EndMoveLoop() { |
return; |
// We undo our emulated mouse click from RunMoveLoop(); |
- aura::Env::GetInstance()->set_mouse_button_flags(0); |
+ if (should_reset_mouse_flags_) { |
+ aura::Env::GetInstance()->set_mouse_button_flags(0); |
+ should_reset_mouse_flags_ = false; |
+ } |
// TODO(erg): Is this ungrab the cause of having to click to give input focus |
// on drawn out windows? Not ungrabbing here screws the X server until I kill |