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();
317 window_state->AdjustSnappedBounds(&bounds);
319 window_state->SetBoundsConstrained(bounds);
323 if (window_state->is_dragged() ||
324 SetMaximizedOrFullscreenBounds(window_state)) {
328 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
329 gfx::Rect bounds = window_state->window()->bounds();
333 window_state->AdjustSnappedBounds(&bounds);
334 if (window_state->window()->bounds() != bounds)
335 window_state->SetBoundsDirectAnimated(bounds);
339 if (window_state->is_dragged() ||
340 SetMaximizedOrFullscreenBounds(window_state)) {
344 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
345 gfx::Rect bounds = window_state->window()->bounds();
347 window_state->AdjustSnappedBounds(&bounds);
348 if (window_state->window()->bounds() != bounds)
349 window_state->SetBoundsDirectAnimated(bounds);
372 bool DefaultState::SetMaximizedOrFullscreenBounds(WindowState* window_state) {
373 DCHECK(!window_state->is_dragged());
374 if (window_state->IsMaximized()) {
375 window_state->SetBoundsDirect(
376 ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->window()));
379 if (window_state->IsFullscreen()) {
380 window_state->SetBoundsDirect(
381 ScreenUtil::GetDisplayBoundsInParent(window_state->window()));
388 void DefaultState::SetBounds(WindowState* window_state,
390 if (window_state->is_dragged()) {
391 window_state->SetBoundsDirect(event->requested_bounds());
392 } else if (window_state->IsSnapped()) {
394 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
397 window_state->AdjustSnappedBounds(&child_bounds);
398 window_state->SetBoundsDirect(child_bounds);
399 } else if (!SetMaximizedOrFullscreenBounds(window_state)) {
400 window_state->SetBoundsConstrained(event->requested_bounds());
404 void DefaultState::EnterToNextState(WindowState* window_state,
413 window_state->UpdateWindowShowStateFromStateType();
414 window_state->NotifyPreStateTypeChange(previous_state_type);
419 if (window_state->window()->parent() &&
420 (window_state->IsSnapped() ||
421 (!window_state->IsDocked() && !IsPanel(window_state->window())))) {
422 if (!window_state->HasRestoreBounds() &&
425 !window_state->IsMinimized() &&
426 !window_state->IsNormalStateType()) {
427 window_state->SaveCurrentBoundsForRestore();
436 window_state->IsNormalStateType() &&
437 window_state->HasRestoreBounds() &&
438 !window_state->unminimize_to_restore_bounds()) {
439 restore_bounds_in_screen = window_state->GetRestoreBoundsInScreen();
440 window_state->SaveCurrentBoundsForRestore();
443 if (window_state->IsMaximizedOrFullscreen())
444 MoveToDisplayForRestore(window_state);
446 UpdateBoundsFromState(window_state, previous_state_type);
451 window_state->SetRestoreBoundsInScreen(restore_bounds_in_screen);
452 else if (window_state->IsNormalStateType())
453 window_state->ClearRestoreBounds();
455 window_state->NotifyPostStateTypeChange(previous_state_type);
459 WindowState* window_state,
468 window_state->UpdateWindowShowStateFromStateType();
469 window_state->NotifyPreStateTypeChange(previous_state_type);
476 window_state->SetRestoreBoundsInParent(stored_bounds_);
479 UpdateBoundsFromState(window_state, state_in_previous_mode->GetType());
483 window_state->SetRestoreBoundsInParent(stored_restore_bounds_);
485 window_state->ClearRestoreBounds();
487 window_state->NotifyPostStateTypeChange(previous_state_type);
490 void DefaultState::UpdateBoundsFromState(WindowState* window_state,
492 aura::Window* window = window_state->window();
498 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) :
499 GetDefaultRightSnappedWindowBoundsInParent(window_state->window());
504 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
505 if (window_state->HasRestoreBounds())
506 bounds_in_parent = window_state->GetRestoreBoundsInParent();
533 window_state->IsFullscreen()) {
534 window_state->SetBoundsDirect(bounds_in_parent);
535 } else if (window_state->IsMaximized() ||
537 window_state->SetBoundsDirectCrossFade(bounds_in_parent);
538 } else if (window_state->is_dragged()) {
541 window_state->SetBoundsDirect(bounds_in_parent);
543 window_state->SetBoundsDirectAnimated(bounds_in_parent);
547 if (window_state->IsMinimized()) {
549 window_state->window()->SetProperty(aura::client::kRestoreShowStateKey,
552 window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
555 window_state->window()->Hide();
557 if (window_state->IsActive())
558 window_state->Deactivate();
559 } else if ((window_state->window()->TargetVisibility() ||
561 !window_state->window()->layer()->visible()) {
564 window_state->window()->Show();
566 !window_state->IsMaximizedOrFullscreen()) {
567 window_state->set_unminimize_to_restore_bounds(false);
573 void DefaultState::CenterWindow(WindowState* window_state) {
574 if (!window_state->IsNormalOrSnapped())
576 aura::Window* window = window_state->window();
577 if (window_state->IsSnapped()) {
580 gfx::Size size = window_state->HasRestoreBounds() ?
581 window_state->GetRestoreBoundsInScreen().size() :
584 window_state->SetRestoreBoundsInScreen(center_in_screen);
585 window_state->Restore();
590 window_state->SetBoundsDirectAnimated(center_in_parent);
593 window_state->set_bounds_changed_by_user(true);