Changeset View
Changeset View
Standalone View
Standalone View
src/server/global.cpp
Show All 20 Lines | |||||
21 | { | 21 | { | ||
22 | } | 22 | } | ||
23 | 23 | | |||
24 | Global::Private::~Private() = default; | 24 | Global::Private::~Private() = default; | ||
25 | 25 | | |||
26 | void Global::Private::bind(wl_client *client, void *data, uint32_t version, uint32_t id) | 26 | void Global::Private::bind(wl_client *client, void *data, uint32_t version, uint32_t id) | ||
27 | { | 27 | { | ||
28 | auto d = reinterpret_cast<Private*>(data); | 28 | auto d = reinterpret_cast<Private*>(data); | ||
29 | if (!d) { | ||||
30 | return; | ||||
31 | } | ||||
29 | d->bind(client, version, id); | 32 | d->bind(client, version, id); | ||
30 | } | 33 | } | ||
31 | 34 | | |||
32 | void Global::Private::create() | 35 | void Global::Private::create() | ||
33 | { | 36 | { | ||
34 | Q_ASSERT(!global); | | |||
35 | global = wl_global_create(*display, m_interface, m_version, this, bind); | 37 | global = wl_global_create(*display, m_interface, m_version, this, bind); | ||
36 | } | 38 | } | ||
37 | 39 | | |||
38 | Global::Global(Global::Private *d, QObject *parent) | 40 | Global::Global(Global::Private *d, QObject *parent) | ||
39 | : QObject(parent) | 41 | : QObject(parent) | ||
40 | , d(d) | 42 | , d(d) | ||
41 | { | 43 | { | ||
42 | } | 44 | } | ||
43 | 45 | | |||
44 | Global::~Global() | 46 | Global::~Global() | ||
45 | { | 47 | { | ||
46 | destroy(); | 48 | destroy(); | ||
47 | } | 49 | } | ||
48 | 50 | | |||
49 | void Global::create() | 51 | void Global::create() | ||
50 | { | 52 | { | ||
51 | d->create(); | 53 | d->create(); | ||
52 | } | 54 | } | ||
53 | 55 | | |||
56 | void Global::remove() | ||||
57 | { | ||||
58 | if (!d->global) { | ||||
59 | return; | ||||
60 | } | ||||
61 | wl_global_remove(d->global); | ||||
62 | } | ||||
63 | | ||||
54 | void Global::destroy() | 64 | void Global::destroy() | ||
55 | { | 65 | { | ||
56 | if (!d->global) { | 66 | if (!d->global) { | ||
57 | return; | 67 | return; | ||
58 | } | 68 | } | ||
59 | emit aboutToDestroyGlobal(); | 69 | emit aboutToDestroyGlobal(); | ||
60 | wl_global_destroy(d->global); | 70 | wl_global_destroy(d->global); | ||
61 | d->global = nullptr; | 71 | d->global = nullptr; | ||
Show All 24 Lines |