Changeset View
Changeset View
Standalone View
Standalone View
gmenu-dbusmenu-proxy/menuproxy.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2018 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This library 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 GNU | ||||
12 | * Lesser General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public | ||||
15 | * License along with this library; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
17 | * | ||||
18 | */ | ||||
19 | | ||||
20 | #pragma once | ||||
21 | | ||||
22 | #include <QObject> | ||||
23 | #include <QByteArray> | ||||
24 | #include <QHash> | ||||
25 | #include <QWindow> // for WId | ||||
26 | | ||||
27 | #include <xcb/xcb_atom.h> | ||||
28 | | ||||
29 | class Menu; | ||||
30 | | ||||
31 | class MenuProxy : public QObject//, public QAbstractNativeEventFilter | ||||
32 | { | ||||
33 | Q_OBJECT | ||||
34 | | ||||
35 | public: | ||||
36 | MenuProxy(); | ||||
37 | ~MenuProxy() override; | ||||
38 | | ||||
39 | protected: | ||||
40 | //bool nativeEventFilter(const QByteArray & eventType, void * message, long * result) override; | ||||
41 | | ||||
42 | private Q_SLOTS: | ||||
43 | void onWindowAdded(WId id); | ||||
44 | void onWindowRemoved(WId id); | ||||
45 | | ||||
46 | private: | ||||
47 | // FIXME the get one reads "UTF8String" (reads gnome) the write thing writes "String" (writes kde) | ||||
48 | QByteArray getWindowPropertyString(WId id, const QByteArray &name); | ||||
49 | void writeWindowProperty(WId id, const QByteArray &name, const QByteArray &value); | ||||
50 | xcb_atom_t getAtom(const QByteArray &name); | ||||
51 | | ||||
52 | QHash<WId, Menu *> m_menus; | ||||
53 | | ||||
54 | }; |