1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-27 15:21:40 +03:00
latte-dock/app/wm/waylandinterface.h

109 lines
3.4 KiB
C
Raw Normal View History

/*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WAYLANDINTERFACE_H
#define WAYLANDINTERFACE_H
#include "abstractwindowinterface.h"
#include "windowinfowrap.h"
#include <QObject>
2017-06-29 23:33:12 +03:00
#include <QMap>
#include <KWindowInfo>
#include <KWindowEffects>
2017-06-11 00:33:46 +03:00
#include <QSignalMapper>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/surface.h>
namespace Latte {
class DockCorona;
2017-06-29 23:33:12 +03:00
namespace Private {
/**
* @brief this class is use for create the struts inside wayland
*/
class GhostWindow;
2017-06-29 23:33:12 +03:00
}
2018-07-03 22:15:45 +03:00
class WaylandInterface : public AbstractWindowInterface
{
Q_OBJECT
public:
explicit WaylandInterface(QObject *parent = nullptr);
~WaylandInterface() override;
void setDockExtraFlags(QWindow &view) override;
2017-06-29 23:50:11 +03:00
void setDockStruts(QWindow &view, const QRect &rect
, Plasma::Types::Location location) override;
void setWindowOnActivities(QWindow &view, const QStringList &activities) override;
void removeDockStruts(QWindow &view) const override;
WindowId activeWindow() const override;
WindowInfoWrap requestInfo(WindowId wid) const override;
WindowInfoWrap requestInfoActive() const override;
bool isOnCurrentDesktop(WindowId wid) const override;
bool isOnCurrentActivity(WindowId wid) const override;
const std::list<WindowId> &windows() const override;
void setKeepAbove(const QDialog &dialog, bool above = true) const override;
void skipTaskBar(const QDialog &dialog) const override;
void slideWindow(QWindow &view, Slide location) const override;
void enableBlurBehind(QWindow &view) const override;
void requestToggleMaximized(WindowId wid) const override;
void requestMoveWindow(WindowId wid, QPoint from) const override;
bool windowCanBeDragged(WindowId wid) const;
void setEdgeStateFor(QWindow *view, bool active) const override;
void initWindowManagement(KWayland::Client::PlasmaWindowManagement *windowManagement);
private:
2017-06-11 00:33:46 +03:00
void init();
inline bool isValidWindow(const KWayland::Client::PlasmaWindow *w) const;
void windowCreatedProxy(KWayland::Client::PlasmaWindow *w);
KWayland::Client::PlasmaWindow *windowFor(WindowId wid) const;
KWayland::Client::PlasmaShell *waylandDockCoronaInterface() const;
2017-06-11 00:33:46 +03:00
QSignalMapper *mapper{nullptr};
2017-06-29 23:33:12 +03:00
friend class Private::GhostWindow;
mutable QMap<WindowId, Private::GhostWindow *> m_ghostWindows;
KWayland::Client::PlasmaWindowManagement *m_windowManagement{nullptr};
DockCorona *m_corona{nullptr};
};
2017-06-29 23:33:12 +03:00
}
#endif // WAYLANDINTERFACE_H