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

Side by Side Diff: ash/wm/default_window_resizer.cc

Issue 10918077: Adding proper dragging behavior for L/R maximized windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It looks like if git merged wrong here... Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/frame_painter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/default_window_resizer.h" 5 #include "ash/wm/default_window_resizer.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/coordinate_conversion.h" 8 #include "ash/wm/coordinate_conversion.h"
9 #include "ash/wm/cursor_manager.h" 9 #include "ash/wm/cursor_manager.h"
10 #include "ash/wm/property_util.h"
10 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
12 #include "ui/aura/root_window.h" 13 #include "ui/aura/root_window.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/aura/window_delegate.h" 15 #include "ui/aura/window_delegate.h"
15 #include "ui/base/hit_test.h" 16 #include "ui/base/hit_test.h"
16 #include "ui/base/ui_base_types.h" 17 #include "ui/base/ui_base_types.h"
17 #include "ui/gfx/screen.h" 18 #include "ui/gfx/screen.h"
18 19
19 namespace ash { 20 namespace ash {
(...skipping 15 matching lines...) Expand all
35 std::pair<aura::RootWindow*, gfx::Point> actual_location = 36 std::pair<aura::RootWindow*, gfx::Point> actual_location =
36 wm::GetRootWindowRelativeToWindow(details_.window->parent(), location); 37 wm::GetRootWindowRelativeToWindow(details_.window->parent(), location);
37 38
38 // TODO(mazda|yusukes): Implement dragging an item from one display to another 39 // TODO(mazda|yusukes): Implement dragging an item from one display to another
39 aura::RootWindow* current_root = actual_location.first; 40 aura::RootWindow* current_root = actual_location.first;
40 if (current_root != details_.window->GetRootWindow()) 41 if (current_root != details_.window->GetRootWindow())
41 return; 42 return;
42 43
43 gfx::Rect bounds(CalculateBoundsForDrag(details_, location)); 44 gfx::Rect bounds(CalculateBoundsForDrag(details_, location));
44 if (bounds != details_.window->bounds()) { 45 if (bounds != details_.window->bounds()) {
46 if (!did_move_or_resize_ && !details_.restore_bounds.IsEmpty())
47 ClearRestoreBounds(details_.window);
45 did_move_or_resize_ = true; 48 did_move_or_resize_ = true;
46 details_.window->SetBounds(bounds); 49 details_.window->SetBounds(bounds);
47 } 50 }
48 } 51 }
49 52
50 void DefaultWindowResizer::CompleteDrag(int event_flags) { 53 void DefaultWindowResizer::CompleteDrag(int event_flags) {
51 } 54 }
52 55
53 void DefaultWindowResizer::RevertDrag() { 56 void DefaultWindowResizer::RevertDrag() {
54 if (!did_move_or_resize_) 57 if (!did_move_or_resize_)
55 return; 58 return;
56 59
57 details_.window->SetBounds(details_.initial_bounds); 60 details_.window->SetBounds(details_.initial_bounds);
61
62 if (!details_.restore_bounds.IsEmpty())
63 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds);
58 } 64 }
59 65
60 aura::Window* DefaultWindowResizer::GetTarget() { 66 aura::Window* DefaultWindowResizer::GetTarget() {
61 return details_.window; 67 return details_.window;
62 } 68 }
63 69
64 DefaultWindowResizer::DefaultWindowResizer(const Details& details) 70 DefaultWindowResizer::DefaultWindowResizer(const Details& details)
65 : details_(details), 71 : details_(details),
66 did_move_or_resize_(false) { 72 did_move_or_resize_(false) {
67 DCHECK(details_.is_resizable); 73 DCHECK(details_.is_resizable);
68 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); 74 ash::Shell::GetInstance()->cursor_manager()->LockCursor();
69 } 75 }
70 76
71 } // namespace aura 77 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ash/wm/frame_painter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698