Lines Matching refs:window_state

13 #include "ash/wm/window_state.h"
38 void MoveToDisplayForRestore(WindowState* window_state) {
39 if (!window_state->HasRestoreBounds())
41 const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen();
50 window_state->window()).bounds();
59 if (new_root != window_state->window()->GetRootWindow()) {
61 Shell::GetContainer(new_root, window_state->window()->parent()->id());
62 new_container->AddChild(window_state->window());
73 void DefaultState::OnWMEvent(WindowState* window_state,
75 if (ProcessWorkspaceEvents(window_state, event))
78 if (ProcessCompoundEvents(window_state, event))
102 SetBounds(window_state, static_cast<const SetBoundsEvent*>(event));
122 WindowStateType current = window_state->GetStateType();
124 if (next_state_type == current && window_state->IsSnapped()) {
126 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) :
127 GetDefaultRightSnappedWindowBoundsInParent(window_state->window());
128 window_state->SetBoundsDirectAnimated(snapped_bounds);
132 EnterToNextState(window_state, next_state_type);
140 WindowState* window_state,
142 DCHECK_EQ(stored_window_state_, window_state);
144 ReenterToCurrentState(window_state, state_in_previous_mode);
149 GetDisplayNearestWindow(window_state->window());
152 window_state->OnWMEvent(&event);
155 window_state->OnWMEvent(&event);
159 void DefaultState::DetachState(WindowState* window_state) {
160 stored_window_state_ = window_state;
161 aura::Window* window = window_state->window();
163 stored_restore_bounds_ = window_state->HasRestoreBounds() ?
164 window_state->GetRestoreBoundsInParent() : gfx::Rect();
170 GetDisplayNearestWindow(window_state->window());
174 bool DefaultState::ProcessCompoundEvents(WindowState* window_state,
176 aura::Window* window = window_state->window();
180 if (window_state->IsFullscreen()) {
182 window_state->OnWMEvent(&event);
183 } else if (window_state->IsMaximized()) {
184 window_state->Restore();
185 } else if (window_state->IsNormalOrSnapped()) {
186 if (window_state->CanMaximize())
187 window_state->Maximize();
191 if (window_state->IsFullscreen()) {
193 window_state->OnWMEvent(&event);
194 } else if (window_state->IsMaximized()) {
195 window_state->Restore();
196 } else if (window_state->CanMaximize()) {
197 window_state->Maximize();
210 !window_state->IsNormalStateType()) {
213 if (window_state->HasRestoreBounds() &&
216 window_state->SetAndClearRestoreBounds();
218 window_state->SaveCurrentBoundsForRestore();
232 if (!window_state->IsNormalOrSnapped())
236 if (window_state->IsNormalStateType() &&
237 window_state->HasRestoreBounds() &&
240 window_state->SetAndClearRestoreBounds();
248 if (window_state->IsSnapped()) {
249 window_state->SetRestoreBoundsInParent(new_bounds);
250 window_state->Restore();
257 window_state->SetRestoreBoundsInParent(restore_bounds);
263 ToggleFullScreen(window_state, window_state->delegate());
266 CenterWindow(window_state);
286 bool DefaultState::ProcessWorkspaceEvents(WindowState* window_state,
295 if (window_state->is_dragged() ||
296 SetMaximizedOrFullscreenBounds(window_state)) {
300 aura::Window* window = window_state->window();
312 if (window_state->window()->type() != ui::wm::WINDOW_TYPE_NORMAL &&
313 window_state->window()->type() != ui::wm::WINDOW_TYPE_PANEL) {
326 window_state->AdjustSnappedBounds(&bounds);
328 window_state->SetBoundsConstrained(bounds);
332 if (window_state->is_dragged() ||
333 SetMaximizedOrFullscreenBounds(window_state)) {
337 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
338 gfx::Rect bounds = window_state->window()->bounds();
342 window_state->AdjustSnappedBounds(&bounds);
343 if (window_state->window()->bounds() != bounds)
344 window_state->SetBoundsDirectAnimated(bounds);
348 if (window_state->is_dragged() ||
349 SetMaximizedOrFullscreenBounds(window_state)) {
353 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
354 gfx::Rect bounds = window_state->window()->bounds();
356 window_state->AdjustSnappedBounds(&bounds);
357 if (window_state->window()->bounds() != bounds)
358 window_state->SetBoundsDirectAnimated(bounds);
381 bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) {
382 DCHECK(!window_state->is_dragged());
383 if (window_state->IsMaximized()) {
384 window_state->SetBoundsDirect(
385 ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->window()));
388 if (window_state->IsFullscreen()) {
389 window_state->SetBoundsDirect(
390 ScreenUtil::GetDisplayBoundsInParent(window_state->window()));
397 void DefaultState::SetBounds(WindowState* window_state,
399 if (window_state->is_dragged()) {
400 window_state->SetBoundsDirect(event->requested_bounds());
401 } else if (window_state->IsSnapped()) {
403 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
406 window_state->AdjustSnappedBounds(&child_bounds);
407 window_state->SetBoundsDirect(child_bounds);
408 } else if (!SetMaximizedOrFullscreenBounds(window_state)) {
409 window_state->SetBoundsConstrained(event->requested_bounds());
413 void DefaultState::EnterToNextState(WindowState* window_state,
422 window_state->UpdateWindowShowStateFromStateType();
423 window_state->NotifyPreStateTypeChange(previous_state_type);
428 if (window_state->window()->parent() &&
429 (window_state->IsSnapped() ||
430 (!window_state->IsDocked() && !IsPanel(window_state->window())))) {
431 if (!window_state->HasRestoreBounds() &&
434 !window_state->IsMinimized() &&
435 !window_state->IsNormalStateType()) {
436 window_state->SaveCurrentBoundsForRestore();
445 window_state->IsNormalStateType() &&
446 window_state->HasRestoreBounds() &&
447 !window_state->unminimize_to_restore_bounds()) {
448 restore_bounds_in_screen = window_state->GetRestoreBoundsInScreen();
449 window_state->SaveCurrentBoundsForRestore();
452 if (window_state->IsMaximizedOrFullscreen())
453 MoveToDisplayForRestore(window_state);
455 UpdateBoundsFromState(window_state, previous_state_type);
460 window_state->SetRestoreBoundsInScreen(restore_bounds_in_screen);
461 else if (window_state->IsNormalStateType())
462 window_state->ClearRestoreBounds();
464 window_state->NotifyPostStateTypeChange(previous_state_type);
468 WindowState* window_state,
477 window_state->UpdateWindowShowStateFromStateType();
478 window_state->NotifyPreStateTypeChange(previous_state_type);
485 window_state->SetRestoreBoundsInParent(stored_bounds_);
488 UpdateBoundsFromState(window_state, state_in_previous_mode->GetType());
492 window_state->SetRestoreBoundsInParent(stored_restore_bounds_);
494 window_state->ClearRestoreBounds();
496 window_state->NotifyPostStateTypeChange(previous_state_type);
499 void DefaultState::UpdateBoundsFromState(WindowState* window_state,
501 aura::Window* window = window_state->window();
507 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) :
508 GetDefaultRightSnappedWindowBoundsInParent(window_state->window());
513 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
514 if (window_state->HasRestoreBounds()) {
515 bounds_in_parent = window_state->GetRestoreBoundsInParent();
553 window_state->IsFullscreen()) {
554 window_state->SetBoundsDirect(bounds_in_parent);
555 } else if (window_state->IsMaximized() ||
557 window_state->SetBoundsDirectCrossFade(bounds_in_parent);
558 } else if (window_state->is_dragged()) {
561 window_state->SetBoundsDirect(bounds_in_parent);
563 window_state->SetBoundsDirectAnimated(bounds_in_parent);
567 if (window_state->IsMinimized()) {
569 window_state->window()->SetProperty(aura::client::kRestoreShowStateKey,
572 window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
575 window_state->window()->Hide();
577 if (window_state->IsActive())
578 window_state->Deactivate();
579 } else if ((window_state->window()->TargetVisibility() ||
581 !window_state->window()->layer()->visible()) {
584 window_state->window()->Show();
586 !window_state->IsMaximizedOrFullscreen()) {
587 window_state->set_unminimize_to_restore_bounds(false);
593 void DefaultState::CenterWindow(WindowState* window_state) {
594 if (!window_state->IsNormalOrSnapped())
596 aura::Window* window = window_state->window();
597 if (window_state->IsSnapped()) {
600 gfx::Size size = window_state->HasRestoreBounds() ?
601 window_state->GetRestoreBoundsInScreen().size() :
604 window_state->SetRestoreBoundsInScreen(center_in_screen);
605 window_state->Restore();
610 window_state->SetBoundsDirectAnimated(center_in_parent);
613 window_state->set_bounds_changed_by_user(true);