summaryrefslogtreecommitdiffstats
path: root/ui/base/touch
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 20:26:27 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 20:26:27 +0000
commit1f49f12c16ae604ed51e8879b65eb076720e0c5d (patch)
treec45bcaff27c59eef6528c474e9103dc70bb3a6a0 /ui/base/touch
parent6824c9f3070117dd340b60add331155ecb487e02 (diff)
downloadchromium_src-1f49f12c16ae604ed51e8879b65eb076720e0c5d.zip
chromium_src-1f49f12c16ae604ed51e8879b65eb076720e0c5d.tar.gz
chromium_src-1f49f12c16ae604ed51e8879b65eb076720e0c5d.tar.bz2
aura: Fix cursor visibility, and a crash on mouse-wheel.
Fix cursor visibility so that a cursor is hidden only if a touch device is available. BUG=cursor hides on desktop TEST=none Review URL: http://codereview.chromium.org/8319009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/touch')
-rw-r--r--ui/base/touch/touch_factory.cc11
-rw-r--r--ui/base/touch/touch_factory.h3
2 files changed, 11 insertions, 3 deletions
diff --git a/ui/base/touch/touch_factory.cc b/ui/base/touch/touch_factory.cc
index fcab846..b3f9e51 100644
--- a/ui/base/touch/touch_factory.cc
+++ b/ui/base/touch/touch_factory.cc
@@ -135,6 +135,7 @@ TouchFactory::TouchFactory()
keep_mouse_cursor_(false),
cursor_timer_(),
pointer_device_lookup_(),
+ touch_device_available_(false),
touch_device_list_(),
#if defined(USE_XI2_MT)
min_available_slot_(0),
@@ -202,6 +203,7 @@ void TouchFactory::UpdateDeviceList(Display* display) {
// If XInput2 is not supported, this will return null (with count of -1) so
// we assume there cannot be any touch devices.
int count = 0;
+ touch_device_available_ = false;
touch_device_lookup_.reset();
touch_device_list_.clear();
#if !defined(USE_XI2_MT)
@@ -212,6 +214,7 @@ void TouchFactory::UpdateDeviceList(Display* display) {
if (devtype && !strcmp(devtype, XI_TOUCHSCREEN)) {
touch_device_lookup_[devlist[i].id] = true;
touch_device_list_[devlist[i].id] = true;
+ touch_device_available_ = true;
}
}
}
@@ -245,6 +248,7 @@ void TouchFactory::UpdateDeviceList(Display* display) {
if (tci->mode == XIDirectTouch) {
touch_device_lookup_[devinfo->deviceid] = true;
touch_device_list_[devinfo->deviceid] = true;
+ touch_device_available_ = true;
}
}
}
@@ -455,11 +459,12 @@ void TouchFactory::SetCursorVisible(bool show, bool start_timer) {
Display* display = ui::GetXDisplay();
Window window = DefaultRootWindow(display);
- if (is_cursor_visible_) {
+ // Hide the cursor only if there's a chance that the user will be using touch
+ // (i.e. if a touch device is available).
+ if (is_cursor_visible_)
XDefineCursor(display, window, arrow_cursor_);
- } else {
+ else if (touch_device_available_)
XDefineCursor(display, window, invisible_cursor_);
- }
}
void TouchFactory::SetupValuator() {
diff --git a/ui/base/touch/touch_factory.h b/ui/base/touch/touch_factory.h
index 3b1b5f1..158d2e0 100644
--- a/ui/base/touch/touch_factory.h
+++ b/ui/base/touch/touch_factory.h
@@ -188,6 +188,9 @@ class UI_EXPORT TouchFactory {
// A quick lookup table for determining if a device is a touch device.
std::bitset<kMaxDeviceNum> touch_device_lookup_;
+ // Indicates whether a touch device is currently available or not.
+ bool touch_device_available_;
+
// The list of touch devices. For testing/debugging purposes, a mouse-device
// can sometimes be treated as a touch device. The key in the map represents
// the device id, and the value represents if the device is a real touch