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

Unified Diff: ash/wm/panels/panel_window_resizer.cc

Issue 12441010: Attach panel while dragging to bring it in front of other panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge. Created 7 years, 9 months 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
Index: ash/wm/panels/panel_window_resizer.cc
diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc
index 60044c3cc229773fd08244e31f08ae9f0e75c5f0..6e2211835aad0dc9839bc7b86df547c9506ffb5d 100644
--- a/ash/wm/panels/panel_window_resizer.cc
+++ b/ash/wm/panels/panel_window_resizer.cc
@@ -36,8 +36,8 @@ PanelWindowResizer::~PanelWindowResizer() {
// static
PanelWindowResizer*
PanelWindowResizer::Create(aura::Window* window,
- const gfx::Point& location,
- int window_component) {
+ const gfx::Point& location,
+ int window_component) {
Details details(window, location, window_component);
return details.is_resizable ? new PanelWindowResizer(details) : NULL;
}
@@ -59,7 +59,8 @@ void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) {
}
void PanelWindowResizer::CompleteDrag(int event_flags) {
- if (should_attach_ != was_attached_) {
+ if (details_.window->GetProperty(internal::kPanelAttachedKey) !=
+ should_attach_) {
details_.window->SetProperty(internal::kPanelAttachedKey, should_attach_);
details_.window->SetDefaultParentByRootWindow(
details_.window->GetRootWindow(),
@@ -142,13 +143,21 @@ bool PanelWindowResizer::AttachToLauncher(gfx::Rect* bounds) {
}
void PanelWindowResizer::StartedDragging() {
- if (was_attached_)
- panel_layout_manager_->StartDragging(details_.window);
+ // Tell the panel layout manager that we are dragging this panel before
+ // attaching it so that it does not get repositioned.
+ panel_layout_manager_->StartDragging(details_.window);
+ if (!was_attached_) {
+ // Attach the panel while dragging placing it in front of other panels.
+ details_.window->SetProperty(internal::kContinueDragAfterReparent, true);
+ details_.window->SetProperty(internal::kPanelAttachedKey, true);
+ details_.window->SetDefaultParentByRootWindow(
+ details_.window->GetRootWindow(),
+ details_.window->bounds());
+ }
}
void PanelWindowResizer::FinishDragging() {
- if (was_attached_)
- panel_layout_manager_->FinishDragging();
+ panel_layout_manager_->FinishDragging();
}
void PanelWindowResizer::UpdateLauncherPosition() {

Powered by Google App Engine
This is Rietveld 408576698