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

Unified Diff: ash/wm/default_window_resizer.cc

Issue 10008084: Add ctrl+drag feature for allowing resizing window with exact positioning. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 8 years, 8 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
« no previous file with comments | « ash/wm/default_window_resizer.h ('k') | ash/wm/toplevel_window_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/default_window_resizer.cc
diff --git a/ash/wm/default_window_resizer.cc b/ash/wm/default_window_resizer.cc
index 71cbf9e65d4135eebad8853ecd7fe0d91514ce57..efa3899f836617009496f41673d4fe8befd10a05 100644
--- a/ash/wm/default_window_resizer.cc
+++ b/ash/wm/default_window_resizer.cc
@@ -27,25 +27,28 @@ DefaultWindowResizer::~DefaultWindowResizer() {
DefaultWindowResizer*
DefaultWindowResizer::Create(aura::Window* window,
const gfx::Point& location,
- int window_component,
- int grid_size) {
- Details details(window, location, window_component, grid_size);
+ int window_component) {
+ Details details(window, location, window_component);
return details.is_resizable ? new DefaultWindowResizer(details) : NULL;
}
-void DefaultWindowResizer::Drag(const gfx::Point& location) {
- gfx::Rect bounds(CalculateBoundsForDrag(details_, location));
+void DefaultWindowResizer::Drag(const gfx::Point& location, int event_flags) {
+ int grid_size = event_flags & ui::EF_CONTROL_DOWN ?
+ 0 : ash::Shell::GetInstance()->GetGridSize();
+ gfx::Rect bounds(CalculateBoundsForDrag(details_, location, grid_size));
if (bounds != details_.window->bounds()) {
did_move_or_resize_ = true;
details_.window->SetBounds(bounds);
}
}
-void DefaultWindowResizer::CompleteDrag() {
- if (details_.grid_size <= 1 || !did_move_or_resize_)
+void DefaultWindowResizer::CompleteDrag(int event_flags) {
+ int grid_size = event_flags & ui::EF_CONTROL_DOWN ?
+ 0 : ash::Shell::GetInstance()->GetGridSize();
+ if (grid_size <= 1 || !did_move_or_resize_)
return;
gfx::Rect new_bounds(
- AdjustBoundsToGrid(details_.window->bounds(), details_.grid_size));
+ AdjustBoundsToGrid(details_.window->bounds(), grid_size));
if (new_bounds == details_.window->bounds())
return;
« no previous file with comments | « ash/wm/default_window_resizer.h ('k') | ash/wm/toplevel_window_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698