Changeset View
Changeset View
Standalone View
Standalone View
virtualdesktopsdbustypes.cpp
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | ||||
3 | This file is part of the KDE project. | ||||
4 | | ||||
5 | Copyright (C) 2018 Marco Martin <mart@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 | | ||||
21 | // own | ||||
22 | #include "virtualdesktopsdbustypes.h" | ||||
23 | | ||||
24 | | ||||
25 | // Marshall the DBusDesktopDataStruct data into a D-BUS argument | ||||
26 | const QDBusArgument &operator<<(QDBusArgument &argument, const KWin::DBusDesktopDataStruct &desk) | ||||
27 | { | ||||
28 | argument.beginStructure(); | ||||
29 | argument << desk.position; | ||||
30 | argument << desk.id; | ||||
31 | argument << desk.name; | ||||
32 | argument.endStructure(); | ||||
33 | return argument; | ||||
34 | } | ||||
35 | // Retrieve | ||||
36 | const QDBusArgument &operator>>(const QDBusArgument &argument, KWin::DBusDesktopDataStruct &desk) | ||||
37 | { | ||||
38 | argument.beginStructure(); | ||||
39 | argument >> desk.position; | ||||
40 | argument >> desk.id; | ||||
41 | argument >> desk.name; | ||||
42 | argument.endStructure(); | ||||
43 | return argument; | ||||
44 | } | ||||
45 | | ||||
46 | const QDBusArgument &operator<<(QDBusArgument &argument, const KWin::DBusDesktopDataVector &deskVector) | ||||
47 | { | ||||
48 | argument.beginArray(qMetaTypeId<KWin::DBusDesktopDataStruct>()); | ||||
49 | for (int i = 0; i < deskVector.size(); ++i) { | ||||
50 | argument << deskVector[i]; | ||||
51 | } | ||||
52 | argument.endArray(); | ||||
53 | return argument; | ||||
54 | } | ||||
55 | | ||||
56 | const QDBusArgument &operator>>(const QDBusArgument &argument, KWin::DBusDesktopDataVector &deskVector) | ||||
57 | { | ||||
58 | argument.beginArray(); | ||||
59 | deskVector.clear(); | ||||
60 | | ||||
61 | while (!argument.atEnd()) { | ||||
62 | KWin::DBusDesktopDataStruct element; | ||||
63 | argument >> element; | ||||
64 | deskVector.append(element); | ||||
65 | } | ||||
66 | | ||||
67 | argument.endArray(); | ||||
68 | | ||||
69 | return argument; | ||||
70 | } |