Changeset View
Changeset View
Standalone View
Standalone View
plugins/declarative/kwinnested/kwinnested.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright (C) 2016 Bhavisha Dhruve <bhavishadhruve@gmail.com> | ||||
3 | | ||||
4 | This program is free software; you can redistribute it and/or modify | ||||
5 | it under the terms of the GNU General Public License as published by | ||||
6 | the Free Software Foundation; either version 2 of the License, or | ||||
7 | (at your option) any later version. | ||||
8 | | ||||
9 | This program is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | GNU General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU General Public License | ||||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
16 | *********************************************************************/ | ||||
17 | | ||||
18 | #ifndef KWINNESTED_H | ||||
19 | #define KWINNESTED_H | ||||
20 | | ||||
21 | #include <QtQuick/QQuickItem> | ||||
22 | #include <QObject> | ||||
23 | #include <QProcess> | ||||
24 | #include <QScopedPointer> | ||||
25 | #include <QSGSimpleTextureNode> | ||||
26 | #include <QWheelEvent> | ||||
27 | | ||||
28 | class QElapsedTimer; | ||||
29 | | ||||
30 | namespace KWayland | ||||
31 | { | ||||
32 | namespace Server | ||||
33 | { | ||||
34 | class Display; | ||||
35 | class SeatInterface; | ||||
36 | class ShellInterface; | ||||
37 | class SurfaceInterface; | ||||
38 | } | ||||
39 | } | ||||
40 | | ||||
41 | class KWinNested : public QQuickItem | ||||
42 | { | ||||
43 | Q_OBJECT | ||||
44 | /** | ||||
45 | * socketName to pass to Wayland Server Display. | ||||
46 | **/ | ||||
47 | Q_PROPERTY(QString socketName READ socketName WRITE setSocketName NOTIFY socketNameChanged) | ||||
48 | | ||||
49 | public: | ||||
50 | KWinNested(QQuickItem *parent = nullptr); | ||||
51 | ~KWinNested() override; | ||||
52 | | ||||
53 | void setSocketName(const QString &socketName) | ||||
54 | { | ||||
55 | if (m_socketName != socketName) { | ||||
56 | m_socketName = socketName; | ||||
57 | emit socketNameChanged(socketName); | ||||
58 | } | ||||
59 | } | ||||
60 | | ||||
61 | QString socketName() const | ||||
62 | { | ||||
63 | return m_socketName; | ||||
64 | } | ||||
65 | | ||||
66 | Q_INVOKABLE void start(); | ||||
67 | Q_INVOKABLE void stop(); | ||||
68 | QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *); | ||||
69 | void mousePressEvent(QMouseEvent *event); | ||||
70 | void mouseReleaseEvent(QMouseEvent *event); | ||||
71 | void keyPressEvent(QKeyEvent *event); | ||||
72 | void keyReleaseEvent(QKeyEvent *event); | ||||
73 | void hoverMoveEvent(QHoverEvent *event); | ||||
74 | void wheelEvent(QWheelEvent *event); | ||||
75 | | ||||
76 | signals: | ||||
77 | void socketNameChanged(QString); | ||||
78 | | ||||
79 | private: | ||||
80 | QString m_socketName; | ||||
81 | KWayland::Server::Display *m_display = nullptr; | ||||
82 | KWayland::Server::SeatInterface *m_seat = nullptr; | ||||
83 | KWayland::Server::ShellInterface *m_shell = nullptr; | ||||
84 | KWayland::Server::SurfaceInterface *m_surface = nullptr; | ||||
85 | QProcess *m_kwinWaylandProcess; | ||||
86 | QScopedPointer<QElapsedTimer> m_timeSinceStart; | ||||
87 | QSGTexture *m_texture = nullptr; | ||||
88 | | ||||
89 | }; | ||||
90 | | ||||
91 | #endif //KWINNESTED_H | ||||
92 | |