fakeinput: Remove static touches list
We track now touches per device
This commit is contained in:
parent
436211ad45
commit
df184ebd11
2 changed files with 5 additions and 14 deletions
|
@ -26,7 +26,6 @@ public:
|
||||||
FakeInputBackend *q;
|
FakeInputBackend *q;
|
||||||
Display *display;
|
Display *display;
|
||||||
std::map<Resource *, std::unique_ptr<FakeInputDevice>> devices;
|
std::map<Resource *, std::unique_ptr<FakeInputDevice>> devices;
|
||||||
static QList<quint32> touchIds;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void org_kde_kwin_fake_input_bind_resource(Resource *resource) override;
|
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;
|
void org_kde_kwin_fake_input_destroy(Resource *resource) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<quint32> FakeInputBackendPrivate::touchIds = QList<quint32>();
|
|
||||||
|
|
||||||
FakeInputBackendPrivate::FakeInputBackendPrivate(FakeInputBackend *q, Display *display)
|
FakeInputBackendPrivate::FakeInputBackendPrivate(FakeInputBackend *q, Display *display)
|
||||||
: q(q)
|
: q(q)
|
||||||
, display(display)
|
, display(display)
|
||||||
|
@ -178,11 +175,10 @@ void FakeInputBackendPrivate::org_kde_kwin_fake_input_touch_down(Resource *resou
|
||||||
if (!device->isAuthenticated()) {
|
if (!device->isAuthenticated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (touchIds.contains(id)) {
|
if (device->activeTouches.contains(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
touchIds << id;
|
device->activeTouches.insert(id);
|
||||||
device->activeTouches.push_back(id);
|
|
||||||
Q_EMIT device->touchDown(id, QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y)), currentTime(), device);
|
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()) {
|
if (!device->isAuthenticated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!touchIds.contains(id)) {
|
if (!device->activeTouches.contains(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Q_EMIT device->touchMotion(id, QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y)), currentTime(), device);
|
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()) {
|
if (!device->isAuthenticated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!touchIds.contains(id)) {
|
if (device->activeTouches.remove(id)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
touchIds.removeOne(id);
|
|
||||||
if (device->activeTouches.removeAll(id)) {
|
|
||||||
Q_EMIT device->touchUp(id, currentTime(), device);
|
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()) {
|
if (!device->isAuthenticated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
touchIds.clear();
|
|
||||||
device->activeTouches.clear();
|
device->activeTouches.clear();
|
||||||
Q_EMIT device->touchCanceled(device);
|
Q_EMIT device->touchCanceled(device);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
QSet<quint32> pressedButtons;
|
QSet<quint32> pressedButtons;
|
||||||
QSet<quint32> pressedKeys;
|
QSet<quint32> pressedKeys;
|
||||||
QList<quint32> activeTouches;
|
QSet<quint32> activeTouches;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
|
Loading…
Reference in a new issue