File: menuproxy.h

package info (click to toggle)
plasma-workspace 4%3A5.27.5-2%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 102,040 kB
  • sloc: cpp: 121,800; xml: 3,238; python: 645; perl: 586; sh: 254; javascript: 113; ruby: 62; makefile: 15; ansic: 13
file content (63 lines) | stat: -rw-r--r-- 1,232 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
    SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de>

    SPDX-License-Identifier: LGPL-2.1-or-later
*/

#pragma once

#include <QByteArray>
#include <QHash>
#include <QObject>
#include <QWindow> // for WId

#include <xcb/xcb_atom.h>

class QDBusServiceWatcher;
class QTimer;

class KDirWatch;

class Window;

class MenuProxy : public QObject
{
    Q_OBJECT

public:
    MenuProxy();
    ~MenuProxy() override;

private Q_SLOTS:
    void onWindowAdded(WId id);
    void onWindowRemoved(WId id);

private:
    bool init();
    void teardown();

    static QString gtkRc2Path();
    static QString gtk3SettingsIniPath();

    void enableGtkSettings(bool enabled);

    void writeGtk2Settings();
    void writeGtk3Settings();

    void addOrRemoveAppMenuGtkModule(QStringList &list);

    xcb_connection_t *m_xConnection;

    QByteArray getWindowPropertyString(WId id, const QByteArray &name);
    void writeWindowProperty(WId id, const QByteArray &name, const QByteArray &value);
    xcb_atom_t getAtom(const QByteArray &name);

    QHash<WId, Window *> m_windows;

    QDBusServiceWatcher *m_serviceWatcher;

    KDirWatch *m_gtk2RcWatch;
    QTimer *m_writeGtk2SettingsTimer;

    bool m_enabled = false;
};