File indexing completed on 2024-04-21 16:17:22

0001 /*
0002 *  Copyright 2016  Smith AR <audoban@openmailbox.org>
0003 *                  Michail Vourlakos <mvourlakos@gmail.com>
0004 *
0005 *  This file is part of Latte-Dock
0006 *
0007 *  Latte-Dock is free software; you can redistribute it and/or
0008 *  modify it under the terms of the GNU General Public License as
0009 *  published by the Free Software Foundation; either version 2 of
0010 *  the License, or (at your option) any later version.
0011 *
0012 *  Latte-Dock is distributed in the hope that it will be useful,
0013 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 *  GNU General Public License for more details.
0016 *
0017 *  You should have received a copy of the GNU General Public License
0018 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0019 */
0020 
0021 #ifndef XWINDOWINTERFACE_H
0022 #define XWINDOWINTERFACE_H
0023 
0024 // local
0025 #include "abstractwindowinterface.h"
0026 #include "windowinfowrap.h"
0027 
0028 // Qt
0029 #include <QObject>
0030 
0031 // KDE
0032 #include <KWindowInfo>
0033 #include <KWindowEffects>
0034 
0035 
0036 namespace Latte {
0037 namespace WindowSystem {
0038 
0039 class XWindowInterface : public AbstractWindowInterface
0040 {
0041     Q_OBJECT
0042 
0043 public:
0044     explicit XWindowInterface(QObject *parent = nullptr);
0045     ~XWindowInterface() override;
0046 
0047     void setViewExtraFlags(QWindow &view) override;
0048     void setViewStruts(QWindow &view, const QRect &rect
0049                        , Plasma::Types::Location location) override;
0050     void setWindowOnActivities(QWindow &window, const QStringList &activities) override;
0051 
0052     void removeViewStruts(QWindow &view) const override;
0053 
0054     WindowId activeWindow() const override;
0055     WindowInfoWrap requestInfo(WindowId wid) const override;
0056     WindowInfoWrap requestInfoActive() const override;
0057 
0058     void setKeepAbove(const QDialog &dialog, bool above = true) const override;
0059     void skipTaskBar(const QDialog &dialog) const override;
0060     void slideWindow(QWindow &view, Slide location) const override;
0061     void enableBlurBehind(QWindow &view) const override;
0062 
0063     void requestActivate(WindowId wid) const override;
0064     void requestClose(WindowId wid) const override;
0065     void requestMoveWindow(WindowId wid, QPoint from) const override;
0066     void requestToggleIsOnAllDesktops(WindowId wid) const override;
0067     void requestToggleKeepAbove(WindowId wid) const override;
0068     void requestToggleMinimized(WindowId wid) const override;
0069     void requestToggleMaximized(WindowId wid) const override;
0070 
0071     bool windowCanBeDragged(WindowId wid) const override;
0072     bool windowCanBeMaximized(WindowId wid) const override;
0073 
0074     QIcon iconFor(WindowId wid) const override;
0075     WindowId winIdFor(QString appId, QRect geometry) const override;   
0076     AppData appDataFor(WindowId wid) const override;
0077 
0078     void setActiveEdge(QWindow *view, bool active) const override;
0079 
0080     void switchToNextVirtualDesktop() const override;
0081     void switchToPreviousVirtualDesktop() const override;
0082 
0083 private:
0084     bool isValidWindow(WindowId wid) const;
0085     bool isValidWindow(const KWindowInfo &winfo) const;
0086     void windowChangedProxy(WId wid, NET::Properties prop1, NET::Properties2 prop2);
0087 
0088     QUrl windowUrl(WindowId wid) const;
0089 
0090 private:
0091     WindowId m_desktopId{-1};
0092 };
0093 
0094 }
0095 }
0096 
0097 #endif // XWINDOWINTERFACE_H
0098 
0099 
0100