Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: ui/events/devices/x11/touch_factory_x11.cc

Issue 1453813003: Fix a regression in checking the status of the touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new sources to gn file. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/devices/x11/touch_factory_x11.cc
diff --git a/ui/events/devices/x11/touch_factory_x11.cc b/ui/events/devices/x11/touch_factory_x11.cc
index d0cc99162699f86e05c10d57570ff8eb0b230268..7044851f925009fefee23ae8e83dfc30e84d412f 100644
--- a/ui/events/devices/x11/touch_factory_x11.cc
+++ b/ui/events/devices/x11/touch_factory_x11.cc
@@ -27,11 +27,30 @@
namespace ui {
+namespace {
+
+bool IsTouchEventsFlagDisabled() {
+ auto command_line = base::CommandLine::ForCurrentProcess();
+ bool touch_flag_status = command_line->HasSwitch(switches::kTouchEvents) &&
+ command_line->GetSwitchValueASCII(switches::kTouchEvents) ==
+ switches::kTouchEventsDisabled;
+#if defined(OS_CHROMEOS)
+ return !GetTouchEventsCrOsMasterSwitch() && touch_flag_status;
dtapuska 2015/11/18 20:13:05 So the problem I have with this is that this is a
afakhry 2015/11/18 20:36:16 Thank you for catching that! The touch events mast
+#else
+ return touch_flag_status;
+#endif // defined(OS_CHROMEOS)
+
+}
+
+} // namespace
+
+
TouchFactory::TouchFactory()
: pointer_device_lookup_(),
touch_device_list_(),
virtual_core_keyboard_device_(-1),
- id_generator_(0) {
+ id_generator_(0),
+ touch_events_disabled_(IsTouchEventsFlagDisabled()) {
if (!DeviceDataManagerX11::GetInstance()->IsXInput2Available())
return;
@@ -159,7 +178,7 @@ bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) {
bool is_from_master_or_float = touch_device_list_[xiev->deviceid];
bool is_from_slave_device = !is_from_master_or_float
&& xiev->sourceid == xiev->deviceid;
- return ui::AreTouchEventsEnabled() &&
+ return !touch_events_disabled_ &&
IsTouchDevice(xiev->deviceid) &&
!is_from_slave_device;
}
@@ -179,7 +198,7 @@ bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) {
if (!pointer_device_lookup_[xiev->deviceid])
return false;
- return IsTouchDevice(xiev->deviceid) ? ui::AreTouchEventsEnabled() : true;
+ return IsTouchDevice(xiev->deviceid) ? !touch_events_disabled_ : true;
}
void TouchFactory::SetupXI2ForXWindow(Window window) {
@@ -266,7 +285,7 @@ void TouchFactory::ReleaseSlotForTrackingID(uint32 tracking_id) {
}
bool TouchFactory::IsTouchDevicePresent() {
- return ui::AreTouchEventsEnabled() && touch_device_lookup_.any();
+ return !touch_events_disabled_ && touch_device_lookup_.any();
}
void TouchFactory::ResetForTest() {
@@ -275,6 +294,7 @@ void TouchFactory::ResetForTest() {
touch_device_list_.clear();
touchscreen_ids_.clear();
id_generator_.ResetForTest();
+ touch_events_disabled_ = false;
}
void TouchFactory::SetTouchDeviceForTest(
@@ -287,6 +307,7 @@ void TouchFactory::SetTouchDeviceForTest(
touch_device_lookup_[*iter] = true;
touch_device_list_[*iter] = true;
}
+ touch_events_disabled_ = false;
}
void TouchFactory::SetPointerDeviceForTest(

Powered by Google App Engine
This is Rietveld 408576698