summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-09 19:42:39 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-09 19:42:39 +0000
commita86445bd3d13de8f9845ee939856acbbc11a0a7c (patch)
tree82c575bc5e709a9a7213b9d39ef42eb04b8cae77 /ash
parent37e47023fb62c398f5d4a837f77a9835f5e3f265 (diff)
downloadchromium_src-a86445bd3d13de8f9845ee939856acbbc11a0a7c.zip
chromium_src-a86445bd3d13de8f9845ee939856acbbc11a0a7c.tar.gz
chromium_src-a86445bd3d13de8f9845ee939856acbbc11a0a7c.tar.bz2
ash: Use different hit-test outer-region for mouse and touch events.
The hit-region for windows need to be larger for touch events to allow resizing windows easily, while continuing to use a smaller hit-region for mouse-events. BUG=135187 Review URL: https://chromiumcodereview.appspot.com/10854060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150870 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash_constants.cc2
-rw-r--r--ash/ash_constants.h2
-rw-r--r--ash/wm/frame_painter.cc12
-rw-r--r--ash/wm/shelf_layout_manager.cc9
4 files changed, 12 insertions, 13 deletions
diff --git a/ash/ash_constants.cc b/ash/ash_constants.cc
index 616bee4..e452d46 100644
--- a/ash/ash_constants.cc
+++ b/ash/ash_constants.cc
@@ -13,8 +13,8 @@ namespace ash {
DEFINE_WINDOW_PROPERTY_KEY(bool, kConstrainedWindowKey, false);
const int kResizeAreaCornerSize = 16;
-const int kResizeOutsideBoundsSizeTouch = 30;
const int kResizeOutsideBoundsSize = 6;
+const int kResizeOutsideBoundsScaleForTouch = 5;
const int kResizeInsideBoundsSize = 1;
} // namespace ash
diff --git a/ash/ash_constants.h b/ash/ash_constants.h
index 17082d8..ad12a6f 100644
--- a/ash/ash_constants.h
+++ b/ash/ash_constants.h
@@ -24,8 +24,8 @@ ASH_EXPORT extern const int kResizeAreaCornerSize;
// extends to the edge of the window. We consider a small region outside the
// window bounds and an even smaller region overlapping the window to be the
// "non-client" area and use it for resizing.
-ASH_EXPORT extern const int kResizeOutsideBoundsSizeTouch;
ASH_EXPORT extern const int kResizeOutsideBoundsSize;
+ASH_EXPORT extern const int kResizeOutsideBoundsScaleForTouch;
ASH_EXPORT extern const int kResizeInsideBoundsSize;
} // namespace ash
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 10fbbc6..5050906 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -181,12 +181,10 @@ void FramePainter::Init(views::Widget* frame,
window_ = frame->GetNativeWindow();
// Ensure we get resize cursors for a few pixels outside our bounds.
- int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ?
- kResizeOutsideBoundsSizeTouch :
- kResizeOutsideBoundsSize;
- window_->set_hit_test_bounds_override_outer(
- gfx::Insets(-outside_bounds, -outside_bounds,
- -outside_bounds, -outside_bounds));
+ window_->SetHitTestBoundsOverrideOuter(
+ gfx::Insets(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize,
+ -kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize),
+ kResizeOutsideBoundsScaleForTouch);
// Ensure we get resize cursors just inside our bounds as well.
window_->set_hit_test_bounds_override_inner(
gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize,
@@ -224,7 +222,7 @@ int FramePainter::NonClientHitTest(views::NonClientFrameView* view,
if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH &&
aura::Env::GetInstance()->is_touch_down()) {
- outside_bounds = kResizeOutsideBoundsSizeTouch;
+ outside_bounds *= kResizeOutsideBoundsScaleForTouch;
}
expanded_bounds.Inset(-outside_bounds, -outside_bounds);
diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc
index fa758dc..e1da66e 100644
--- a/ash/wm/shelf_layout_manager.cc
+++ b/ash/wm/shelf_layout_manager.cc
@@ -585,10 +585,11 @@ void ShelfLayoutManager::UpdateHitTestBounds() {
break;
}
}
- if (launcher_widget() && launcher_widget()->GetNativeWindow())
- launcher_widget()->GetNativeWindow()->set_hit_test_bounds_override_outer(
- insets);
- status_->GetNativeWindow()->set_hit_test_bounds_override_outer(insets);
+ if (launcher_widget() && launcher_widget()->GetNativeWindow()) {
+ launcher_widget()->GetNativeWindow()->SetHitTestBoundsOverrideOuter(
+ insets, 1);
+ }
+ status_->GetNativeWindow()->SetHitTestBoundsOverrideOuter( insets, 1);
}
bool ShelfLayoutManager::IsShelfWindow(aura::Window* window) {