From 34d4a19cc0847f5df867d2b4cdf9fed10bd99bb8 Mon Sep 17 00:00:00 2001 From: "sadrul@chromium.org" Date: Fri, 25 Oct 2013 19:25:12 +0000 Subject: cros: Default to natural scrolling if the internal diplay is a touchscreen. Expose whether a particular display has touch-screen support through gfx::Display, and use that information to turn on natural scrolling on chromeos when the internal display is a touchscreen. BUG=311343 R=oshima@chromium.org Review URL: https://codereview.chromium.org/42863003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231079 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/gfx/display.cc | 9 ++++++--- ui/gfx/display.h | 11 +++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'ui/gfx') diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc index ee650d8..024b1f9 100644 --- a/ui/gfx/display.cc +++ b/ui/gfx/display.cc @@ -57,13 +57,15 @@ bool Display::HasForceDeviceScaleFactor() { Display::Display() : id_(kInvalidDisplayID), device_scale_factor_(GetForcedDeviceScaleFactor()), - rotation_(ROTATE_0) { + rotation_(ROTATE_0), + touch_support_(TOUCH_SUPPORT_UNKNOWN) { } Display::Display(int64 id) : id_(id), device_scale_factor_(GetForcedDeviceScaleFactor()), - rotation_(ROTATE_0) { + rotation_(ROTATE_0), + touch_support_(TOUCH_SUPPORT_UNKNOWN) { } Display::Display(int64 id, const gfx::Rect& bounds) @@ -71,7 +73,8 @@ Display::Display(int64 id, const gfx::Rect& bounds) bounds_(bounds), work_area_(bounds), device_scale_factor_(GetForcedDeviceScaleFactor()), - rotation_(ROTATE_0) { + rotation_(ROTATE_0), + touch_support_(TOUCH_SUPPORT_UNKNOWN) { #if defined(USE_AURA) SetScaleAndBounds(device_scale_factor_, bounds); #endif diff --git a/ui/gfx/display.h b/ui/gfx/display.h index 324b961..eb35a5f 100644 --- a/ui/gfx/display.h +++ b/ui/gfx/display.h @@ -30,6 +30,13 @@ class GFX_EXPORT Display { ROTATE_270, }; + // Touch support for the display. + enum TouchSupport { + TOUCH_SUPPORT_UNKNOWN, + TOUCH_SUPPORT_AVAILABLE, + TOUCH_SUPPORT_UNAVAILABLE, + }; + // Creates a display with kInvalidDisplayID as default. Display(); explicit Display(int64 id); @@ -67,6 +74,9 @@ class GFX_EXPORT Display { Rotation rotation() const { return rotation_; } void set_rotation(Rotation rotation) { rotation_ = rotation; } + TouchSupport touch_support() const { return touch_support_; } + void set_touch_support(TouchSupport support) { touch_support_ = support; } + // Utility functions that just return the size of display and // work area. const Size& size() const { return bounds_.size(); } @@ -113,6 +123,7 @@ class GFX_EXPORT Display { Rect work_area_; float device_scale_factor_; Rotation rotation_; + TouchSupport touch_support_; }; } // namespace gfx -- cgit v1.1