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 | for (Deleted *deleted : qAsConst(m_deletedTransients)) { | ||||
61 | deleted->setWasTransientFor(nullptr); | ||||
62 | } | ||||
60 | deleteEffectWindow(); | 63 | deleteEffectWindow(); | ||
61 | } | 64 | } | ||
62 | 65 | | |||
63 | Deleted* Deleted::create(Toplevel* c) | 66 | Deleted* Deleted::create(Toplevel* c) | ||
64 | { | 67 | { | ||
65 | Deleted* d = new Deleted(); | 68 | Deleted* d = new Deleted(); | ||
66 | d->copyToDeleted(c); | 69 | d->copyToDeleted(c); | ||
67 | workspace()->addDeleted(d, c); | 70 | workspace()->addDeleted(d, c); | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 97 | if (AbstractClient *client = dynamic_cast<AbstractClient*>(c)) { | |||
112 | foreach (AbstractClient *c, m_mainClients) { | 115 | foreach (AbstractClient *c, m_mainClients) { | ||
113 | connect(c, &AbstractClient::windowClosed, this, &Deleted::mainClientClosed); | 116 | connect(c, &AbstractClient::windowClosed, this, &Deleted::mainClientClosed); | ||
114 | } | 117 | } | ||
115 | m_fullscreen = client->isFullScreen(); | 118 | m_fullscreen = client->isFullScreen(); | ||
116 | m_wasCurrentTab = client->isCurrentTab(); | 119 | m_wasCurrentTab = client->isCurrentTab(); | ||
117 | m_keepAbove = client->keepAbove(); | 120 | m_keepAbove = client->keepAbove(); | ||
118 | m_keepBelow = client->keepBelow(); | 121 | m_keepBelow = client->keepBelow(); | ||
119 | m_caption = client->caption(); | 122 | m_caption = client->caption(); | ||
123 | | ||||
124 | m_transientFor = client->transientFor(); | ||||
125 | if (m_transientFor != nullptr) { | ||||
126 | connect(m_transientFor, &Toplevel::windowClosed, this, | ||||
127 | [this](Toplevel *toplevel, Deleted *deleted) { | ||||
128 | Q_UNUSED(toplevel) | ||||
129 | m_transientFor = deleted; | ||||
130 | if (deleted != nullptr) { | ||||
131 | deleted->addDeletedTransient(this); | ||||
132 | } | ||||
133 | } | ||||
134 | ); | ||||
135 | } | ||||
136 | } | ||||
120 | } | 137 | } | ||
138 | | ||||
davidedmundson: I'd expect to see that in Javascript, but it's weird in C++ | |||||
139 | void Deleted::addDeletedTransient(Deleted* d) | ||||
140 | { | ||||
141 | m_deletedTransients.append(d); | ||||
142 | } | ||||
143 | | ||||
144 | void Deleted::setWasTransientFor(Deleted* transientFor) | ||||
145 | { | ||||
146 | m_transientFor = transientFor; | ||||
121 | } | 147 | } | ||
122 | 148 | | |||
123 | void Deleted::unrefWindow() | 149 | void Deleted::unrefWindow() | ||
124 | { | 150 | { | ||
125 | if (--delete_refcount > 0) | 151 | if (--delete_refcount > 0) | ||
126 | return; | 152 | return; | ||
127 | // needs to be delayed | 153 | // needs to be delayed | ||
128 | // a) when calling from effects, otherwise it'd be rather complicated to handle the case of the | 154 | // 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++