Avoid emitting excessive changed signals

If the layer shell surface properties don't change, don't emit the
changed signals and issue wayland requests.
This commit is contained in:
Vlad Zahorodnii 2023-05-17 14:57:09 +03:00
parent 5e88f449b0
commit 9750fd8be7

View file

@ -47,9 +47,11 @@ Window::~Window()
void Window::setAnchors(Anchors anchors) void Window::setAnchors(Anchors anchors)
{ {
if (d->anchors != anchors) {
d->anchors = anchors; d->anchors = anchors;
Q_EMIT anchorsChanged(); Q_EMIT anchorsChanged();
} }
}
Window::Anchors Window::anchors() const Window::Anchors Window::anchors() const
{ {
@ -58,9 +60,11 @@ Window::Anchors Window::anchors() const
void Window::setExclusiveZone(int32_t zone) void Window::setExclusiveZone(int32_t zone)
{ {
if (d->exclusionZone != zone) {
d->exclusionZone = zone; d->exclusionZone = zone;
Q_EMIT exclusionZoneChanged(); Q_EMIT exclusionZoneChanged();
} }
}
int32_t Window::exclusionZone() const int32_t Window::exclusionZone() const
{ {
@ -69,9 +73,11 @@ int32_t Window::exclusionZone() const
void Window::setMargins(const QMargins &margins) void Window::setMargins(const QMargins &margins)
{ {
if (d->margins != margins) {
d->margins = margins; d->margins = margins;
Q_EMIT marginsChanged(); Q_EMIT marginsChanged();
} }
}
QMargins Window::margins() const QMargins Window::margins() const
{ {
@ -80,9 +86,11 @@ QMargins Window::margins() const
void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity) void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity)
{ {
if (d->keyboardInteractivity != interactivity) {
d->keyboardInteractivity = interactivity; d->keyboardInteractivity = interactivity;
Q_EMIT keyboardInteractivityChanged(); Q_EMIT keyboardInteractivityChanged();
} }
}
Window::KeyboardInteractivity Window::keyboardInteractivity() const Window::KeyboardInteractivity Window::keyboardInteractivity() const
{ {
@ -91,9 +99,11 @@ Window::KeyboardInteractivity Window::keyboardInteractivity() const
void Window::setLayer(Layer layer) void Window::setLayer(Layer layer)
{ {
if (d->layer != layer) {
d->layer = layer; d->layer = layer;
Q_EMIT layerChanged(); Q_EMIT layerChanged();
} }
}
void Window::setScope(const QString &scope) void Window::setScope(const QString &scope)
{ {