Index: ash/wm/overview/window_overview.h |
diff --git a/ash/wm/overview/window_overview.h b/ash/wm/overview/window_overview.h |
index 502e3d921e886dbc3e453750ac7948f3a5966cac..3fc6c8dab7f08961f48878e879638c0c1cfd1c62 100644 |
--- a/ash/wm/overview/window_overview.h |
+++ b/ash/wm/overview/window_overview.h |
@@ -5,6 +5,8 @@ |
#ifndef ASH_WM_OVERVIEW_WINDOW_OVERVIEW_H_ |
#define ASH_WM_OVERVIEW_WINDOW_OVERVIEW_H_ |
+#include <vector> |
+ |
#include "base/compiler_specific.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/scoped_vector.h" |
@@ -13,6 +15,7 @@ |
#include "ui/events/event_handler.h" |
#include "ui/gfx/display_observer.h" |
#include "ui/gfx/rect.h" |
+#include "ui/gfx/vector2d.h" |
namespace aura { |
class Window; |
@@ -34,6 +37,22 @@ namespace ash { |
class WindowSelector; |
class WindowSelectorItem; |
+// Represents a grid of windows in OM. Useful for arrow key navigation. |
tdanderson
2014/04/29 14:46:27
"OM" -> "Overview Mode"
Nina
2014/04/29 18:31:40
Done.
|
+struct WindowGrid { |
+ size_t rows; |
+ size_t columns; |
+ size_t windows; |
+ aura::Window* root_window; |
+ std::vector<std::vector<WindowSelectorItem*> > window_matrix; |
+}; |
+ |
+// Represents the position of the cursor in the screen. |
+struct ArrowCursor { |
+ size_t x; |
+ size_t y; |
+ bool primary_display; |
+}; |
+ |
// The WindowOverview shows a grid of all of your windows and allows selecting |
// a window by clicking or tapping on it. It also displays a selection widget |
// used to indicate the current selection when alt-tabbing between windows. |
@@ -51,7 +70,8 @@ class WindowOverview : public ui::EventHandler, |
aura::Window* single_root_window); |
virtual ~WindowOverview(); |
- // Sets the selected window to be the window in position |index|. |
+ // Sets the selected window to be the window in position |index|, according to |
+ // MRU order. |
void SetSelection(size_t index); |
// Dispatched when the list of windows has changed. |
@@ -72,6 +92,18 @@ class WindowOverview : public ui::EventHandler, |
virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; |
private: |
+ enum Direction { |
+ DOWN, |
+ UP, |
+ RIGHT, |
+ LEFT, |
+ NONE |
+ }; |
tdanderson
2014/04/29 14:46:27
space
Nina
2014/04/29 18:31:40
Done.
|
+ // Moves the selection widget to the specified window |target| fading out in |
+ // the specified |fade_out_direction|. |
+ void MoveSelectionWidget(WindowSelectorItem* target, |
+ gfx::Vector2d* fade_out_direction); |
+ |
// Returns the target of |event| or NULL if the event is not targeted at |
// any of the windows in the selector. |
aura::Window* GetEventTarget(ui::LocatedEvent* event); |
@@ -93,10 +125,21 @@ class WindowOverview : public ui::EventHandler, |
bool animate); |
// Creates the selection widget. |
- void InitializeSelectionWidget(); |
+ void InitializeSelectionWidget(aura::Window* root_window); |
- // Returns the bounds for the selection widget for the windows_ at |index|. |
- gfx::Rect GetSelectionBounds(size_t index); |
+ // Moves the selection widget one step in a certain direction. Called when |
+ // pressing an arrow key. |
+ void MoveSelector(Direction direction); |
+ |
+ // "Resets" the selection widget when recreating the overview after a window |
+ // is closed, moving it to a new position. |
+ void ResetSelectionWidget(); |
+ |
+ // Returns the bounds for the selection widget for the specified |window| |
tdanderson
2014/04/29 14:46:27
. at end
|
+ gfx::Rect GetSelectionBounds(WindowSelectorItem* window); |
+ |
+ // Return a window by index, either by |mru| order or spatial order. |
+ WindowSelectorItem* GetWindowByIndex(size_t index, bool mru); |
// Weak pointer to the window selector which owns this class. |
WindowSelector* window_selector_; |
@@ -109,9 +152,9 @@ class WindowOverview : public ui::EventHandler, |
// Widget indicating which window is currently selected. |
scoped_ptr<views::Widget> selection_widget_; |
- // Index of the currently selected window. This is used to determine when the |
- // selection changes rows and use a different animation. |
- size_t selection_index_; |
+ // Pointer to the currently selected window. This is used for the arrow key |
tdanderson
2014/04/29 14:46:27
Indicate in the comment that this is NULL if no wi
|
+ // navigation. |
+ ash::WindowSelectorItem* selected_window_; |
tdanderson
2014/04/29 14:46:27
ash:: not needed
|
// If NULL, each root window displays an overview of the windows in that |
// display. Otherwise, all windows are in a single overview on |
@@ -128,6 +171,15 @@ class WindowOverview : public ui::EventHandler, |
// overview. |
aura::WindowTracker hidden_windows_; |
+ // Each grid represents the arrangement of windows in the screen while in |
+ // overview mode. |
+ WindowGrid main_grid_; |
+ WindowGrid secondary_grid_; |
+ |
+ // Used to store the location of the cursor used to select with the arrow |
+ // keys. |
+ ArrowCursor arrow_cursor_; |
tdanderson
2014/04/29 14:46:27
When I hear "arrow cursor" I think of an arrow-sha
Nina
2014/04/29 18:31:40
Done.
|
+ |
DISALLOW_COPY_AND_ASSIGN(WindowOverview); |
}; |