File indexing completed on 2022-11-29 15:04:30

0001 /*
0002     SPDX-FileCopyrightText: 2016 Smith AR <audoban@openmailbox.org>
0003     SPDX-FileCopyrightText: 2016 Michail Vourlakos <mvourlakos@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef XWINDOWINTERFACE_H
0008 #define XWINDOWINTERFACE_H
0009 
0010 // local
0011 #include <config-latte.h>
0012 #include "abstractwindowinterface.h"
0013 #include "windowinfowrap.h"
0014 
0015 // Qt
0016 #include <QObject>
0017 
0018 // KDE
0019 #include <KWindowInfo>
0020 #include <KWindowEffects>
0021 
0022 
0023 namespace Latte {
0024 namespace WindowSystem {
0025 
0026 class XWindowInterface : public AbstractWindowInterface
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     explicit XWindowInterface(QObject *parent = nullptr);
0032     ~XWindowInterface() override;
0033 
0034     void setViewExtraFlags(QObject *view, bool isPanelWindow = true, Latte::Types::Visibility mode = Latte::Types::WindowsGoBelow) override;
0035     void setViewStruts(QWindow &view, const QRect &rect, Plasma::Types::Location location) override;
0036     void setWindowOnActivities(const WindowId &wid, const QStringList &activities) override;
0037 
0038     void removeViewStruts(QWindow &view) override;
0039 
0040     WindowId activeWindow() override;
0041     WindowInfoWrap requestInfo(WindowId wid) override;
0042     WindowInfoWrap requestInfoActive() override;
0043 
0044     void skipTaskBar(const QDialog &dialog) override;
0045     void slideWindow(QWindow &view, Slide location) override;
0046     void enableBlurBehind(QWindow &view) override;
0047 
0048     void requestActivate(WindowId wid) override;
0049     void requestClose(WindowId wid) override;
0050     void requestMoveWindow(WindowId wid, QPoint from) override;
0051     void requestToggleIsOnAllDesktops(WindowId wid) override;
0052     void requestToggleKeepAbove(WindowId wid) override;
0053     void requestToggleMinimized(WindowId wid) override;
0054     void requestToggleMaximized(WindowId wid) override;
0055     void setKeepAbove(WindowId wid, bool active) override;
0056     void setKeepBelow(WindowId wid, bool active) override;
0057 
0058     bool windowCanBeDragged(WindowId wid) override;
0059     bool windowCanBeMaximized(WindowId wid) override;
0060 
0061     QIcon iconFor(WindowId wid) override;
0062     WindowId winIdFor(QString appId, QRect geometry) override;
0063     WindowId winIdFor(QString appId, QString title) override;
0064     AppData appDataFor(WindowId wid) override;
0065 
0066     void setActiveEdge(QWindow *view, bool active) override;
0067 
0068     void switchToNextVirtualDesktop() override;
0069     void switchToPreviousVirtualDesktop() override;
0070 
0071     void setFrameExtents(QWindow *view, const QMargins &margins) override;
0072     void setInputMask(QWindow *window, const QRect &rect) override;
0073 
0074 private:
0075     bool isAcceptableWindow(WindowId wid);
0076     bool isValidWindow(WindowId wid);
0077 
0078     QRect visibleGeometry(const WindowId &wid, const QRect &frameGeometry) const;
0079 
0080     void windowAddedProxy(WId wid);
0081     void windowChangedProxy(WId wid, NET::Properties prop1, NET::Properties2 prop2);
0082 
0083     QUrl windowUrl(WindowId wid);
0084 
0085     void checkShapeExtension();
0086 
0087 private:
0088     //xcb_shape
0089     bool m_shapeExtensionChecked{false};
0090     bool m_shapeAvailable{false};
0091 };
0092 
0093 }
0094 }
0095 
0096 #endif // XWINDOWINTERFACE_H
0097 
0098 
0099