Debian Codegraph @

panel/backends/wayland/wayfire/lxqtwmbackend_wf.h

raw
1 #pragma once
2
3 #include "../../ilxqtabstractwmiface.h"
4 #include "wayfire-common.h"
5
6 #include <QTime>
7 #include <QHash>
8 #include <vector>
9
10 class LXQtTaskbarWayfireWindow;
11 class LXQtTaskbarWayfireWindowManagment;
12 class LXQtWayfireWaylandWorkspaceInfo;
13
14
15 class LXQtTaskbarWayfireBackend : public ILXQtAbstractWMInterface
16 {
17 Q_OBJECT
18
19 public:
20 explicit LXQtTaskbarWayfireBackend(QObject *parent = nullptr);
21
22 // Backend
23 virtual bool supportsAction(WId windowId, LXQtTaskBarBackendAction action) const override;
24
25 // Windows
26 virtual bool reloadWindows() override;
27
28 // Get the current windows
29 virtual QVector<WId> getCurrentWindows() const override;
30
31 // Get the window title
32 virtual QString getWindowTitle(WId windowId) const override;
33
34 // We do not support this
35 virtual bool applicationDemandsAttention(WId windowId) const override;
36
37 // Support for this is based on app-id (handled by LXQt)
38 virtual QIcon getApplicationIcon(WId windowId, int devicePixels) const override;
39
40 // Same as app-id
41 virtual QString getWindowClass(WId windowId) const override;
42
43 // Allways-on-Bottom, Normal or Always-on-top.
44 // Always-on-bottom is not available on wayfire
45 virtual LXQtTaskBarWindowLayer getWindowLayer(WId windowId) const override;
46 virtual bool setWindowLayer(WId windowId, LXQtTaskBarWindowLayer layer) override;
47
48 // Hidden, FullScreen, Minimized, Maximized, MaximizedVertical, MaximizedHorizontally, Normal, RolledUp
49 virtual LXQtTaskBarWindowState getWindowState(WId windowId) const override;
50 virtual bool setWindowState(WId windowId, LXQtTaskBarWindowState state, bool set) override;
51
52 // Is window active
53 virtual bool isWindowActive(WId windowId) const override;
54
55 // Set window as active
56 virtual bool raiseWindow(WId windowId, bool onCurrentWorkSpace) override;
57
58 // Close window
59 virtual bool closeWindow(WId windowId) override;
60
61 // Get active window
62 virtual WId getActiveWindow() const override;
63
64 // Workspaces
65 virtual int getWorkspacesCount(QScreen *screen = nullptr) const override;
66 virtual QString getWorkspaceName(int idx, QString outputName = QString()) const override;
67
68 // Get/Set the current workspace
69 virtual int getCurrentWorkspace(QScreen *screen = nullptr) const override;
70 virtual bool setCurrentWorkspace(int idx, QScreen *screen = nullptr) override;
71
72 // Get/Set the workspace of a window
73 virtual int getWindowWorkspace(WId windowId) const override;
74 virtual bool setWindowOnWorkspace(WId windowId, int idx) override;
75
76 // Move window to previous/next desktop
77 virtual void moveApplicationToPrevNextMonitor(WId windowId, bool next,
78 bool raiseOnCurrentDesktop) override;
79
80 virtual bool isWindowOnScreen(QScreen *screen, WId windowId) const override;
81
82 // Not supported on wayfire at the moment
83 virtual bool setDesktopLayout(Qt::Orientation orientation, int rows, int columns, bool rightToLeft) override;
84
85 // X11 Specific
86 virtual void moveApplication(WId windowId) override;
87 virtual void resizeApplication(WId windowId) override;
88
89 // ???
90 virtual void refreshIconGeometry(WId windowId, const QRect & geom) override;
91
92 // Panel internal - not supported
93 virtual bool isAreaOverlapped(const QRect& area) const override;
94
95 // Show Desktop
96 virtual bool isShowingDesktop() const override;
97 virtual bool showDesktop(bool value) override;
98
99 private:
100 std::unique_ptr<LXQt::Panel::Wayfire> mWayfire;
101
102 // Hash-map of view ids, vs their properties
103 QHash<WaylandId, QJsonObject> mViews;
104
105 // key=transient child, value=leader
106 QHash<WaylandId, WaylandId> transients;
107
108 // Is Desktop Shown
109 bool mIsDesktopShowing = false;
110 };
111
112
113 class LXQtWMBackendWayfireLibrary : public QObject, public ILXQtWMBackendLibrary
114 {
115 Q_OBJECT
116 Q_PLUGIN_METADATA(IID "lxqt.org/Panel/WMInterface/1.0")
117 Q_INTERFACES(ILXQtWMBackendLibrary)
118
119 public:
120 int getBackendScore(const QString& key) const override;
121
122 ILXQtAbstractWMInterface * instance() const override;
123 };