Changeset View
Changeset View
Standalone View
Standalone View
deleted.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
52 | Deleted::~Deleted() | 52 | Deleted::~Deleted() | ||
53 | { | 53 | { | ||
54 | if (delete_refcount != 0) | 54 | if (delete_refcount != 0) | ||
55 | qCCritical(KWIN_CORE) << "Deleted client has non-zero reference count (" << delete_refcount << ")"; | 55 | qCCritical(KWIN_CORE) << "Deleted client has non-zero reference count (" << delete_refcount << ")"; | ||
56 | assert(delete_refcount == 0); | 56 | assert(delete_refcount == 0); | ||
57 | if (workspace()) { | 57 | if (workspace()) { | ||
58 | workspace()->removeDeleted(this); | 58 | workspace()->removeDeleted(this); | ||
59 | } | 59 | } | ||
60 | if (auto *transientFor = qobject_cast<Deleted *>(m_transientFor)) { | ||||
61 | transientFor->removeTransient(this); | ||||
62 | } | ||||
63 | for (Deleted *deleted : qAsConst(m_transients)) { | ||||
64 | deleted->setWasTransientFor(nullptr); | ||||
65 | } | ||||
60 | deleteEffectWindow(); | 66 | deleteEffectWindow(); | ||
61 | } | 67 | } | ||
62 | 68 | | |||
63 | Deleted* Deleted::create(Toplevel* c) | 69 | Deleted* Deleted::create(Toplevel* c) | ||
64 | { | 70 | { | ||
65 | Deleted* d = new Deleted(); | 71 | Deleted* d = new Deleted(); | ||
66 | d->copyToDeleted(c); | 72 | d->copyToDeleted(c); | ||
67 | workspace()->addDeleted(d, c); | 73 | workspace()->addDeleted(d, c); | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 100 | if (AbstractClient *client = dynamic_cast<AbstractClient*>(c)) { | |||
112 | foreach (AbstractClient *c, m_mainClients) { | 118 | foreach (AbstractClient *c, m_mainClients) { | ||
113 | connect(c, &AbstractClient::windowClosed, this, &Deleted::mainClientClosed); | 119 | connect(c, &AbstractClient::windowClosed, this, &Deleted::mainClientClosed); | ||
114 | } | 120 | } | ||
115 | m_fullscreen = client->isFullScreen(); | 121 | m_fullscreen = client->isFullScreen(); | ||
116 | m_wasCurrentTab = client->isCurrentTab(); | 122 | m_wasCurrentTab = client->isCurrentTab(); | ||
117 | m_keepAbove = client->keepAbove(); | 123 | m_keepAbove = client->keepAbove(); | ||
118 | m_keepBelow = client->keepBelow(); | 124 | m_keepBelow = client->keepBelow(); | ||
119 | m_caption = client->caption(); | 125 | m_caption = client->caption(); | ||
126 | | ||||
127 | m_transientFor = client->transientFor(); | ||||
128 | if (m_transientFor != nullptr) { | ||||
129 | connect(m_transientFor, &Toplevel::windowClosed, this, | ||||
130 | [this](Toplevel *toplevel, Deleted *deleted) { | ||||
131 | Q_UNUSED(toplevel) | ||||
132 | m_transientFor = deleted; | ||||
133 | if (deleted != nullptr) { | ||||
134 | deleted->addTransient(this); | ||||
135 | } | ||||
120 | } | 136 | } | ||
137 | ); | ||||
138 | } | ||||
139 | } | ||||
140 | } | ||||
141 | | ||||
davidedmundson: I'd expect to see that in Javascript, but it's weird in C++ | |||||
142 | void Deleted::addTransient(Deleted *transient) | ||||
143 | { | ||||
144 | m_transients.append(transient); | ||||
145 | } | ||||
146 | | ||||
147 | void Deleted::removeTransient(Deleted *transient) | ||||
148 | { | ||||
149 | m_transients.removeAll(transient); | ||||
150 | } | ||||
151 | | ||||
152 | void Deleted::setWasTransientFor(Deleted *transientFor) | ||||
153 | { | ||||
154 | m_transientFor = transientFor; | ||||
121 | } | 155 | } | ||
122 | 156 | | |||
123 | void Deleted::unrefWindow() | 157 | void Deleted::unrefWindow() | ||
124 | { | 158 | { | ||
125 | if (--delete_refcount > 0) | 159 | if (--delete_refcount > 0) | ||
126 | return; | 160 | return; | ||
127 | // needs to be delayed | 161 | // needs to be delayed | ||
128 | // a) when calling from effects, otherwise it'd be rather complicated to handle the case of the | 162 | // a) when calling from effects, otherwise it'd be rather complicated to handle the case of the | ||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |
I'd expect to see that in Javascript, but it's weird in C++