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

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

Issue 922843002: Fix software mirror mode on Ozone part 2/2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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
« no previous file with comments | « ui/events/devices/device_data_manager.cc ('k') | ui/ozone/platform/drm/host/drm_window_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/devices/x11/device_data_manager_x11.cc
diff --git a/ui/events/devices/x11/device_data_manager_x11.cc b/ui/events/devices/x11/device_data_manager_x11.cc
index 0723c122f302e54c006976f886947dfd1112180c..f7b3b124bf96d09ab63882d4bda6ace09c443a26 100644
--- a/ui/events/devices/x11/device_data_manager_x11.cc
+++ b/ui/events/devices/x11/device_data_manager_x11.cc
@@ -111,8 +111,8 @@ namespace ui {
namespace {
-bool KeyboardDeviceHasId(const ui::KeyboardDevice keyboard, unsigned int id) {
- return keyboard.id == id;
+bool DeviceHasId(const ui::InputDevice input_device, unsigned int id) {
+ return input_device.id == id;
}
} // namespace
@@ -667,13 +667,17 @@ void DeviceDataManagerX11::InitializeValuatorsForTest(int deviceid,
bool DeviceDataManagerX11::TouchEventNeedsCalibrate(
unsigned int touch_device_id) const {
-#if defined(OS_CHROMEOS) && defined(USE_X11)
- int64 touch_display_id = GetDisplayForTouchDevice(touch_device_id);
- if (base::SysInfo::IsRunningOnChromeOS() &&
- touch_display_id == gfx::Display::InternalDisplayId()) {
- return true;
- }
-#endif // defined(OS_CHROMEOS) && defined(USE_X11)
+#if defined(OS_CHROMEOS)
+ if (!base::SysInfo::IsRunningOnChromeOS())
+ return false;
+
+ const std::vector<TouchscreenDevice>& touch_devices =
+ ui::DeviceDataManager::GetInstance()->touchscreen_devices();
+ std::vector<TouchscreenDevice>::const_iterator it =
+ std::find_if(touch_devices.begin(), touch_devices.end(),
+ std::bind2nd(std::ptr_fun(&DeviceHasId), touch_device_id));
+ return it != touch_devices.end() && it->type == INPUT_DEVICE_INTERNAL;
+#endif // defined(OS_CHROMEOS)
return false;
}
@@ -691,7 +695,7 @@ void DeviceDataManagerX11::DisableDevice(unsigned int deviceid) {
std::vector<KeyboardDevice>::iterator it =
std::find_if(keyboards.begin(),
keyboards.end(),
- std::bind2nd(std::ptr_fun(&KeyboardDeviceHasId), deviceid));
+ std::bind2nd(std::ptr_fun(&DeviceHasId), deviceid));
if (it != std::end(keyboards)) {
blocked_keyboards_.insert(
std::pair<unsigned int, KeyboardDevice>(deviceid, *it));
@@ -740,11 +744,9 @@ void DeviceDataManagerX11::OnKeyboardDevicesUpdated(
blocked_keyboards_.begin();
blocked_iter != blocked_keyboards_.end();) {
// Check if the blocked device still exists in list of devices.
- std::vector<KeyboardDevice>::iterator it =
- std::find_if(keyboards.begin(),
- keyboards.end(),
- std::bind2nd(std::ptr_fun(&KeyboardDeviceHasId),
- (*blocked_iter).first));
+ std::vector<KeyboardDevice>::iterator it = std::find_if(
+ keyboards.begin(), keyboards.end(),
+ std::bind2nd(std::ptr_fun(&DeviceHasId), (*blocked_iter).first));
// If the device no longer exists, unblock it, else filter it out from our
// active list.
if (it == keyboards.end()) {
« no previous file with comments | « ui/events/devices/device_data_manager.cc ('k') | ui/ozone/platform/drm/host/drm_window_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698