Remove redundant ifs

The resources are already looked up for a specific client.
This commit is contained in:
David Redondo 2021-08-06 09:19:11 +02:00
parent 2aeaf9331b
commit 731ae21cb2

View file

@ -108,9 +108,7 @@ void PointerSwipeGestureV1Interface::sendBegin(quint32 serial, quint32 fingerCou
const QList<Resource *> swipeResources = resourceMap().values(focusedClient->client());
for (Resource *swipeResource : swipeResources) {
if (swipeResource->client() == focusedClient->client()) {
send_begin(swipeResource->handle, serial, seat->timestamp(), focusedSurface->resource(), fingerCount);
}
send_begin(swipeResource->handle, serial, seat->timestamp(), focusedSurface->resource(), fingerCount);
}
}
@ -124,9 +122,7 @@ void PointerSwipeGestureV1Interface::sendUpdate(const QSizeF &delta)
const QList<Resource *> swipeResources = resourceMap().values(focusedClient->client());
for (Resource *swipeResource : swipeResources) {
if (swipeResource->client() == focusedClient->client()) {
send_update(swipeResource->handle, seat->timestamp(), wl_fixed_from_double(delta.width()), wl_fixed_from_double(delta.height()));
}
send_update(swipeResource->handle, seat->timestamp(), wl_fixed_from_double(delta.width()), wl_fixed_from_double(delta.height()));
}
}
@ -140,9 +136,7 @@ void PointerSwipeGestureV1Interface::sendEnd(quint32 serial)
const QList<Resource *> swipeResources = resourceMap().values(focusedClient->client());
for (Resource *swipeResource : swipeResources) {
if (swipeResource->client() == focusedClient->client()) {
send_end(swipeResource->handle, serial, seat->timestamp(), false);
}
send_end(swipeResource->handle, serial, seat->timestamp(), false);
}
// The gesture session has been just finished, reset the cached focused client.
@ -159,9 +153,7 @@ void PointerSwipeGestureV1Interface::sendCancel(quint32 serial)
const QList<Resource *> swipeResources = resourceMap().values(focusedClient->client());
for (Resource *swipeResource : swipeResources) {
if (swipeResource->client() == focusedClient->client()) {
send_end(swipeResource->handle, serial, seat->timestamp(), true);
}
send_end(swipeResource->handle, serial, seat->timestamp(), true);
}
// The gesture session has been just finished, reset the cached focused client.
@ -202,9 +194,7 @@ void PointerPinchGestureV1Interface::sendBegin(quint32 serial, quint32 fingerCou
const QList<Resource *> pinchResources = resourceMap().values(*focusedClient);
for (Resource *pinchResource : pinchResources) {
if (pinchResource->client() == focusedClient->client()) {
send_begin(pinchResource->handle, serial, seat->timestamp(), focusedSurface->resource(), fingerCount);
}
send_begin(pinchResource->handle, serial, seat->timestamp(), focusedSurface->resource(), fingerCount);
}
}
@ -218,14 +208,12 @@ void PointerPinchGestureV1Interface::sendUpdate(const QSizeF &delta, qreal scale
const QList<Resource *> pinchResources = resourceMap().values(*focusedClient);
for (Resource *pinchResource : pinchResources) {
if (pinchResource->client() == focusedClient->client()) {
send_update(pinchResource->handle,
seat->timestamp(),
wl_fixed_from_double(delta.width()),
wl_fixed_from_double(delta.height()),
wl_fixed_from_double(scale),
wl_fixed_from_double(rotation));
}
send_update(pinchResource->handle,
seat->timestamp(),
wl_fixed_from_double(delta.width()),
wl_fixed_from_double(delta.height()),
wl_fixed_from_double(scale),
wl_fixed_from_double(rotation));
}
}
@ -239,9 +227,7 @@ void PointerPinchGestureV1Interface::sendEnd(quint32 serial)
const QList<Resource *> pinchResources = resourceMap().values(*focusedClient);
for (Resource *pinchResource : pinchResources) {
if (pinchResource->client() == focusedClient->client()) {
send_end(pinchResource->handle, serial, seat->timestamp(), false);
}
send_end(pinchResource->handle, serial, seat->timestamp(), false);
}
// The gesture session has been just finished, reset the cached focused client.
@ -258,9 +244,7 @@ void PointerPinchGestureV1Interface::sendCancel(quint32 serial)
const QList<Resource *> pinchResources = resourceMap().values(*focusedClient);
for (Resource *pinchResource : pinchResources) {
if (pinchResource->client() == focusedClient->client()) {
send_end(pinchResource->handle, serial, seat->timestamp(), true);
}
send_end(pinchResource->handle, serial, seat->timestamp(), true);
}
// The gesture session has been just finished, reset the cached focused client.
@ -301,9 +285,7 @@ void PointerHoldGestureV1Interface::sendBegin(quint32 serial, quint32 fingerCoun
const QList<Resource *> holdResources = resourceMap().values(*focusedClient);
for (Resource *holdResource : holdResources) {
if (holdResource->client() == focusedClient->client()) {
send_begin(holdResource->handle, serial, seat->timestamp(), focusedSurface->resource(), fingerCount);
}
send_begin(holdResource->handle, serial, seat->timestamp(), focusedSurface->resource(), fingerCount);
}
}
@ -317,9 +299,7 @@ void PointerHoldGestureV1Interface::sendEnd(quint32 serial)
const QList<Resource *> holdResources = resourceMap().values(*focusedClient);
for (Resource *holdResource : holdResources) {
if (holdResource->client() == focusedClient->client()) {
send_end(holdResource->handle, serial, seat->timestamp(), false);
}
send_end(holdResource->handle, serial, seat->timestamp(), false);
}
// The gesture session has been just finished, reset the cached focused client.
@ -336,9 +316,7 @@ void PointerHoldGestureV1Interface::sendCancel(quint32 serial)
const QList<Resource *> holdResources = resourceMap().values(*focusedClient);
for (Resource *holdResource : holdResources) {
if (holdResource->client() == holdResource->client()) {
send_end(holdResource->handle, serial, seat->timestamp(), true);
}
send_end(holdResource->handle, serial, seat->timestamp(), true);
}
// The gesture session has been just finished, reset the cached focused client.