OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/overview/window_selector.h" | 5 #include "ash/wm/overview/window_selector.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 textfield->RequestFocus(); | 211 textfield->RequestFocus(); |
212 | 212 |
213 return widget; | 213 return widget; |
214 } | 214 } |
215 | 215 |
216 } // namespace | 216 } // namespace |
217 | 217 |
218 const int WindowSelector::kTextFilterBottomEdge = | 218 const int WindowSelector::kTextFilterBottomEdge = |
219 kTextFilterDistanceFromTop + kTextFilterHeight; | 219 kTextFilterDistanceFromTop + kTextFilterHeight; |
220 | 220 |
221 // static | |
222 bool WindowSelector::IsSelectable(aura::Window* window) { | |
223 wm::WindowState* state = wm::GetWindowState(window); | |
224 if (state->GetStateType() == wm::WINDOW_STATE_TYPE_DOCKED || | |
225 state->GetStateType() == wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED) | |
226 return false; | |
227 return window->type() == ui::wm::WINDOW_TYPE_NORMAL || | |
228 window->type() == ui::wm::WINDOW_TYPE_PANEL; | |
229 } | |
230 | |
221 WindowSelector::WindowSelector(WindowSelectorDelegate* delegate) | 231 WindowSelector::WindowSelector(WindowSelectorDelegate* delegate) |
222 : delegate_(delegate), | 232 : delegate_(delegate), |
223 restore_focus_window_(aura::client::GetFocusClient( | 233 restore_focus_window_(aura::client::GetFocusClient( |
224 Shell::GetPrimaryRootWindow())->GetFocusedWindow()), | 234 Shell::GetPrimaryRootWindow())->GetFocusedWindow()), |
225 ignore_activations_(false), | 235 ignore_activations_(false), |
226 selected_grid_index_(0), | 236 selected_grid_index_(0), |
227 overview_start_time_(base::Time::Now()), | 237 overview_start_time_(base::Time::Now()), |
228 num_key_presses_(0), | 238 num_key_presses_(0), |
229 num_items_(0), | 239 num_items_(0), |
230 showing_selection_widget_(false), | 240 showing_selection_widget_(false), |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 // TODO(flackr): Keep window selection active on remaining displays. | 459 // TODO(flackr): Keep window selection active on remaining displays. |
450 CancelSelection(); | 460 CancelSelection(); |
451 } | 461 } |
452 | 462 |
453 void WindowSelector::OnDisplayMetricsChanged(const gfx::Display& display, | 463 void WindowSelector::OnDisplayMetricsChanged(const gfx::Display& display, |
454 uint32_t metrics) { | 464 uint32_t metrics) { |
455 PositionWindows(/* animate */ false); | 465 PositionWindows(/* animate */ false); |
456 } | 466 } |
457 | 467 |
458 void WindowSelector::OnWindowAdded(aura::Window* new_window) { | 468 void WindowSelector::OnWindowAdded(aura::Window* new_window) { |
459 if (new_window->type() != ui::wm::WINDOW_TYPE_NORMAL && | 469 if (!IsSelectable(new_window)) |
460 new_window->type() != ui::wm::WINDOW_TYPE_PANEL) { | |
461 return; | 470 return; |
462 } | |
463 | 471 |
464 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 472 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
465 if (new_window->parent()->id() == kSwitchableWindowContainerIds[i] && | 473 if (new_window->parent()->id() == kSwitchableWindowContainerIds[i] && |
466 !::wm::GetTransientParent(new_window)) { | 474 !::wm::GetTransientParent(new_window)) { |
467 // The new window is in one of the switchable containers, abort overview. | 475 // The new window is in one of the switchable containers, abort overview. |
468 CancelSelection(); | 476 CancelSelection(); |
469 return; | 477 return; |
470 } | 478 } |
471 } | 479 } |
472 } | 480 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 // while hiding them they are tracked. | 569 // while hiding them they are tracked. |
562 for (ScopedVector<WindowGrid>::iterator grid_iter = grid_list_.begin(); | 570 for (ScopedVector<WindowGrid>::iterator grid_iter = grid_list_.begin(); |
563 grid_iter != grid_list_.end(); ++grid_iter) { | 571 grid_iter != grid_list_.end(); ++grid_iter) { |
564 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 572 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
565 const aura::Window* container = | 573 const aura::Window* container = |
566 Shell::GetContainer((*grid_iter)->root_window(), | 574 Shell::GetContainer((*grid_iter)->root_window(), |
567 kSwitchableWindowContainerIds[i]); | 575 kSwitchableWindowContainerIds[i]); |
568 for (aura::Window::Windows::const_iterator iter = | 576 for (aura::Window::Windows::const_iterator iter = |
569 container->children().begin(); iter != container->children().end(); | 577 container->children().begin(); iter != container->children().end(); |
570 ++iter) { | 578 ++iter) { |
571 if (!(*iter)->IsVisible() || (*grid_iter)->Contains(*iter)) | 579 if (!(*iter)->IsVisible() || (*grid_iter)->Contains(*iter) || |
580 !IsSelectable(*iter)) { | |
flackr
2015/04/07 15:08:39
It's confusing that IsSelectable is not a subset o
oshima
2015/04/07 18:00:32
My understanding is that WindowSelector accepts wi
flackr
2015/04/07 18:10:33
This is historical from when we engaged overview a
oshima
2015/04/07 18:20:47
WindowSelectorTest.NonActivatableWindowsHiddens fa
flackr
2015/04/07 18:26:22
I believe so. I can't think of any non activatable
oshima
2015/04/07 20:35:29
Done.
| |
572 continue; | 581 continue; |
582 } | |
573 hidden_windows_.Add(*iter); | 583 hidden_windows_.Add(*iter); |
574 } | 584 } |
575 } | 585 } |
576 } | 586 } |
577 | 587 |
578 // Copy the window list as it can change during iteration. | 588 // Copy the window list as it can change during iteration. |
579 const aura::WindowTracker::Windows hidden_windows(hidden_windows_.windows()); | 589 const aura::WindowTracker::Windows hidden_windows(hidden_windows_.windows()); |
580 for (aura::WindowTracker::Windows::const_iterator iter = | 590 for (aura::WindowTracker::Windows::const_iterator iter = |
581 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { | 591 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { |
582 if (!hidden_windows_.Contains(*iter)) | 592 if (!hidden_windows_.Contains(*iter)) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
614 for (size_t i = 0; | 624 for (size_t i = 0; |
615 i <= grid_list_.size() && | 625 i <= grid_list_.size() && |
616 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { | 626 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { |
617 // TODO(flackr): If there are more than two monitors, move between grids | 627 // TODO(flackr): If there are more than two monitors, move between grids |
618 // in the requested direction. | 628 // in the requested direction. |
619 selected_grid_index_ = (selected_grid_index_ + 1) % grid_list_.size(); | 629 selected_grid_index_ = (selected_grid_index_ + 1) % grid_list_.size(); |
620 } | 630 } |
621 } | 631 } |
622 | 632 |
623 } // namespace ash | 633 } // namespace ash |
OLD | NEW |