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

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

Issue 2389323002: Start Alt+Tab on MRU instead of MRU+1 if all windows are minimized. (Closed)
Patch Set: Created 4 years, 2 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
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/window_cycle_list.h" 5 #include "ash/common/wm/window_cycle_list.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // window is minimized, we should also show it. 511 // window is minimized, we should also show it.
512 if (windows_.size() == 1) { 512 if (windows_.size() == 1) {
513 windows_[0]->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); 513 windows_[0]->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE);
514 windows_[0]->Show(); 514 windows_[0]->Show();
515 windows_[0]->GetWindowState()->Activate(); 515 windows_[0]->GetWindowState()->Activate();
516 return; 516 return;
517 } 517 }
518 518
519 DCHECK(static_cast<size_t>(current_index_) < windows_.size()); 519 DCHECK(static_cast<size_t>(current_index_) < windows_.size());
520 520
521 if (!cycle_view_ && current_index_ == 0) 521 if (!cycle_view_ && current_index_ == 0) {
522 initial_direction_ = direction; 522 initial_direction_ = direction;
523 // Special case the situation where we're cycling forward but the MRU window
524 // is not active. This occurs when all windows are minimized. The starting
525 // window should be the first one rather than the second.
526 if (direction == WindowCycleController::FORWARD && !windows_[0]->IsActive())
527 current_index_ = -1;
varkha 2016/10/06 03:31:08 Optional nit: There logic is correct but still tak
Evan Stade 2016/10/06 15:40:33 I did write this in several different formats beca
528 }
523 529
524 // We're in a valid cycle, so step forward or backward. 530 // We're in a valid cycle, so step forward or backward.
525 current_index_ += direction == WindowCycleController::FORWARD ? 1 : -1; 531 current_index_ += direction == WindowCycleController::FORWARD ? 1 : -1;
526 532
527 // Wrap to window list size. 533 // Wrap to window list size.
528 current_index_ = (current_index_ + windows_.size()) % windows_.size(); 534 current_index_ = (current_index_ + windows_.size()) % windows_.size();
529 DCHECK(windows_[current_index_]); 535 DCHECK(windows_[current_index_]);
530 536
531 if (ShouldShowUi()) { 537 if (ShouldShowUi()) {
532 if (current_index_ > 1) 538 if (current_index_ > 1)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 widget->Init(params); 626 widget->Init(params);
621 627
622 screen_observer_.Add(display::Screen::GetScreen()); 628 screen_observer_.Add(display::Screen::GetScreen());
623 widget->Show(); 629 widget->Show();
624 widget->SetCapture(cycle_view_); 630 widget->SetCapture(cycle_view_);
625 widget->set_auto_release_capture(false); 631 widget->set_auto_release_capture(false);
626 cycle_ui_widget_ = widget; 632 cycle_ui_widget_ = widget;
627 } 633 }
628 634
629 } // namespace ash 635 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_cycle_controller_unittest.cc » ('j') | ash/wm/window_cycle_controller_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698