Skip to content

Commit

Permalink
X11: Use sourceid instead of deviceid to identify
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaima authored and tonsky committed Sep 17, 2022
1 parent 5554c2c commit fcad8db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions linux/cc/WindowManagerX11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ WindowManagerX11::WindowManagerX11():
void WindowManagerX11::_xi2IterateDevices() {
int deviceCount;
XIDeviceInfo* devices = XIQueryDevice(display, XIAllDevices, &deviceCount);
for (int deviceId = 0; deviceId < deviceCount; ++deviceId) {
XIDeviceInfo& device = devices[deviceId];
for (int i = 0; i < deviceCount; ++i) {
XIDeviceInfo& device = devices[i];
if (device.use != XIMasterPointer) {
continue;
}
XInput2::Device& myDevice = _xi2->deviceById[device.deviceid];
for (int classId = 0; classId < device.num_classes; ++classId) {
XIAnyClassInfo* classInfo = device.classes[classId];
XInput2::Device& myDevice = _xi2->deviceById[classInfo->sourceid];

switch (classInfo->type)
{
Expand Down Expand Up @@ -331,7 +331,7 @@ void WindowManagerX11::_processXEvent(XEvent& ev) {
break;
}

auto itMyDevice = _xi2->deviceById.find(deviceEvent->deviceid);
auto itMyDevice = _xi2->deviceById.find(deviceEvent->sourceid);
if (itMyDevice == _xi2->deviceById.end()) {
break;
}
Expand Down

0 comments on commit fcad8db

Please sign in to comment.