Commit f46f24fc authored by mfomitchev's avatar mfomitchev Committed by Commit bot

Fixing: ui::IsTouchDevicePresent() doesn't respect --touch-devices flag.

BUG=419064

Review URL: https://codereview.chromium.org/614093004

Cr-Commit-Position: refs/heads/master@{#297516}
parent 9100646e
...@@ -28,7 +28,6 @@ namespace ui { ...@@ -28,7 +28,6 @@ namespace ui {
TouchFactory::TouchFactory() TouchFactory::TouchFactory()
: pointer_device_lookup_(), : pointer_device_lookup_(),
touch_device_available_(false),
touch_events_disabled_(false), touch_events_disabled_(false),
touch_device_list_(), touch_device_list_(),
max_touch_points_(-1), max_touch_points_(-1),
...@@ -81,7 +80,6 @@ void TouchFactory::SetTouchDeviceListFromCommandLine() { ...@@ -81,7 +80,6 @@ void TouchFactory::SetTouchDeviceListFromCommandLine() {
void TouchFactory::UpdateDeviceList(Display* display) { void TouchFactory::UpdateDeviceList(Display* display) {
// Detect touch devices. // Detect touch devices.
touch_device_available_ = false;
touch_device_lookup_.reset(); touch_device_lookup_.reset();
touch_device_list_.clear(); touch_device_list_.clear();
touchscreen_ids_.clear(); touchscreen_ids_.clear();
...@@ -101,7 +99,6 @@ void TouchFactory::UpdateDeviceList(Display* display) { ...@@ -101,7 +99,6 @@ void TouchFactory::UpdateDeviceList(Display* display) {
if (dev_list[i].type == xi_touchscreen) { if (dev_list[i].type == xi_touchscreen) {
touch_device_lookup_[dev_list[i].id] = true; touch_device_lookup_[dev_list[i].id] = true;
touch_device_list_[dev_list[i].id] = false; touch_device_list_[dev_list[i].id] = false;
touch_device_available_ = true;
} }
} }
#endif #endif
...@@ -137,7 +134,6 @@ void TouchFactory::UpdateDeviceList(Display* display) { ...@@ -137,7 +134,6 @@ void TouchFactory::UpdateDeviceList(Display* display) {
if (tci->mode == XIDirectTouch) { if (tci->mode == XIDirectTouch) {
touch_device_lookup_[devinfo->deviceid] = true; touch_device_lookup_[devinfo->deviceid] = true;
touch_device_list_[devinfo->deviceid] = true; touch_device_list_[devinfo->deviceid] = true;
touch_device_available_ = true;
if (tci->num_touches > 0 && tci->num_touches > max_touch_points_) if (tci->num_touches > 0 && tci->num_touches > max_touch_points_)
max_touch_points_ = tci->num_touches; max_touch_points_ = tci->num_touches;
} }
...@@ -277,7 +273,7 @@ void TouchFactory::ReleaseSlotForTrackingID(uint32 tracking_id) { ...@@ -277,7 +273,7 @@ void TouchFactory::ReleaseSlotForTrackingID(uint32 tracking_id) {
} }
bool TouchFactory::IsTouchDevicePresent() { bool TouchFactory::IsTouchDevicePresent() {
return !touch_events_disabled_ && touch_device_available_; return !touch_events_disabled_ && touch_device_lookup_.any();
} }
int TouchFactory::GetMaxTouchPoints() const { int TouchFactory::GetMaxTouchPoints() const {
...@@ -287,7 +283,6 @@ int TouchFactory::GetMaxTouchPoints() const { ...@@ -287,7 +283,6 @@ int TouchFactory::GetMaxTouchPoints() const {
void TouchFactory::ResetForTest() { void TouchFactory::ResetForTest() {
pointer_device_lookup_.reset(); pointer_device_lookup_.reset();
touch_device_lookup_.reset(); touch_device_lookup_.reset();
touch_device_available_ = false;
touch_events_disabled_ = false; touch_events_disabled_ = false;
touch_device_list_.clear(); touch_device_list_.clear();
touchscreen_ids_.clear(); touchscreen_ids_.clear();
...@@ -306,7 +301,6 @@ void TouchFactory::SetTouchDeviceForTest( ...@@ -306,7 +301,6 @@ void TouchFactory::SetTouchDeviceForTest(
touch_device_lookup_[*iter] = true; touch_device_lookup_[*iter] = true;
touch_device_list_[*iter] = true; touch_device_list_[*iter] = true;
} }
touch_device_available_ = true;
touch_events_disabled_ = false; touch_events_disabled_ = false;
} }
......
...@@ -121,9 +121,6 @@ class EVENTS_BASE_EXPORT TouchFactory { ...@@ -121,9 +121,6 @@ class EVENTS_BASE_EXPORT TouchFactory {
// A quick lookup table for determining if a device is a touch device. // A quick lookup table for determining if a device is a touch device.
std::bitset<kMaxDeviceNum> touch_device_lookup_; std::bitset<kMaxDeviceNum> touch_device_lookup_;
// Indicates whether a touch device is currently available or not.
bool touch_device_available_;
// Indicates whether touch events are explicitly disabled. // Indicates whether touch events are explicitly disabled.
bool touch_events_disabled_; bool touch_events_disabled_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment