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

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

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock with zero width (no logs) Created 7 years, 6 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 947cf90931b0cbbbd2a814f8f926d56bf4329b47..c9c1c7d50476dc1bbcc5fd6e42c123df8eaefe7b 100644
--- a/ash/wm/panels/panel_window_resizer.cc
+++ b/ash/wm/panels/panel_window_resizer.cc
@@ -57,6 +57,8 @@ PanelWindowResizer::Create(WindowResizer* next_window_resizer,
}
void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) {
+ last_mouse_location_ = location;
+ wm::ConvertPointToScreen(GetTarget()->parent(), &last_mouse_location_);
bool destroyed = false;
if (!did_move_or_resize_) {
did_move_or_resize_ = true;
@@ -134,6 +136,7 @@ PanelWindowResizer::PanelWindowResizer(WindowResizer* next_window_resizer,
should_attach_(was_attached_),
destroyed_(NULL) {
DCHECK(details_.is_resizable);
+ root_window_ = details.window->GetRootWindow();
panel_container_ = Shell::GetContainer(
details.window->GetRootWindow(),
internal::kShellWindowId_PanelContainer);
@@ -188,7 +191,7 @@ void PanelWindowResizer::StartedDragging() {
// attaching it so that it does not get repositioned.
if (panel_container_)
GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget());
- if (!was_attached_) {
+ if (!was_attached_ && !IsWindowDocked(GetTarget())) {
// Attach the panel while dragging placing it in front of other panels.
GetTarget()->SetProperty(internal::kContinueDragAfterReparent, true);
GetTarget()->SetProperty(internal::kPanelAttachedKey, true);
@@ -204,9 +207,9 @@ void PanelWindowResizer::FinishDragging() {
if (GetTarget()->GetProperty(internal::kPanelAttachedKey) !=
should_attach_) {
GetTarget()->SetProperty(internal::kPanelAttachedKey, should_attach_);
- GetTarget()->SetDefaultParentByRootWindow(
- GetTarget()->GetRootWindow(),
- GetTarget()->GetBoundsInScreen());
+ gfx::Rect near_last_mouse_location(last_mouse_location_, gfx::Size());
+ GetTarget()->SetDefaultParentByRootWindow(root_window_,
+ near_last_mouse_location);
}
if (panel_container_)
GetPanelLayoutManager(panel_container_)->FinishDragging();

Powered by Google App Engine
This is Rietveld 408576698