| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/touch/touch_factory.h" | 5 #include "ui/base/touch/touch_factory.h" |
| 6 | 6 |
| 7 #include <X11/cursorfont.h> | 7 #include <X11/cursorfont.h> |
| 8 #include <X11/extensions/XInput.h> | 8 #include <X11/extensions/XInput.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #include <X11/extensions/XIproto.h> | 10 #include <X11/extensions/XIproto.h> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 if (!atom_tp) | 57 if (!atom_tp) |
| 58 return NULL; | 58 return NULL; |
| 59 | 59 |
| 60 for (int i = 0; i < info->num_classes; i++) { | 60 for (int i = 0; i < info->num_classes; i++) { |
| 61 if (info->classes[i]->type != XIValuatorClass) | 61 if (info->classes[i]->type != XIValuatorClass) |
| 62 continue; | 62 continue; |
| 63 XIValuatorClassInfo* v = | 63 XIValuatorClassInfo* v = |
| 64 reinterpret_cast<XIValuatorClassInfo*>(info->classes[i]); | 64 reinterpret_cast<XIValuatorClassInfo*>(info->classes[i]); |
| 65 | 65 |
| 66 if (v->label) { | 66 if (v->label) { |
| 67 const char* atom = XGetAtomName(display, v->label); | 67 ui::XScopedString atom(XGetAtomName(display, v->label)); |
| 68 if (atom && strcmp(atom, atom_tp) == 0) | 68 if (atom.string() && strcmp(atom.string(), atom_tp) == 0) |
| 69 return v; | 69 return v; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 return NULL; | 73 return NULL; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 namespace ui { | 78 namespace ui { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // If XInput2 is not supported, this will return null (with count of -1) so | 144 // If XInput2 is not supported, this will return null (with count of -1) so |
| 145 // we assume there cannot be any touch devices. | 145 // we assume there cannot be any touch devices. |
| 146 int count = 0; | 146 int count = 0; |
| 147 touch_device_available_ = false; | 147 touch_device_available_ = false; |
| 148 touch_device_lookup_.reset(); | 148 touch_device_lookup_.reset(); |
| 149 touch_device_list_.clear(); | 149 touch_device_list_.clear(); |
| 150 #if !defined(USE_XI2_MT) | 150 #if !defined(USE_XI2_MT) |
| 151 XDeviceInfo* devlist = XListInputDevices(display, &count); | 151 XDeviceInfo* devlist = XListInputDevices(display, &count); |
| 152 for (int i = 0; i < count; i++) { | 152 for (int i = 0; i < count; i++) { |
| 153 if (devlist[i].type) { | 153 if (devlist[i].type) { |
| 154 const char* devtype = XGetAtomName(display, devlist[i].type); | 154 XScopedString devtype(XGetAtomName(display, devlist[i].type)); |
| 155 if (devtype && !strcmp(devtype, XI_TOUCHSCREEN)) { | 155 if (devtype.string() && !strcmp(devtype.string(), XI_TOUCHSCREEN)) { |
| 156 touch_device_lookup_[devlist[i].id] = true; | 156 touch_device_lookup_[devlist[i].id] = true; |
| 157 touch_device_list_[devlist[i].id] = true; | 157 touch_device_list_[devlist[i].id] = true; |
| 158 touch_device_available_ = true; | 158 touch_device_available_ = true; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 if (devlist) | 162 if (devlist) |
| 163 XFreeDeviceList(devlist); | 163 XFreeDeviceList(devlist); |
| 164 #endif | 164 #endif |
| 165 | 165 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 float* max) { | 493 float* max) { |
| 494 if (valuator_lookup_[deviceid][tp] >= 0) { | 494 if (valuator_lookup_[deviceid][tp] >= 0) { |
| 495 *min = touch_param_min_[deviceid][tp]; | 495 *min = touch_param_min_[deviceid][tp]; |
| 496 *max = touch_param_max_[deviceid][tp]; | 496 *max = touch_param_max_[deviceid][tp]; |
| 497 return true; | 497 return true; |
| 498 } | 498 } |
| 499 return false; | 499 return false; |
| 500 } | 500 } |
| 501 | 501 |
| 502 } // namespace ui | 502 } // namespace ui |
| OLD | NEW |