fakeinput: Remove static touches list

We track now touches per device
This commit is contained in:
David Redondo 2024-08-12 14:09:40 +02:00
parent 436211ad45
commit df184ebd11
2 changed files with 5 additions and 14 deletions

View file

@ -26,7 +26,6 @@ public:
FakeInputBackend *q;
Display *display;
std::map<Resource *, std::unique_ptr<FakeInputDevice>> devices;
static QList<quint32> touchIds;
protected:
void org_kde_kwin_fake_input_bind_resource(Resource *resource) override;
@ -45,8 +44,6 @@ protected:
void org_kde_kwin_fake_input_destroy(Resource *resource) override;
};
QList<quint32> FakeInputBackendPrivate::touchIds = QList<quint32>();
FakeInputBackendPrivate::FakeInputBackendPrivate(FakeInputBackend *q, Display *display)
: q(q)
, display(display)
@ -178,11 +175,10 @@ void FakeInputBackendPrivate::org_kde_kwin_fake_input_touch_down(Resource *resou
if (!device->isAuthenticated()) {
return;
}
if (touchIds.contains(id)) {
if (device->activeTouches.contains(id)) {
return;
}
touchIds << id;
device->activeTouches.push_back(id);
device->activeTouches.insert(id);
Q_EMIT device->touchDown(id, QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y)), currentTime(), device);
}
@ -192,7 +188,7 @@ void FakeInputBackendPrivate::org_kde_kwin_fake_input_touch_motion(Resource *res
if (!device->isAuthenticated()) {
return;
}
if (!touchIds.contains(id)) {
if (!device->activeTouches.contains(id)) {
return;
}
Q_EMIT device->touchMotion(id, QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y)), currentTime(), device);
@ -204,11 +200,7 @@ void FakeInputBackendPrivate::org_kde_kwin_fake_input_touch_up(Resource *resourc
if (!device->isAuthenticated()) {
return;
}
if (!touchIds.contains(id)) {
return;
}
touchIds.removeOne(id);
if (device->activeTouches.removeAll(id)) {
if (device->activeTouches.remove(id)) {
Q_EMIT device->touchUp(id, currentTime(), device);
}
}
@ -219,7 +211,6 @@ void FakeInputBackendPrivate::org_kde_kwin_fake_input_touch_cancel(Resource *res
if (!device->isAuthenticated()) {
return;
}
touchIds.clear();
device->activeTouches.clear();
Q_EMIT device->touchCanceled(device);
}

View file

@ -43,7 +43,7 @@ public:
QSet<quint32> pressedButtons;
QSet<quint32> pressedKeys;
QList<quint32> activeTouches;
QSet<quint32> activeTouches;
private:
QString m_name;