Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: ash/wm/workspace/workspace_animations.cc

Issue 11280188: Fix focus loss on partial lock. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixes after review Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/compositor/layer_animator.h » ('j') | ui/compositor/layer_animator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_animations.cc
diff --git a/ash/wm/workspace/workspace_animations.cc b/ash/wm/workspace/workspace_animations.cc
index 2bffbd57503ef29c359f9ecf3522f64f60bf86bc..5de57aa51410185f63fecea69f736f61e97e3831 100644
--- a/ash/wm/workspace/workspace_animations.cc
+++ b/ash/wm/workspace/workspace_animations.cc
@@ -5,6 +5,8 @@
#include "ash/wm/workspace/workspace_animations.h"
#include "ash/ash_switches.h"
+#include "base/bind.h"
+#include "base/callback.h"
#include "base/command_line.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
@@ -49,6 +51,13 @@ base::TimeDelta DurationForWorkspaceShowOrHide(
details.duration;
}
+void HideWindow(aura::Window* window) {
+ ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
+ settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
+ settings.SetTransitionDuration(base::TimeDelta());
+ window->Hide();
+}
+
} // namespace
WorkspaceAnimationDetails::WorkspaceAnimationDetails()
@@ -140,14 +149,22 @@ void HideWorkspace(aura::Window* window,
window->layer()->SetTransform(gfx::Transform());
}
- // NOTE: Hide() must be before SetOpacity(), else
- // VisibilityController::UpdateLayerVisibility doesn't pass the false to the
- // layer so that the layer and window end up out of sync and confused.
- window->Hide();
+ window->layer()->SetVisible(false);
Daniel Erat 2012/11/27 19:03:27 does this get balanced out by a call to SetVisible
sky 2012/11/27 21:19:29 I don't like that this leaves the workspace window
Denis Kuznetsov (DE-MUC) 2012/11/28 15:41:46 Animation is aborted only by other animation that
if (details.animate_opacity)
window->layer()->SetOpacity(0.0f);
+ // We need window-Hide() to be called to handle focus loss and other stuff
+ // correctly. However, this animation can be aborted in some cases
+ // (e.g. during lock), and window should only be hidden if animation
+ // completes.
+ base::Closure hide_window_callback = base::Bind(&HideWindow, window);
+ window->layer()->GetAnimator()->SetCompletionCallbackForProperties(
+ hide_window_callback,
+ ui::LayerAnimationElement::VISIBILITY,
+ -1
+ );
Daniel Erat 2012/11/27 19:03:27 nit: move this to the end of the previous line
Denis Kuznetsov (DE-MUC) 2012/11/28 15:41:46 Done.
+
// After the animation completes snap the transform back to the identity,
// otherwise any one that asks for screen bounds gets a slightly scaled
// version.
« no previous file with comments | « no previous file | ui/compositor/layer_animator.h » ('j') | ui/compositor/layer_animator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698