Changeset View
Changeset View
Standalone View
Standalone View
scripting/cursorwrapper.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | ||||
3 | This file is part of the KDE project. | ||||
4 | | ||||
5 | Copyright (C) 2017 David Edmundson <davidedmundson@kde.org> | ||||
6 | | ||||
7 | This program is free software; you can redistribute it and/or modify | ||||
8 | it under the terms of the GNU General Public License as published by | ||||
9 | the Free Software Foundation; either version 2 of the License, or | ||||
10 | (at your option) any later version. | ||||
11 | | ||||
12 | This program is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | GNU General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU General Public License | ||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | *********************************************************************/ | ||||
20 | #ifndef KWIN_CURSORWRAPPER_H | ||||
21 | #define KWIN_CURSORWRAPPER_H | ||||
22 | | ||||
23 | #include <QObject> | ||||
24 | | ||||
25 | namespace KWin | ||||
26 | { | ||||
27 | | ||||
28 | /** | ||||
29 | * @brief Qml export for providing the current cursor position | ||||
30 | * | ||||
31 | * Mouse positions under X11 are only tracked when this item is enabled | ||||
32 | * It is enabled by default | ||||
33 | */ | ||||
34 | class CursorWrapper : public QObject | ||||
35 | { | ||||
36 | Q_OBJECT | ||||
37 | Q_PROPERTY(int x READ x NOTIFY positionChanged) | ||||
38 | Q_PROPERTY(int y READ y NOTIFY positionChanged) | ||||
39 | Q_PROPERTY(bool enabled MEMBER m_enabled WRITE setEnabled NOTIFY enabledChanged) | ||||
40 | | ||||
41 | public: | ||||
42 | CursorWrapper(QObject *parent=0); | ||||
43 | ~CursorWrapper(); | ||||
44 | /** | ||||
45 | * The current global x position | ||||
46 | */ | ||||
47 | int x() const; | ||||
48 | /** | ||||
49 | * The current global y position | ||||
50 | */ | ||||
51 | int y() const; | ||||
52 | | ||||
53 | void setEnabled(bool); | ||||
54 | | ||||
55 | Q_SIGNALS: | ||||
56 | void positionChanged(); | ||||
57 | void enabledChanged(); | ||||
58 | private: | ||||
59 | bool m_enabled = true; | ||||
60 | }; | ||||
61 | | ||||
62 | } // KWin | ||||
63 | | ||||
64 | #endif // KWIN_SCRIPTING_DBUSCALL_H |