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

Side by Side Diff: ash/wm/drag_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/drag_window_resizer.h" 5 #include "ash/wm/drag_window_resizer.h"
6 6
7 #include "ash/ash_switches.h"
7 #include "ash/display/mouse_cursor_event_filter.h" 8 #include "ash/display/mouse_cursor_event_filter.h"
8 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/wm/coordinate_conversion.h" 11 #include "ash/wm/coordinate_conversion.h"
12 #include "ash/wm/dock/dock_layout_manager.h"
11 #include "ash/wm/drag_window_controller.h" 13 #include "ash/wm/drag_window_controller.h"
12 #include "ash/wm/property_util.h" 14 #include "ash/wm/property_util.h"
15 #include "base/command_line.h"
13 #include "ui/aura/client/aura_constants.h" 16 #include "ui/aura/client/aura_constants.h"
14 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
15 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
16 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
17 #include "ui/aura/window_delegate.h" 20 #include "ui/aura/window_delegate.h"
18 #include "ui/base/hit_test.h" 21 #include "ui/base/hit_test.h"
19 #include "ui/base/ui_base_types.h" 22 #include "ui/base/ui_base_types.h"
20 #include "ui/gfx/screen.h" 23 #include "ui/gfx/screen.h"
21 24
22 namespace ash { 25 namespace ash {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const gfx::Display dst_display = 108 const gfx::Display dst_display =
106 screen->GetDisplayNearestPoint(last_mouse_location_in_screen); 109 screen->GetDisplayNearestPoint(last_mouse_location_in_screen);
107 110
108 if (dst_display.id() != 111 if (dst_display.id() !=
109 screen->GetDisplayNearestWindow(GetTarget()->GetRootWindow()).id()) { 112 screen->GetDisplayNearestWindow(GetTarget()->GetRootWindow()).id()) {
110 const gfx::Rect dst_bounds = 113 const gfx::Rect dst_bounds =
111 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), 114 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(),
112 GetTarget()->bounds()); 115 GetTarget()->bounds());
113 GetTarget()->SetBoundsInScreen(dst_bounds, dst_display); 116 GetTarget()->SetBoundsInScreen(dst_bounds, dst_display);
114 } 117 }
118 if ((details_.bounds_change & WindowResizer::kBoundsChange_Repositions) &&
119 CommandLine::ForCurrentProcess()->HasSwitch(
120 switches::kAshEnableDockedWindows)) {
121 SetDockEdge(GetTarget(), DockLayoutManager::FindDockEdge(GetTarget()));
122 }
115 } 123 }
116 124
117 void DragWindowResizer::RevertDrag() { 125 void DragWindowResizer::RevertDrag() {
118 next_window_resizer_->RevertDrag(); 126 next_window_resizer_->RevertDrag();
119 127
120 drag_window_controller_.reset(); 128 drag_window_controller_.reset();
121 GetTarget()->layer()->SetOpacity(details_.initial_opacity); 129 GetTarget()->layer()->SetOpacity(details_.initial_opacity);
122 } 130 }
123 131
124 aura::Window* DragWindowResizer::GetTarget() { 132 aura::Window* DragWindowResizer::GetTarget() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 198
191 bool DragWindowResizer::ShouldAllowMouseWarp() { 199 bool DragWindowResizer::ShouldAllowMouseWarp() {
192 return (details_.window_component == HTCAPTION) && 200 return (details_.window_component == HTCAPTION) &&
193 !GetTarget()->transient_parent() && 201 !GetTarget()->transient_parent() &&
194 (GetTarget()->type() == aura::client::WINDOW_TYPE_NORMAL || 202 (GetTarget()->type() == aura::client::WINDOW_TYPE_NORMAL ||
195 GetTarget()->type() == aura::client::WINDOW_TYPE_PANEL); 203 GetTarget()->type() == aura::client::WINDOW_TYPE_PANEL);
196 } 204 }
197 205
198 } // namespace internal 206 } // namespace internal
199 } // namespace ash 207 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698