File indexing completed on 2024-05-19 15:21:17

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "kwindoweffects_p.h"
0008 #include "pluginwrapper_p.h"
0009 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62)
0010 #include <QWidget>
0011 #endif
0012 #include <QWindow>
0013 
0014 KWindowEffectsPrivate::KWindowEffectsPrivate()
0015 {
0016 }
0017 
0018 KWindowEffectsPrivate::~KWindowEffectsPrivate()
0019 {
0020 }
0021 
0022 KWindowEffectsPrivateV2::KWindowEffectsPrivateV2()
0023     : KWindowEffectsPrivate()
0024 {
0025 }
0026 
0027 KWindowEffectsPrivateV2::~KWindowEffectsPrivateV2()
0028 {
0029 }
0030 
0031 namespace KWindowEffects
0032 {
0033 bool isEffectAvailable(Effect effect)
0034 {
0035     return KWindowSystemPluginWrapper::self().effects()->isEffectAvailable(effect);
0036 }
0037 
0038 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
0039 void enableBlurBehind(WId window, bool enable, const QRegion &region)
0040 {
0041     KWindowSystemPluginWrapper::self().effects()->enableBlurBehind(window, enable, region);
0042 }
0043 #endif
0044 
0045 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
0046 void enableBackgroundContrast(WId window, bool enable, qreal contrast, qreal intensity, qreal saturation, const QRegion &region)
0047 {
0048     KWindowSystemPluginWrapper::self().effects()->enableBackgroundContrast(window, enable, contrast, intensity, saturation, region);
0049 }
0050 #endif
0051 
0052 void enableBlurBehind(QWindow *window, bool enable, const QRegion &region)
0053 {
0054     KWindowSystemPluginWrapper::self().effects()->enableBlurBehind(window->winId(), enable, region);
0055 }
0056 
0057 void enableBackgroundContrast(QWindow *window, bool enable, qreal contrast, qreal intensity, qreal saturation, const QRegion &region)
0058 {
0059     KWindowSystemPluginWrapper::self().effects()->enableBackgroundContrast(window->winId(), enable, contrast, intensity, saturation, region);
0060 }
0061 
0062 void setBackgroundFrost(QWindow *window, QColor frostColor, const QRegion &region)
0063 {
0064     auto effects = KWindowSystemPluginWrapper::self().effects();
0065     if (auto effectsv2 = dynamic_cast<KWindowEffectsPrivateV2 *>(effects)) {
0066         effectsv2->setBackgroundFrost(window, frostColor, region);
0067     }
0068 }
0069 
0070 void slideWindow(QWindow *window, SlideFromLocation location, int offset)
0071 {
0072     KWindowSystemPluginWrapper::self().effects()->slideWindow(window->winId(), location, offset);
0073 }
0074 
0075 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
0076 void highlightWindows(WId controller, const QList<WId> &ids)
0077 {
0078     KWindowSystemPluginWrapper::self().effects()->highlightWindows(controller, ids);
0079 }
0080 #endif
0081 
0082 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67)
0083 void markAsDashboard(WId window)
0084 {
0085     KWindowSystemPluginWrapper::self().effects()->markAsDashboard(window);
0086 }
0087 #endif
0088 
0089 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
0090 void presentWindows(WId controller, const QList<WId> &ids)
0091 {
0092     KWindowSystemPluginWrapper::self().effects()->presentWindows(controller, ids);
0093 }
0094 #endif
0095 
0096 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
0097 void presentWindows(WId controller, int desktop)
0098 {
0099     KWindowSystemPluginWrapper::self().effects()->presentWindows(controller, desktop);
0100 }
0101 #endif
0102 
0103 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
0104 void slideWindow(WId id, SlideFromLocation location, int offset)
0105 {
0106     KWindowSystemPluginWrapper::self().effects()->slideWindow(id, location, offset);
0107 }
0108 #endif
0109 
0110 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62)
0111 void slideWindow(QWidget *widget, SlideFromLocation location)
0112 {
0113     slideWindow(widget->effectiveWinId(), location, -1);
0114 }
0115 #endif
0116 
0117 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 81)
0118 QList<QSize> windowSizes(const QList<WId> &ids)
0119 {
0120     return KWindowSystemPluginWrapper::self().effects()->windowSizes(ids);
0121 }
0122 #endif
0123 
0124 }