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

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

Issue 2848253002: Merge DeviceDataManagerX11 valuator information. (Closed)
Patch Set: Created 3 years, 8 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/x11/device_data_manager_x11.h ('k') | no next file » | 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 6351aca2216e4a6b83b74f42f2842aca1e229039..5cf34b53dd1d3f29ac59d7db13c72f0bfa81a30e 100644
--- a/ui/events/devices/x11/device_data_manager_x11.cc
+++ b/ui/events/devices/x11/device_data_manager_x11.cc
@@ -232,8 +232,6 @@ void DeviceDataManagerX11::UpdateDeviceList(Display* display) {
valuator_count_[i] = 0;
valuator_lookup_[i].clear();
data_type_lookup_[i].clear();
- valuator_min_[i].clear();
- valuator_max_[i].clear();
scroll_data_[i].horizontal.number = -1;
scroll_data_[i].horizontal.seen = false;
scroll_data_[i].vertical.number = -1;
@@ -285,11 +283,9 @@ void DeviceDataManagerX11::UpdateDeviceList(Display* display) {
if (!valuator_count_[deviceid])
continue;
- valuator_lookup_[deviceid].resize(DT_LAST_ENTRY, -1);
+ valuator_lookup_[deviceid].resize(DT_LAST_ENTRY);
data_type_lookup_[deviceid].resize(
valuator_count_[deviceid], DT_LAST_ENTRY);
- valuator_min_[deviceid].resize(DT_LAST_ENTRY, 0);
- valuator_max_[deviceid].resize(DT_LAST_ENTRY, 0);
for (int j = 0; j < kMaxSlotNum; j++)
last_seen_valuator_[deviceid][j].resize(DT_LAST_ENTRY, 0);
for (int j = 0; j < info.num_classes; ++j) {
@@ -373,7 +369,7 @@ bool DeviceDataManagerX11::GetEventData(const XEvent& xev,
return true;
}
- int val_index = valuator_lookup_[sourceid][type];
+ int val_index = valuator_lookup_[sourceid][type].number;
int slot = 0;
if (val_index >= 0) {
if (XIMaskIsSet(xiev->valuators.mask, val_index)) {
@@ -467,7 +463,7 @@ bool DeviceDataManagerX11::HasEventData(
return false;
if (type >= valuator_lookup_[xiev->sourceid].size())
return false;
- const int idx = valuator_lookup_[xiev->sourceid][type];
+ const int idx = valuator_lookup_[xiev->sourceid][type].number;
return (idx >= 0) && XIMaskIsSet(xiev->valuators.mask, idx);
}
@@ -682,9 +678,9 @@ bool DeviceDataManagerX11::GetDataRange(int deviceid,
return false;
if (valuator_lookup_[deviceid].empty())
return false;
- if (valuator_lookup_[deviceid][type] >= 0) {
- *min = valuator_min_[deviceid][type];
- *max = valuator_max_[deviceid][type];
+ if (valuator_lookup_[deviceid][type].number >= 0) {
+ *min = valuator_lookup_[deviceid][type].min;
+ *max = valuator_lookup_[deviceid][type].max;
return true;
}
return false;
@@ -698,8 +694,6 @@ void DeviceDataManagerX11::SetDeviceListForTest(
valuator_count_[i] = 0;
valuator_lookup_[i].clear();
data_type_lookup_[i].clear();
- valuator_min_[i].clear();
- valuator_max_[i].clear();
for (int j = 0; j < kMaxSlotNum; j++)
last_seen_valuator_[i][j].clear();
}
@@ -726,7 +720,7 @@ void DeviceDataManagerX11::SetDeviceListForTest(
void DeviceDataManagerX11::SetValuatorDataForTest(XIDeviceEvent* xievent,
DataType type,
double value) {
- int index = valuator_lookup_[xievent->deviceid][type];
+ int index = valuator_lookup_[xievent->deviceid][type].number;
CHECK(!XIMaskIsSet(xievent->valuators.mask, index));
CHECK(index >= 0 && index < valuator_count_[xievent->deviceid]);
XISetMask(xievent->valuators.mask, index);
@@ -747,17 +741,15 @@ void DeviceDataManagerX11::InitializeValuatorsForTest(int deviceid,
int end_valuator,
double min_value,
double max_value) {
- valuator_lookup_[deviceid].resize(DT_LAST_ENTRY, -1);
+ valuator_lookup_[deviceid].resize(DT_LAST_ENTRY);
data_type_lookup_[deviceid].resize(DT_LAST_ENTRY, DT_LAST_ENTRY);
- valuator_min_[deviceid].resize(DT_LAST_ENTRY, 0);
- valuator_max_[deviceid].resize(DT_LAST_ENTRY, 0);
for (int j = 0; j < kMaxSlotNum; j++)
last_seen_valuator_[deviceid][j].resize(DT_LAST_ENTRY, 0);
for (int j = start_valuator; j <= end_valuator; ++j) {
- valuator_lookup_[deviceid][j] = valuator_count_[deviceid];
+ valuator_lookup_[deviceid][j].number = valuator_count_[deviceid];
sadrul 2017/05/01 16:03:56 Maybe something like: ValuatorInfo* info = &valu
kylechar 2017/05/01 16:10:17 Done with "auto& valuator_info = ...".
+ valuator_lookup_[deviceid][j].min = min_value;
+ valuator_lookup_[deviceid][j].max = max_value;
data_type_lookup_[deviceid][valuator_count_[deviceid]] = j;
- valuator_min_[deviceid][j] = min_value;
- valuator_max_[deviceid][j] = max_value;
valuator_count_[deviceid]++;
}
}
@@ -776,10 +768,10 @@ bool DeviceDataManagerX11::UpdateValuatorClassDevice(
DCHECK_GE(data_type, 0);
DCHECK_LT(data_type, DT_LAST_ENTRY);
- valuator_lookup_[deviceid][data_type] = valuator_class_info->number;
+ valuator_lookup_[deviceid][data_type].number = valuator_class_info->number;
+ valuator_lookup_[deviceid][data_type].min = valuator_class_info->min;
+ valuator_lookup_[deviceid][data_type].max = valuator_class_info->max;
sadrul 2017/05/01 16:03:56 ditto
kylechar 2017/05/01 16:10:17 Done.
data_type_lookup_[deviceid][valuator_class_info->number] = data_type;
- valuator_min_[deviceid][data_type] = valuator_class_info->min;
- valuator_max_[deviceid][data_type] = valuator_class_info->max;
return IsCMTDataType(data_type);
}
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698