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

Unified Diff: ash/common/wm/overview/window_selector.cc

Issue 2667293002: [ash-md] Adds support for gesture to move selection in overview mode (Closed)
Patch Set: [ash-md] Adds support for gesture to move selection in overview mode (tuning) Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ash/common/wm/overview/window_selector.cc
diff --git a/ash/common/wm/overview/window_selector.cc b/ash/common/wm/overview/window_selector.cc
index 7233f45e74b677eeb27623179f90e6d01b0a8843..8110aed7c4a061992145c5445cd2fb84078c3fe6 100644
--- a/ash/common/wm/overview/window_selector.cc
+++ b/ash/common/wm/overview/window_selector.cc
@@ -254,6 +254,7 @@ void WindowSelector::Init(const WindowList& windows) {
(b->GetBoundsInScreen().x() + b->GetBoundsInScreen().y());
});
+ bool first_grid = true;
for (WmWindow* root : root_windows) {
// Observed switchable containers for newly created windows on all root
// windows.
@@ -271,6 +272,10 @@ void WindowSelector::Init(const WindowList& windows) {
std::unique_ptr<WindowGrid> grid(new WindowGrid(root, windows, this));
if (grid->empty())
continue;
+ if (first_grid) {
tdanderson 2017/02/10 16:05:19 I'm not 100% convinced this is the right thing to
varkha 2017/02/10 17:34:30 Yes, I'll take this offline.
+ grid->set_skip_first(true);
+ first_grid = false;
+ }
num_items_ += grid->size();
grid_list_.push_back(std::move(grid));
}
@@ -404,6 +409,20 @@ void WindowSelector::OnGridEmpty(WindowGrid* grid) {
CancelSelection();
}
+void WindowSelector::IncrementSelection(int increment) {
+ const Direction direction =
+ increment > 0 ? WindowSelector::RIGHT : WindowSelector::LEFT;
+ for (int step = 0; step < abs(increment); ++step)
+ Move(direction, true);
+}
+
+bool WindowSelector::AcceptSelection() {
+ if (!grid_list_[selected_grid_index_]->is_selecting())
+ return false;
+ SelectWindow(grid_list_[selected_grid_index_]->SelectedWindow());
+ return true;
+}
+
void WindowSelector::SelectWindow(WindowSelectorItem* item) {
WmWindow* window = item->GetWindow();
std::vector<WmWindow*> window_list =

Powered by Google App Engine
This is Rietveld 408576698