diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 21:33:41 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 21:33:41 +0000 |
commit | 680ca65370fa194b8eea14b1c9c822e66fb2dd32 (patch) | |
tree | 677e65b76a903a53156dbf8d5c31251280e24583 /ash | |
parent | 20f41a0e00ef286c310aadcdd6ce22d7ba23acc5 (diff) | |
download | chromium_src-680ca65370fa194b8eea14b1c9c822e66fb2dd32.zip chromium_src-680ca65370fa194b8eea14b1c9c822e66fb2dd32.tar.gz chromium_src-680ca65370fa194b8eea14b1c9c822e66fb2dd32.tar.bz2 |
Revert 133982 because it broke build on chromeos due to mid-air collision with 133961.
---
ash: Add accelerator for snapping windows left/right.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9956056
TBR=sadrul@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10223014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133984 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 37 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.cc | 7 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.h | 5 | ||||
-rw-r--r-- | ash/wm/window_util.cc | 11 | ||||
-rw-r--r-- | ash/wm/window_util.h | 3 | ||||
-rw-r--r-- | ash/wm/workspace/snap_sizer.cc | 18 | ||||
-rw-r--r-- | ash/wm/workspace/snap_sizer.h | 6 |
7 files changed, 1 insertions, 86 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 2000159..d545511 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -21,10 +21,8 @@ #include "ash/system/brightness/brightness_control_delegate.h" #include "ash/system/tray/system_tray.h" #include "ash/volume_control_delegate.h" -#include "ash/wm/property_util.h" #include "ash/wm/window_cycle_controller.h" #include "ash/wm/window_util.h" -#include "ash/wm/workspace/snap_sizer.h" #include "base/command_line.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" @@ -454,41 +452,6 @@ bool AcceleratorController::AcceleratorPressed( case SELECT_LAST_WIN: SwitchToWindow(-1); break; - case WINDOW_SNAP_LEFT: - case WINDOW_SNAP_RIGHT: { - aura::Window* window = wm::GetActiveWindow(); - if (!window) - break; - internal::SnapSizer sizer(window, - gfx::Point(), - action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : - internal::SnapSizer::RIGHT_EDGE, - shell->GetGridSize()); - window->SetBounds(sizer.GetSnapBounds(window->bounds())); - break; - } - case WINDOW_MINIMIZE: { - aura::Window* window = wm::GetActiveWindow(); - if (window) - wm::MinimizeWindow(window); - break; - } - case WINDOW_MAXIMIZE_RESTORE: { - aura::Window* window = wm::GetActiveWindow(); - if (window) { - if (wm::IsWindowMaximized(window)) - wm::RestoreWindow(window); - else - wm::MaximizeWindow(window); - } - break; - } - case WINDOW_POSITION_CENTER: { - aura::Window* window = wm::GetActiveWindow(); - if (window) - wm::CenterWindow(window); - break; - } case ROTATE_WINDOWS: return HandleRotateWindows(); #if !defined(NDEBUG) diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index 974a50e..ba4bc29 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -85,13 +85,6 @@ const AcceleratorData kAcceleratorData[] = { { true, ui::VKEY_8, true, false, true, SELECT_WIN_7 }, { true, ui::VKEY_9, true, false, true, SELECT_LAST_WIN }, - // Window management shortcuts. - { true, ui::VKEY_OEM_4, false, false, true, WINDOW_SNAP_LEFT }, - { true, ui::VKEY_OEM_6, false, false, true, WINDOW_SNAP_RIGHT }, - { true, ui::VKEY_OEM_MINUS, false, false, true, WINDOW_MINIMIZE }, - { true, ui::VKEY_OEM_PLUS, false, false, true, WINDOW_MAXIMIZE_RESTORE }, - { true, ui::VKEY_OEM_PLUS, true, false, true, WINDOW_POSITION_CENTER }, - { true, ui::VKEY_F3, true, true, true, ROTATE_WINDOWS }, #if !defined(NDEBUG) { true, ui::VKEY_HOME, false, true, false, ROTATE_SCREEN }, diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 82618d4..dc1e413 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -46,11 +46,6 @@ enum AcceleratorAction { VOLUME_DOWN, VOLUME_MUTE, VOLUME_UP, - WINDOW_MAXIMIZE_RESTORE, - WINDOW_MINIMIZE, - WINDOW_POSITION_CENTER, - WINDOW_SNAP_LEFT, - WINDOW_SNAP_RIGHT, #if defined(OS_CHROMEOS) LOCK_SCREEN, OPEN_CROSH, diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index 39fe454..b273cb6 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -8,9 +8,6 @@ #include "ash/wm/activation_controller.h" #include "ui/aura/client/activation_client.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/env.h" -#include "ui/aura/monitor.h" -#include "ui/aura/monitor_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_property.h" @@ -99,13 +96,5 @@ void RestoreWindow(aura::Window* window) { window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); } -void CenterWindow(aura::Window* window) { - const aura::Monitor* monitor = aura::Env::GetInstance()->monitor_manager()-> - GetMonitorNearestWindow(window); - gfx::Rect center = monitor->GetWorkAreaBounds().Center( - window->bounds().size()); - window->SetBounds(center); -} - } // namespace wm } // namespace ash diff --git a/ash/wm/window_util.h b/ash/wm/window_util.h index 6cfc907..1191daa 100644 --- a/ash/wm/window_util.h +++ b/ash/wm/window_util.h @@ -50,9 +50,6 @@ ASH_EXPORT void MinimizeWindow(aura::Window* window); // Restores |window|, which must not be NULL. ASH_EXPORT void RestoreWindow(aura::Window* window); -// Moves the window to the center of the monitor. -ASH_EXPORT void CenterWindow(aura::Window* window); - } // namespace wm } // namespace ash diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc index 0816ff0..158fa3a 100644 --- a/ash/wm/workspace/snap_sizer.cc +++ b/ash/wm/workspace/snap_sizer.cc @@ -66,18 +66,6 @@ void SnapSizer::Update(const gfx::Point& location) { time_last_update_ = base::TimeTicks::Now(); } -gfx::Rect SnapSizer::GetSnapBounds(const gfx::Rect& bounds) { - size_t current; - for (current = 0; current < arraysize(kPercents); ++current) { - gfx::Rect target = GetTargetBoundsForPercent(current); - if (target == bounds) { - ++current; - break; - } - } - return GetTargetBoundsForPercent(current % arraysize(kPercents)); -} - int SnapSizer::CalculateIncrement(int x, int reference_x) const { if (AlongEdge(x)) return 1; @@ -106,16 +94,12 @@ void SnapSizer::ChangeBounds(int x, int delta) { } gfx::Rect SnapSizer::GetTargetBounds() const { - return GetTargetBoundsForPercent(percent_index_); -} - -gfx::Rect SnapSizer::GetTargetBoundsForPercent(int percent_index) const { gfx::Rect work_area(ScreenAsh::GetUnmaximizedWorkAreaBounds(window_)); int y = WindowResizer::AlignToGridRoundUp(work_area.y(), grid_size_); // We don't align to the bottom of the grid as the launcher may not // necessarily align to the grid (happens when auto-hidden). int max_y = work_area.bottom(); - int width = static_cast<float>(work_area.width()) * kPercents[percent_index]; + int width = static_cast<float>(work_area.width()) * kPercents[percent_index_]; if (edge_ == LEFT_EDGE) { int x = WindowResizer::AlignToGridRoundUp(work_area.x(), grid_size_); int mid_x = WindowResizer::AlignToGridRoundUp( diff --git a/ash/wm/workspace/snap_sizer.h b/ash/wm/workspace/snap_sizer.h index 145e4e5..e389de7 100644 --- a/ash/wm/workspace/snap_sizer.h +++ b/ash/wm/workspace/snap_sizer.h @@ -38,10 +38,6 @@ class ASH_EXPORT SnapSizer { // Bounds to position the window at. const gfx::Rect& target_bounds() const { return target_bounds_; } - // Returns the appropriate snap bounds (e.g. if a window is already snapped, - // then it returns the next snap-bounds). - gfx::Rect GetSnapBounds(const gfx::Rect& bounds); - private: // Calculates the amount to increment by. This returns one of -1, 0 or 1 and // is intended to by applied to |percent_index_|. |x| is the current @@ -57,8 +53,6 @@ class ASH_EXPORT SnapSizer { // Returns the target bounds based on the edge and |percent_index_|. gfx::Rect GetTargetBounds() const; - gfx::Rect GetTargetBoundsForPercent(int percent_index) const; - // Returns true if the specified point is along the edge of the screen. bool AlongEdge(int x) const; |