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

Side by Side Diff: ash/common/wm/default_state.cc

Issue 2538293002: Fix dragging snapped window to another display landing the window in the wrong bounds (Closed)
Patch Set: I just needed to rebase Created 4 years 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
« no previous file with comments | « no previous file | ash/common/wm/workspace/workspace_window_resizer.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/wm/default_state.h" 5 #include "ash/common/wm/default_state.h"
6 6
7 #include "ash/common/wm/dock/docked_window_layout_manager.h" 7 #include "ash/common/wm/dock/docked_window_layout_manager.h"
8 #include "ash/common/wm/window_animation_types.h" 8 #include "ash/common/wm/window_animation_types.h"
9 #include "ash/common/wm/window_parenting_utils.h" 9 #include "ash/common/wm/window_parenting_utils.h"
10 #include "ash/common/wm/window_positioning_utils.h" 10 #include "ash/common/wm/window_positioning_utils.h"
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 bounds_in_parent.width() >= work_area_in_parent.width() && 675 bounds_in_parent.width() >= work_area_in_parent.width() &&
676 bounds_in_parent.height() >= work_area_in_parent.height()) { 676 bounds_in_parent.height() >= work_area_in_parent.height()) {
677 bounds_in_parent = work_area_in_parent; 677 bounds_in_parent = work_area_in_parent;
678 bounds_in_parent.Inset(kMaximizedWindowInset, kMaximizedWindowInset, 678 bounds_in_parent.Inset(kMaximizedWindowInset, kMaximizedWindowInset,
679 kMaximizedWindowInset, kMaximizedWindowInset); 679 kMaximizedWindowInset, kMaximizedWindowInset);
680 } 680 }
681 } else { 681 } else {
682 bounds_in_parent = window->GetBounds(); 682 bounds_in_parent = window->GetBounds();
683 } 683 }
684 // Make sure that part of the window is always visible. 684 // Make sure that part of the window is always visible.
685 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, 685 if (!window_state->is_dragged()) {
686 &bounds_in_parent); 686 // Avoid doing this while the window is being dragged as its root
687 // window hasn't been updated yet in the case of dragging to another
688 // display. crbug.com/666836.
689 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent,
690 &bounds_in_parent);
691 }
687 break; 692 break;
688 } 693 }
689 case WINDOW_STATE_TYPE_MAXIMIZED: 694 case WINDOW_STATE_TYPE_MAXIMIZED:
690 bounds_in_parent = GetMaximizedWindowBoundsInParent(window); 695 bounds_in_parent = GetMaximizedWindowBoundsInParent(window);
691 break; 696 break;
692 697
693 case WINDOW_STATE_TYPE_FULLSCREEN: 698 case WINDOW_STATE_TYPE_FULLSCREEN:
694 case WINDOW_STATE_TYPE_PINNED: 699 case WINDOW_STATE_TYPE_PINNED:
695 case WINDOW_STATE_TYPE_TRUSTED_PINNED: 700 case WINDOW_STATE_TYPE_TRUSTED_PINNED:
696 bounds_in_parent = GetDisplayBoundsInParent(window); 701 bounds_in_parent = GetDisplayBoundsInParent(window);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 768 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
764 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 769 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
765 window_state->SetBoundsDirectAnimated(center_in_parent); 770 window_state->SetBoundsDirectAnimated(center_in_parent);
766 } 771 }
767 // Centering window is treated as if a user moved and resized the window. 772 // Centering window is treated as if a user moved and resized the window.
768 window_state->set_bounds_changed_by_user(true); 773 window_state->set_bounds_changed_by_user(true);
769 } 774 }
770 775
771 } // namespace wm 776 } // namespace wm
772 } // namespace ash 777 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698