1 /* 2 KWin - the KDE window manager 3 This file is part of the KDE project. 4 5 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 6 7 SPDX-License-Identifier: GPL-2.0-or-later 8 */ 9 #ifndef MOCK_EFFECTS_HANDLER_H 10 #define MOCK_EFFECTS_HANDLER_H 11 12 #include <kwineffects.h> 13 #include <QX11Info> 14 15 class MockEffectsHandler : public KWin::EffectsHandler 16 { 17 Q_OBJECT 18 public: 19 explicit MockEffectsHandler(KWin::CompositingType type); activateWindow(KWin::EffectWindow *)20 void activateWindow(KWin::EffectWindow *) override {} activeFullScreenEffect()21 KWin::Effect *activeFullScreenEffect() const override { 22 return nullptr; 23 } hasActiveFullScreenEffect()24 bool hasActiveFullScreenEffect() const override { 25 return false; 26 } activeScreen()27 int activeScreen() const override { 28 return 0; 29 } activeWindow()30 KWin::EffectWindow *activeWindow() const override { 31 return nullptr; 32 } addRepaint(const QRect &)33 void addRepaint(const QRect &) override {} addRepaint(const QRegion &)34 void addRepaint(const QRegion &) override {} addRepaint(int,int,int,int)35 void addRepaint(int, int, int, int) override {} addRepaintFull()36 void addRepaintFull() override {} animationTimeFactor()37 double animationTimeFactor() const override { 38 return 0; 39 } announceSupportProperty(const QByteArray &,KWin::Effect *)40 xcb_atom_t announceSupportProperty(const QByteArray &, KWin::Effect *) override { 41 return XCB_ATOM_NONE; 42 } clientArea(KWin::clientAreaOption,const QPoint &,int)43 QRect clientArea(KWin::clientAreaOption, const QPoint &, int) const override { 44 return QRect(); 45 } clientArea(KWin::clientAreaOption,const KWin::EffectWindow *)46 QRect clientArea(KWin::clientAreaOption, const KWin::EffectWindow *) const override { 47 return QRect(); 48 } clientArea(KWin::clientAreaOption,int,int)49 QRect clientArea(KWin::clientAreaOption, int, int) const override { 50 return QRect(); 51 } closeTabBox()52 void closeTabBox() override {} currentActivity()53 QString currentActivity() const override { 54 return QString(); 55 } currentDesktop()56 int currentDesktop() const override { 57 return 0; 58 } currentTabBoxDesktop()59 int currentTabBoxDesktop() const override { 60 return 0; 61 } currentTabBoxDesktopList()62 QList< int > currentTabBoxDesktopList() const override { 63 return QList<int>(); 64 } currentTabBoxWindow()65 KWin::EffectWindow *currentTabBoxWindow() const override { 66 return nullptr; 67 } currentTabBoxWindowList()68 KWin::EffectWindowList currentTabBoxWindowList() const override { 69 return KWin::EffectWindowList(); 70 } cursorPos()71 QPoint cursorPos() const override { 72 return QPoint(); 73 } decorationsHaveAlpha()74 bool decorationsHaveAlpha() const override { 75 return false; 76 } decorationSupportsBlurBehind()77 bool decorationSupportsBlurBehind() const override { 78 return false; 79 } defineCursor(Qt::CursorShape)80 void defineCursor(Qt::CursorShape) override {} desktopAbove(int,bool)81 int desktopAbove(int, bool) const override { 82 return 0; 83 } desktopAtCoords(QPoint)84 int desktopAtCoords(QPoint) const override { 85 return 0; 86 } desktopBelow(int,bool)87 int desktopBelow(int, bool) const override { 88 return 0; 89 } desktopCoords(int)90 QPoint desktopCoords(int) const override { 91 return QPoint(); 92 } desktopGridCoords(int)93 QPoint desktopGridCoords(int) const override { 94 return QPoint(); 95 } desktopGridHeight()96 int desktopGridHeight() const override { 97 return 0; 98 } desktopGridSize()99 QSize desktopGridSize() const override { 100 return QSize(); 101 } desktopGridWidth()102 int desktopGridWidth() const override { 103 return 0; 104 } desktopName(int)105 QString desktopName(int) const override { 106 return QString(); 107 } desktopToLeft(int,bool)108 int desktopToLeft(int, bool) const override { 109 return 0; 110 } desktopToRight(int,bool)111 int desktopToRight(int, bool) const override { 112 return 0; 113 } doneOpenGLContextCurrent()114 void doneOpenGLContextCurrent() override {} drawWindow(KWin::EffectWindow *,int,const QRegion &,KWin::WindowPaintData &)115 void drawWindow(KWin::EffectWindow *, int, const QRegion &, KWin::WindowPaintData &) override {} effectFrame(KWin::EffectFrameStyle,bool,const QPoint &,Qt::Alignment)116 KWin::EffectFrame *effectFrame(KWin::EffectFrameStyle, bool, const QPoint &, Qt::Alignment) const override { 117 return nullptr; 118 } findWindow(WId)119 KWin::EffectWindow *findWindow(WId) const override { 120 return nullptr; 121 } findWindow(KWaylandServer::SurfaceInterface *)122 KWin::EffectWindow *findWindow(KWaylandServer::SurfaceInterface *) const override { 123 return nullptr; 124 } findWindow(QWindow * w)125 KWin::EffectWindow *findWindow(QWindow *w) const override { 126 Q_UNUSED(w) 127 return nullptr; 128 } findWindow(const QUuid & id)129 KWin::EffectWindow *findWindow(const QUuid &id) const override { 130 Q_UNUSED(id) 131 return nullptr; 132 } getProxy(QString)133 void *getProxy(QString) override { 134 return nullptr; 135 } grabKeyboard(KWin::Effect *)136 bool grabKeyboard(KWin::Effect *) override { 137 return false; 138 } hasDecorationShadows()139 bool hasDecorationShadows() const override { 140 return false; 141 } isScreenLocked()142 bool isScreenLocked() const override { 143 return false; 144 } kwinOption(KWin::KWinOption)145 QVariant kwinOption(KWin::KWinOption) override { 146 return QVariant(); 147 } makeOpenGLContextCurrent()148 bool makeOpenGLContextCurrent() override { 149 return false; 150 } moveWindow(KWin::EffectWindow *,const QPoint &,bool,double)151 void moveWindow(KWin::EffectWindow *, const QPoint &, bool, double) override {} numberOfDesktops()152 int numberOfDesktops() const override { 153 return 0; 154 } numScreens()155 int numScreens() const override { 156 return 0; 157 } optionRollOverDesktops()158 bool optionRollOverDesktops() const override { 159 return false; 160 } paintEffectFrame(KWin::EffectFrame *,const QRegion &,double,double)161 void paintEffectFrame(KWin::EffectFrame *, const QRegion &, double, double) override {} paintScreen(int,const QRegion &,KWin::ScreenPaintData &)162 void paintScreen(int, const QRegion &, KWin::ScreenPaintData &) override {} paintWindow(KWin::EffectWindow *,int,const QRegion &,KWin::WindowPaintData &)163 void paintWindow(KWin::EffectWindow *, int, const QRegion &, KWin::WindowPaintData &) override {} postPaintScreen()164 void postPaintScreen() override {} postPaintWindow(KWin::EffectWindow *)165 void postPaintWindow(KWin::EffectWindow *) override {} prePaintScreen(KWin::ScreenPrePaintData &,std::chrono::milliseconds)166 void prePaintScreen(KWin::ScreenPrePaintData &, std::chrono::milliseconds) override {} prePaintWindow(KWin::EffectWindow *,KWin::WindowPrePaintData &,std::chrono::milliseconds)167 void prePaintWindow(KWin::EffectWindow *, KWin::WindowPrePaintData &, std::chrono::milliseconds) override {} readRootProperty(long int,long int,int)168 QByteArray readRootProperty(long int, long int, int) const override { 169 return QByteArray(); 170 } reconfigure()171 void reconfigure() override {} refTabBox()172 void refTabBox() override {} registerAxisShortcut(Qt::KeyboardModifiers,KWin::PointerAxisDirection,QAction *)173 void registerAxisShortcut(Qt::KeyboardModifiers, KWin::PointerAxisDirection, QAction *) override {} registerGlobalShortcut(const QKeySequence &,QAction *)174 void registerGlobalShortcut(const QKeySequence &, QAction *) override {} registerPointerShortcut(Qt::KeyboardModifiers,Qt::MouseButton,QAction *)175 void registerPointerShortcut(Qt::KeyboardModifiers, Qt::MouseButton, QAction *) override {} registerTouchpadSwipeShortcut(KWin::SwipeDirection,QAction *)176 void registerTouchpadSwipeShortcut(KWin::SwipeDirection, QAction *) override {} registerRealtimeTouchpadSwipeShortcut(KWin::SwipeDirection,QAction *,std::function<void (qreal)>)177 void registerRealtimeTouchpadSwipeShortcut(KWin::SwipeDirection, QAction*, std::function<void(qreal)>) override {} reloadEffect(KWin::Effect *)178 void reloadEffect(KWin::Effect *) override {} removeSupportProperty(const QByteArray &,KWin::Effect *)179 void removeSupportProperty(const QByteArray &, KWin::Effect *) override {} reserveElectricBorder(KWin::ElectricBorder,KWin::Effect *)180 void reserveElectricBorder(KWin::ElectricBorder, KWin::Effect *) override {} registerTouchBorder(KWin::ElectricBorder,QAction *)181 void registerTouchBorder(KWin::ElectricBorder, QAction *) override {} unregisterTouchBorder(KWin::ElectricBorder,QAction *)182 void unregisterTouchBorder(KWin::ElectricBorder, QAction *) override {} scenePainter()183 QPainter *scenePainter() override { 184 return nullptr; 185 } screenNumber(const QPoint &)186 int screenNumber(const QPoint &) const override { 187 return 0; 188 } setActiveFullScreenEffect(KWin::Effect *)189 void setActiveFullScreenEffect(KWin::Effect *) override {} setCurrentDesktop(int)190 void setCurrentDesktop(int) override {} setElevatedWindow(KWin::EffectWindow *,bool)191 void setElevatedWindow(KWin::EffectWindow *, bool) override {} setNumberOfDesktops(int)192 void setNumberOfDesktops(int) override {} setShowingDesktop(bool)193 void setShowingDesktop(bool) override {} setTabBoxDesktop(int)194 void setTabBoxDesktop(int) override {} setTabBoxWindow(KWin::EffectWindow *)195 void setTabBoxWindow(KWin::EffectWindow*) override {} stackingOrder()196 KWin::EffectWindowList stackingOrder() const override { 197 return KWin::EffectWindowList(); 198 } startMouseInterception(KWin::Effect *,Qt::CursorShape)199 void startMouseInterception(KWin::Effect *, Qt::CursorShape) override {} startMousePolling()200 void startMousePolling() override {} stopMouseInterception(KWin::Effect *)201 void stopMouseInterception(KWin::Effect *) override {} stopMousePolling()202 void stopMousePolling() override {} ungrabKeyboard()203 void ungrabKeyboard() override {} unrefTabBox()204 void unrefTabBox() override {} unreserveElectricBorder(KWin::ElectricBorder,KWin::Effect *)205 void unreserveElectricBorder(KWin::ElectricBorder, KWin::Effect *) override {} virtualScreenGeometry()206 QRect virtualScreenGeometry() const override { 207 return QRect(); 208 } virtualScreenSize()209 QSize virtualScreenSize() const override { 210 return QSize(); 211 } windowToDesktop(KWin::EffectWindow *,int)212 void windowToDesktop(KWin::EffectWindow *, int) override {} windowToScreen(KWin::EffectWindow *,int)213 void windowToScreen(KWin::EffectWindow *, int) override {} workspaceHeight()214 int workspaceHeight() const override { 215 return 0; 216 } workspaceWidth()217 int workspaceWidth() const override { 218 return 0; 219 } xcbConnection()220 xcb_connection_t *xcbConnection() const override { 221 return QX11Info::connection(); 222 } x11RootWindow()223 xcb_window_t x11RootWindow() const override { 224 return QX11Info::appRootWindow(); 225 } waylandDisplay()226 KWaylandServer::Display *waylandDisplay() const override { 227 return nullptr; 228 } 229 animationsSupported()230 bool animationsSupported() const override { 231 return m_animationsSuported; 232 } setAnimationsSupported(bool set)233 void setAnimationsSupported(bool set) { 234 m_animationsSuported = set; 235 } 236 cursorImage()237 KWin::PlatformCursorImage cursorImage() const override { 238 return KWin::PlatformCursorImage(); 239 } 240 hideCursor()241 void hideCursor() override {} 242 showCursor()243 void showCursor() override {} 244 startInteractiveWindowSelection(std::function<void (KWin::EffectWindow *)> callback)245 void startInteractiveWindowSelection(std::function<void(KWin::EffectWindow*)> callback) override { 246 callback(nullptr); 247 } startInteractivePositionSelection(std::function<void (const QPoint &)> callback)248 void startInteractivePositionSelection(std::function<void (const QPoint &)> callback) override { 249 callback(QPoint(-1, -1)); 250 } 251 void showOnScreenMessage(const QString &message, const QString &iconName = QString()) override { 252 Q_UNUSED(message) 253 Q_UNUSED(iconName) 254 } 255 void hideOnScreenMessage(OnScreenMessageHideFlags flags = OnScreenMessageHideFlags()) override { Q_UNUSED(flags)} 256 windowToDesktops(KWin::EffectWindow * w,const QVector<uint> & desktops)257 void windowToDesktops(KWin::EffectWindow *w, const QVector<uint> &desktops) override { 258 Q_UNUSED(w) 259 Q_UNUSED(desktops) 260 } 261 262 KSharedConfigPtr config() const override; 263 KSharedConfigPtr inputConfig() const override; renderEffectQuickView(KWin::EffectQuickView * quickView)264 void renderEffectQuickView(KWin::EffectQuickView *quickView) const override { 265 Q_UNUSED(quickView); 266 } sessionState()267 KWin::SessionState sessionState() const override { 268 return KWin::SessionState::Normal; 269 } screens()270 QList<KWin::EffectScreen *> screens() const override { 271 return {}; 272 } screenAt(const QPoint & point)273 KWin::EffectScreen *screenAt(const QPoint &point) const override { 274 Q_UNUSED(point) 275 return nullptr; 276 } findScreen(const QString & name)277 KWin::EffectScreen *findScreen(const QString &name) const override { 278 Q_UNUSED(name) 279 return nullptr; 280 } findScreen(int screenId)281 KWin::EffectScreen *findScreen(int screenId) const override { 282 Q_UNUSED(screenId) 283 return nullptr; 284 } 285 renderScreen(KWin::EffectScreen * screen)286 void renderScreen(KWin::EffectScreen *screen) override { 287 Q_UNUSED(screen); 288 } 289 private: 290 bool m_animationsSuported = true; 291 }; 292 #endif 293