Index: ash/wm/toplevel_window_event_filter.cc |
diff --git a/ash/wm/toplevel_window_event_filter.cc b/ash/wm/toplevel_window_event_filter.cc |
index 5909203a118454894c38d00517709f11041579a3..a79f91f24a01a2bc6410881a2b165d736dd7ed8d 100644 |
--- a/ash/wm/toplevel_window_event_filter.cc |
+++ b/ash/wm/toplevel_window_event_filter.cc |
@@ -96,12 +96,15 @@ void ToplevelWindowEventFilter::ScopedWindowResizer::OnWindowDestroying( |
ToplevelWindowEventFilter::ToplevelWindowEventFilter(aura::Window* owner) |
: in_move_loop_(false), |
+ move_cancelled_(false), |
in_gesture_resize_(false), |
grid_size_(0) { |
aura::client::SetWindowMoveClient(owner, this); |
+ Shell::GetInstance()->display_controller()->AddObserver(this); |
} |
ToplevelWindowEventFilter::~ToplevelWindowEventFilter() { |
+ Shell::GetInstance()->display_controller()->RemoveObserver(this); |
} |
bool ToplevelWindowEventFilter::PreHandleKeyEvent(aura::Window* target, |
@@ -249,10 +252,12 @@ ui::EventResult ToplevelWindowEventFilter::PreHandleGestureEvent( |
return ui::ER_CONSUMED; |
} |
-void ToplevelWindowEventFilter::RunMoveLoop(aura::Window* source, |
- const gfx::Point& drag_offset) { |
+aura::client::WindowMoveResult ToplevelWindowEventFilter::RunMoveLoop( |
+ aura::Window* source, |
+ const gfx::Point& drag_offset) { |
DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. |
in_move_loop_ = true; |
+ move_cancelled_ = false; |
aura::RootWindow* root_window = source->GetRootWindow(); |
DCHECK(root_window); |
gfx::Point drag_location; |
@@ -276,6 +281,8 @@ void ToplevelWindowEventFilter::RunMoveLoop(aura::Window* source, |
run_loop.Run(); |
#endif // !defined(OS_MACOSX) |
in_gesture_resize_ = in_move_loop_ = false; |
+ return move_cancelled_ ? aura::client::MOVE_CANCELED : |
+ aura::client::MOVE_SUCCESSFUL; |
} |
void ToplevelWindowEventFilter::EndMoveLoop() { |
@@ -290,6 +297,16 @@ void ToplevelWindowEventFilter::EndMoveLoop() { |
quit_closure_.Run(); |
} |
+void ToplevelWindowEventFilter::OnDisplayConfigurationChanging() { |
+ if (in_move_loop_) { |
+ move_cancelled_ = true; |
+ EndMoveLoop(); |
+ } else if (window_resizer_.get()) { |
+ window_resizer_->resizer()->RevertDrag(); |
+ window_resizer_.reset(); |
+ } |
+} |
+ |
// static |
WindowResizer* ToplevelWindowEventFilter::CreateWindowResizer( |
aura::Window* window, |