1 /*
2 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7 #include "kwindoweffects_p.h"
8 #include "pluginwrapper_p.h"
9 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62)
10 #include <QWidget>
11 #endif
12 #include <QWindow>
13
KWindowEffectsPrivate()14 KWindowEffectsPrivate::KWindowEffectsPrivate()
15 {
16 }
17
~KWindowEffectsPrivate()18 KWindowEffectsPrivate::~KWindowEffectsPrivate()
19 {
20 }
21
KWindowEffectsPrivateV2()22 KWindowEffectsPrivateV2::KWindowEffectsPrivateV2()
23 : KWindowEffectsPrivate()
24 {
25 }
26
~KWindowEffectsPrivateV2()27 KWindowEffectsPrivateV2::~KWindowEffectsPrivateV2()
28 {
29 }
30
31 namespace KWindowEffects
32 {
isEffectAvailable(Effect effect)33 bool isEffectAvailable(Effect effect)
34 {
35 return KWindowSystemPluginWrapper::self().effects()->isEffectAvailable(effect);
36 }
37
38 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
enableBlurBehind(WId window,bool enable,const QRegion & region)39 void enableBlurBehind(WId window, bool enable, const QRegion ®ion)
40 {
41 KWindowSystemPluginWrapper::self().effects()->enableBlurBehind(window, enable, region);
42 }
43 #endif
44
45 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
enableBackgroundContrast(WId window,bool enable,qreal contrast,qreal intensity,qreal saturation,const QRegion & region)46 void enableBackgroundContrast(WId window, bool enable, qreal contrast, qreal intensity, qreal saturation, const QRegion ®ion)
47 {
48 KWindowSystemPluginWrapper::self().effects()->enableBackgroundContrast(window, enable, contrast, intensity, saturation, region);
49 }
50 #endif
51
enableBlurBehind(QWindow * window,bool enable,const QRegion & region)52 void enableBlurBehind(QWindow *window, bool enable, const QRegion ®ion)
53 {
54 KWindowSystemPluginWrapper::self().effects()->enableBlurBehind(window->winId(), enable, region);
55 }
56
enableBackgroundContrast(QWindow * window,bool enable,qreal contrast,qreal intensity,qreal saturation,const QRegion & region)57 void enableBackgroundContrast(QWindow *window, bool enable, qreal contrast, qreal intensity, qreal saturation, const QRegion ®ion)
58 {
59 KWindowSystemPluginWrapper::self().effects()->enableBackgroundContrast(window->winId(), enable, contrast, intensity, saturation, region);
60 }
61
setBackgroundFrost(QWindow * window,QColor frostColor,const QRegion & region)62 void setBackgroundFrost(QWindow *window, QColor frostColor, const QRegion ®ion)
63 {
64 auto effects = KWindowSystemPluginWrapper::self().effects();
65 if (auto effectsv2 = dynamic_cast<KWindowEffectsPrivateV2 *>(effects)) {
66 effectsv2->setBackgroundFrost(window, frostColor, region);
67 }
68 }
69
slideWindow(QWindow * window,SlideFromLocation location,int offset)70 void slideWindow(QWindow *window, SlideFromLocation location, int offset)
71 {
72 KWindowSystemPluginWrapper::self().effects()->slideWindow(window->winId(), location, offset);
73 }
74
75 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
highlightWindows(WId controller,const QList<WId> & ids)76 void highlightWindows(WId controller, const QList<WId> &ids)
77 {
78 KWindowSystemPluginWrapper::self().effects()->highlightWindows(controller, ids);
79 }
80 #endif
81
82 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 67)
markAsDashboard(WId window)83 void markAsDashboard(WId window)
84 {
85 KWindowSystemPluginWrapper::self().effects()->markAsDashboard(window);
86 }
87 #endif
88
89 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
presentWindows(WId controller,const QList<WId> & ids)90 void presentWindows(WId controller, const QList<WId> &ids)
91 {
92 KWindowSystemPluginWrapper::self().effects()->presentWindows(controller, ids);
93 }
94 #endif
95
96 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
presentWindows(WId controller,int desktop)97 void presentWindows(WId controller, int desktop)
98 {
99 KWindowSystemPluginWrapper::self().effects()->presentWindows(controller, desktop);
100 }
101 #endif
102
103 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 82)
slideWindow(WId id,SlideFromLocation location,int offset)104 void slideWindow(WId id, SlideFromLocation location, int offset)
105 {
106 KWindowSystemPluginWrapper::self().effects()->slideWindow(id, location, offset);
107 }
108 #endif
109
110 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62)
slideWindow(QWidget * widget,SlideFromLocation location)111 void slideWindow(QWidget *widget, SlideFromLocation location)
112 {
113 slideWindow(widget->effectiveWinId(), location, -1);
114 }
115 #endif
116
117 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 81)
windowSizes(const QList<WId> & ids)118 QList<QSize> windowSizes(const QList<WId> &ids)
119 {
120 return KWindowSystemPluginWrapper::self().effects()->windowSizes(ids);
121 }
122 #endif
123
124 }
125