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

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: Get workspace event handler from workspace controller. 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 e306f29411bcc3ba85c4bc4ef58639947c21a03c..6b87e201100adc0d89b0a0e5276c08d435b9b2e6 100644
--- a/ash/wm/panels/panel_window_resizer.cc
+++ b/ash/wm/panels/panel_window_resizer.cc
@@ -12,7 +12,10 @@
#include "ash/shell_window_ids.h"
#include "ash/wm/panels/panel_layout_manager.h"
#include "ash/wm/property_util.h"
+#include "ash/wm/toplevel_window_event_handler.h"
#include "ash/wm/window_properties.h"
+#include "ash/wm/workspace/workspace_event_handler.h"
+#include "ash/wm/workspace_controller.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
@@ -36,8 +39,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;
}
@@ -57,7 +60,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(),
@@ -140,13 +144,28 @@ 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_) {
+ ash::internal::RootWindowController* root_window_controller =
+ GetRootWindowController(details_.window->GetRootWindow());
+ // Pass the resize handler from the workspace event handler to the panel
+ // container event handler so it can continue to carry out the drag.
+ root_window_controller->workspace_controller()->GetEventHandlerForWindow(
+ details_.window)->PassResizer(
+ root_window_controller->panel_container_handler());
+
+ // Attach the panel while dragging placing it in front of other panels.
+ 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();
}
} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698