Commit 7a75d73b authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

wm: Better looking animation for fling to minimize maximized windows.

It wasn't matching the regular fling to minimize normal window animation,
even if the maximized windows was sized to look like a normal window
(happens during drag). That was because on complete it restores the
window, which triggers another animation, and then minimizes, so the
resulting animation is something in between.

For drag to unmaximize, the restore bounds animation can actually be
disabled as the window bounds are already set to the restore location.

Test: manual
Change-Id: Idca3efeb1b9392805430342770c9263e04a3d2cb
Fixed: 1084355
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2289356Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787924}
parent e905bccc
......@@ -12,6 +12,7 @@
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/scoped_animation_disabler.h"
#include "ash/screen_util.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
......@@ -701,6 +702,11 @@ void WorkspaceWindowResizer::CompleteDrag() {
// window at the bounds that the user has moved/resized the
// window to.
window_state()->SaveCurrentBoundsForRestore();
// Since we saved the current bounds to the restore bounds, the restore
// animation will use the current bounds as the target bounds, so we can
// disable the animation here.
ScopedAnimationDisabler disabler(window_state()->window());
window_state()->Restore();
}
return;
......@@ -710,7 +716,17 @@ void WorkspaceWindowResizer::CompleteDrag() {
// window here.
if (window_state()->IsMaximized()) {
DCHECK_EQ(HTCAPTION, details().window_component);
// Reaching here the only running animation should be the drag to
// unmaximize animation. Stop animating so that animations that might come
// after because of a gesture swipe or fling look smoother.
window_state()->window()->layer()->GetAnimator()->StopAnimating();
window_state()->SaveCurrentBoundsForRestore();
// Since we saved the current bounds to the restore bounds, the restore
// animation will use the current bounds as the target bounds, so we can
// disable the animation here.
ScopedAnimationDisabler disabler(window_state()->window());
window_state()->Restore();
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment