Add blur strength for wayland.

This commit is contained in:
Mouse Zhang 2022-09-19 16:04:23 +08:00 committed by Mouse Zhang
parent 89e20fa214
commit 2b62e74e19
2 changed files with 19 additions and 0 deletions

View File

@ -2,6 +2,7 @@
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2022 KylinSoft Co., Ltd.
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
@ -90,6 +91,9 @@ public:
QRegion pendingRegion;
QRegion currentRegion;
uint32_t pendingStrength = -1;
uint32_t currentStrength = -1;
BlurInterface *q;
protected:
@ -97,12 +101,14 @@ protected:
void org_kde_kwin_blur_commit(Resource *resource) override;
void org_kde_kwin_blur_set_region(Resource *resource, wl_resource *region) override;
void org_kde_kwin_blur_release(Resource *resource) override;
virtual void org_kde_kwin_blur_set_strength(Resource *resource, uint32_t strength) override;
};
void BlurInterfacePrivate::org_kde_kwin_blur_commit(Resource *resource)
{
Q_UNUSED(resource)
currentRegion = pendingRegion;
currentStrength = pendingStrength;
}
void BlurInterfacePrivate::org_kde_kwin_blur_set_region(Resource *resource, wl_resource *region)
@ -121,6 +127,12 @@ void BlurInterfacePrivate::org_kde_kwin_blur_release(Resource *resource)
wl_resource_destroy(resource->handle);
}
void BlurInterfacePrivate::org_kde_kwin_blur_set_strength(Resource *resource, uint32_t strength)
{
Q_UNUSED(resource)
pendingStrength = strength;
}
void BlurInterfacePrivate::org_kde_kwin_blur_destroy_resource(Resource *resource)
{
Q_UNUSED(resource)
@ -146,4 +158,8 @@ QRegion BlurInterface::region()
return d->currentRegion;
}
uint32_t BlurInterface::strength()
{
return d->currentStrength;
}
}

View File

@ -2,6 +2,7 @@
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2022 KylinSoft Co., Ltd.
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
@ -65,6 +66,8 @@ public:
*/
QRegion region();
uint32_t strength();
private:
explicit BlurInterface(wl_resource *resource);
friend class BlurManagerInterfacePrivate;