Chromium Code Reviews| 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 146a9085eea5339547315c29b3d242820c99ede8..bb203a941652d44f62894ec1a1f677d2bee04cce 100644 |
| --- a/ash/wm/toplevel_window_event_filter.cc |
| +++ b/ash/wm/toplevel_window_event_filter.cc |
| @@ -47,12 +47,15 @@ gfx::Point ConvertPointToParent(aura::Window* window, |
| 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, |
| @@ -202,10 +205,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; |
| @@ -230,6 +235,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() { |
| @@ -244,6 +251,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_->RevertDrag(); |
|
sky
2012/09/05 22:45:37
Does this do the right thing if you're dragging a
|
| + window_resizer_.reset(); |
| + } |
| +} |
| + |
| // static |
| WindowResizer* ToplevelWindowEventFilter::CreateWindowResizer( |
| aura::Window* window, |