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

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

Issue 2593953002: ash: Fix status bubble is vertically offset after switching desktops (Closed)
Patch Set: 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 | no next file » | 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 20 matching lines...) Expand all
31 // When a window that has restore bounds at least as large as a work area is 31 // When a window that has restore bounds at least as large as a work area is
32 // unmaximized, inset the bounds slightly so that they are not exactly the same. 32 // unmaximized, inset the bounds slightly so that they are not exactly the same.
33 // This makes it easier to resize the window. 33 // This makes it easier to resize the window.
34 const int kMaximizedWindowInset = 10; // DIPs. 34 const int kMaximizedWindowInset = 10; // DIPs.
35 35
36 bool IsMinimizedWindowState(const WindowStateType state_type) { 36 bool IsMinimizedWindowState(const WindowStateType state_type) {
37 return state_type == WINDOW_STATE_TYPE_MINIMIZED || 37 return state_type == WINDOW_STATE_TYPE_MINIMIZED ||
38 state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; 38 state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED;
39 } 39 }
40 40
41 bool IsTransient(const WmWindow* window) {
sky 2017/01/03 22:37:23 Can you inline this? I don't think it's save much.
Qiang(Joe) Xu 2017/01/05 06:32:47 Done.
42 return window->GetTransientParent();
43 }
44
41 void MoveToDisplayForRestore(WindowState* window_state) { 45 void MoveToDisplayForRestore(WindowState* window_state) {
42 if (!window_state->HasRestoreBounds()) 46 if (!window_state->HasRestoreBounds())
43 return; 47 return;
44 const gfx::Rect restore_bounds = window_state->GetRestoreBoundsInScreen(); 48 const gfx::Rect restore_bounds = window_state->GetRestoreBoundsInScreen();
45 49
46 // Move only if the restore bounds is outside of 50 // Move only if the restore bounds is outside of
47 // the display. There is no information about in which 51 // the display. There is no information about in which
48 // display it should be restored, so this is best guess. 52 // display it should be restored, so this is best guess.
49 // TODO(oshima): Restore information should contain the 53 // TODO(oshima): Restore information should contain the
50 // work area information like WindowResizer does for the 54 // work area information like WindowResizer does for the
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (in_fullscreen && window_state->IsMaximized()) 474 if (in_fullscreen && window_state->IsMaximized())
471 return true; 475 return true;
472 476
473 if (window_state->is_dragged() || 477 if (window_state->is_dragged() ||
474 SetMaximizedOrFullscreenBounds(window_state)) { 478 SetMaximizedOrFullscreenBounds(window_state)) {
475 return true; 479 return true;
476 } 480 }
477 gfx::Rect work_area_in_parent = 481 gfx::Rect work_area_in_parent =
478 GetDisplayWorkAreaBoundsInParent(window_state->window()); 482 GetDisplayWorkAreaBoundsInParent(window_state->window());
479 gfx::Rect bounds = window_state->window()->GetTargetBounds(); 483 gfx::Rect bounds = window_state->window()->GetTargetBounds();
480 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent, 484 if (!IsTransient(window_state->window())) {
481 &bounds); 485 wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent,
486 &bounds);
487 }
482 window_state->AdjustSnappedBounds(&bounds); 488 window_state->AdjustSnappedBounds(&bounds);
483 if (window_state->window()->GetTargetBounds() != bounds) 489 if (window_state->window()->GetTargetBounds() != bounds)
484 window_state->SetBoundsDirectAnimated(bounds); 490 window_state->SetBoundsDirectAnimated(bounds);
485 return true; 491 return true;
486 } 492 }
487 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: 493 case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
488 case WM_EVENT_TOGGLE_MAXIMIZE: 494 case WM_EVENT_TOGGLE_MAXIMIZE:
489 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: 495 case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE:
490 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: 496 case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE:
491 case WM_EVENT_TOGGLE_FULLSCREEN: 497 case WM_EVENT_TOGGLE_FULLSCREEN:
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 774 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
769 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 775 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
770 window_state->SetBoundsDirectAnimated(center_in_parent); 776 window_state->SetBoundsDirectAnimated(center_in_parent);
771 } 777 }
772 // Centering window is treated as if a user moved and resized the window. 778 // Centering window is treated as if a user moved and resized the window.
773 window_state->set_bounds_changed_by_user(true); 779 window_state->set_bounds_changed_by_user(true);
774 } 780 }
775 781
776 } // namespace wm 782 } // namespace wm
777 } // namespace ash 783 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698