summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 19:25:12 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 19:25:12 +0000
commit34d4a19cc0847f5df867d2b4cdf9fed10bd99bb8 (patch)
treeb48a1a2d3507599dc60808af6f87c080f54af508 /ui/gfx
parentbb3be3e5f8d19e72c8e30b4925366cd69ae634e4 (diff)
downloadchromium_src-34d4a19cc0847f5df867d2b4cdf9fed10bd99bb8.zip
chromium_src-34d4a19cc0847f5df867d2b4cdf9fed10bd99bb8.tar.gz
chromium_src-34d4a19cc0847f5df867d2b4cdf9fed10bd99bb8.tar.bz2
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
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/display.cc9
-rw-r--r--ui/gfx/display.h11
2 files changed, 17 insertions, 3 deletions
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