Changeset View
Changeset View
Standalone View
Standalone View
effects.cpp
Show All 24 Lines | |||||
25 | #include "effectloader.h" | 25 | #include "effectloader.h" | ||
26 | #ifdef KWIN_BUILD_ACTIVITIES | 26 | #ifdef KWIN_BUILD_ACTIVITIES | ||
27 | #include "activities.h" | 27 | #include "activities.h" | ||
28 | #endif | 28 | #endif | ||
29 | #include "deleted.h" | 29 | #include "deleted.h" | ||
30 | #include "client.h" | 30 | #include "client.h" | ||
31 | #include "cursor.h" | 31 | #include "cursor.h" | ||
32 | #include "group.h" | 32 | #include "group.h" | ||
33 | #include "internal_client.h" | ||||
33 | #include "osd.h" | 34 | #include "osd.h" | ||
34 | #include "pointer_input.h" | 35 | #include "pointer_input.h" | ||
35 | #include "unmanaged.h" | 36 | #include "unmanaged.h" | ||
36 | #ifdef KWIN_BUILD_TABBOX | 37 | #ifdef KWIN_BUILD_TABBOX | ||
37 | #include "tabbox.h" | 38 | #include "tabbox.h" | ||
38 | #endif | 39 | #endif | ||
39 | #include "screenedge.h" | 40 | #include "screenedge.h" | ||
40 | #include "scripting/scriptedeffect.h" | 41 | #include "scripting/scriptedeffect.h" | ||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 170 | connect(ws, &Workspace::clientAdded, this, | |||
175 | } | 176 | } | ||
176 | ); | 177 | ); | ||
177 | connect(ws, &Workspace::unmanagedAdded, this, | 178 | connect(ws, &Workspace::unmanagedAdded, this, | ||
178 | [this](Unmanaged *u) { | 179 | [this](Unmanaged *u) { | ||
179 | // it's never initially ready but has synthetic 50ms delay | 180 | // it's never initially ready but has synthetic 50ms delay | ||
180 | connect(u, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotUnmanagedShown); | 181 | connect(u, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotUnmanagedShown); | ||
181 | } | 182 | } | ||
182 | ); | 183 | ); | ||
184 | connect(ws, &Workspace::internalClientAdded, this, | ||||
185 | [this](InternalClient *client) { | ||||
186 | setupAbstractClientConnections(client); | ||||
187 | emit windowAdded(client->effectWindow()); | ||||
188 | } | ||||
189 | ); | ||||
183 | connect(ws, &Workspace::clientActivated, this, | 190 | connect(ws, &Workspace::clientActivated, this, | ||
184 | [this](KWin::AbstractClient *c) { | 191 | [this](KWin::AbstractClient *c) { | ||
185 | emit windowActivated(c ? c->effectWindow() : nullptr); | 192 | emit windowActivated(c ? c->effectWindow() : nullptr); | ||
186 | } | 193 | } | ||
187 | ); | 194 | ); | ||
188 | connect(ws, &Workspace::deletedRemoved, this, | 195 | connect(ws, &Workspace::deletedRemoved, this, | ||
189 | [this](KWin::Deleted *d) { | 196 | [this](KWin::Deleted *d) { | ||
190 | emit windowDeleted(d->effectWindow()); | 197 | emit windowDeleted(d->effectWindow()); | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 220 | #endif | |||
242 | 249 | | |||
243 | // connect all clients | 250 | // connect all clients | ||
244 | for (Client *c : ws->clientList()) { | 251 | for (Client *c : ws->clientList()) { | ||
245 | setupClientConnections(c); | 252 | setupClientConnections(c); | ||
246 | } | 253 | } | ||
247 | for (Unmanaged *u : ws->unmanagedList()) { | 254 | for (Unmanaged *u : ws->unmanagedList()) { | ||
248 | setupUnmanagedConnections(u); | 255 | setupUnmanagedConnections(u); | ||
249 | } | 256 | } | ||
257 | for (InternalClient *client : ws->internalClients()) { | ||||
258 | setupAbstractClientConnections(client); | ||||
259 | } | ||||
250 | if (auto w = waylandServer()) { | 260 | if (auto w = waylandServer()) { | ||
251 | connect(w, &WaylandServer::shellClientAdded, this, | 261 | connect(w, &WaylandServer::shellClientAdded, this, | ||
252 | [this](ShellClient *c) { | 262 | [this](ShellClient *c) { | ||
253 | if (c->readyForPainting()) | 263 | if (c->readyForPainting()) | ||
254 | slotShellClientShown(c); | 264 | slotShellClientShown(c); | ||
255 | else | 265 | else | ||
256 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotShellClientShown); | 266 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotShellClientShown); | ||
257 | } | 267 | } | ||
▲ Show 20 Lines • Show All 827 Lines • ▼ Show 20 Line(s) | 1094 | if (ShellClient *w = waylandServer()->findClient(surf)) { | |||
1085 | return w->effectWindow(); | 1095 | return w->effectWindow(); | ||
1086 | } | 1096 | } | ||
1087 | } | 1097 | } | ||
1088 | return nullptr; | 1098 | return nullptr; | ||
1089 | } | 1099 | } | ||
1090 | 1100 | | |||
1091 | EffectWindow *EffectsHandlerImpl::findWindow(QWindow *w) const | 1101 | EffectWindow *EffectsHandlerImpl::findWindow(QWindow *w) const | ||
1092 | { | 1102 | { | ||
1093 | if (waylandServer()) { | 1103 | if (Toplevel *toplevel = workspace()->findInternal(w)) { | ||
1094 | if (auto c = waylandServer()->findClient(w)) { | 1104 | return toplevel->effectWindow(); | ||
1095 | return c->effectWindow(); | | |||
1096 | } | | |||
1097 | } | | |||
1098 | if (auto u = Workspace::self()->findUnmanaged(w->winId())) { | | |||
1099 | return u->effectWindow(); | | |||
romangg: On X is this not needed anymore? I.e. on X all internal clients now also are of type… | |||||
We don't need to call findUnmanaged as findInternal covers internal clients in X11 operation mode. zzag: We don't need to call findUnmanaged as findInternal covers internal clients in X11 operation… | |||||
But it didn't before that, right? Before that internal clients in X mode were categorized as Unmanaged clients. romangg: But it didn't before that, right? Before that internal clients in X mode were categorized as… | |||||
That's right, each internal client was/is represented by an instance of InternalClient in Xwayland/Wayland mode,.
They are still Unmanaged in X11 mode. zzag: > But it didn't before that, right?
That's right, each internal client was/is represented by… | |||||
1100 | } | 1105 | } | ||
1101 | return nullptr; | 1106 | return nullptr; | ||
1102 | } | 1107 | } | ||
1103 | 1108 | | |||
1104 | EffectWindow *EffectsHandlerImpl::findWindow(const QUuid &id) const | 1109 | EffectWindow *EffectsHandlerImpl::findWindow(const QUuid &id) const | ||
1105 | { | 1110 | { | ||
1106 | if (const auto client = workspace()->findAbstractClient([&id] (const AbstractClient *c) { return c->internalId() == id; })) { | 1111 | if (const auto client = workspace()->findAbstractClient([&id] (const AbstractClient *c) { return c->internalId() == id; })) { | ||
1107 | return client->effectWindow(); | 1112 | return client->effectWindow(); | ||
▲ Show 20 Lines • Show All 606 Lines • ▼ Show 20 Line(s) | 1716 | { | |||
1714 | // windows(e.g. combo box popups, popup menus, etc). Save value of the | 1719 | // windows(e.g. combo box popups, popup menus, etc). Save value of the | ||
1715 | // managed property during construction of EffectWindow. At that time, | 1720 | // managed property during construction of EffectWindow. At that time, | ||
1716 | // parent can be Client, ShellClient, or Unmanaged. So, later on, when | 1721 | // parent can be Client, ShellClient, or Unmanaged. So, later on, when | ||
1717 | // an instance of Deleted becomes parent of the EffectWindow, effects | 1722 | // an instance of Deleted becomes parent of the EffectWindow, effects | ||
1718 | // can still figure out whether it is/was a managed window. | 1723 | // can still figure out whether it is/was a managed window. | ||
1719 | managed = toplevel->isClient(); | 1724 | managed = toplevel->isClient(); | ||
1720 | 1725 | | |||
1721 | waylandClient = qobject_cast<KWin::ShellClient *>(toplevel) != nullptr; | 1726 | waylandClient = qobject_cast<KWin::ShellClient *>(toplevel) != nullptr; | ||
1722 | x11Client = !waylandClient; | 1727 | x11Client = qobject_cast<KWin::Client *>(toplevel) != nullptr; | ||
1723 | } | 1728 | } | ||
1724 | 1729 | | |||
1725 | EffectWindowImpl::~EffectWindowImpl() | 1730 | EffectWindowImpl::~EffectWindowImpl() | ||
1726 | { | 1731 | { | ||
1727 | QVariant cachedTextureVariant = data(LanczosCacheRole); | 1732 | QVariant cachedTextureVariant = data(LanczosCacheRole); | ||
1728 | if (cachedTextureVariant.isValid()) { | 1733 | if (cachedTextureVariant.isValid()) { | ||
1729 | GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); | 1734 | GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); | ||
1730 | delete cachedTexture; | 1735 | delete cachedTexture; | ||
▲ Show 20 Lines • Show All 231 Lines • ▼ Show 20 Line(s) | 1966 | if (modal) { | |||
1962 | return modal->effectWindow(); | 1967 | return modal->effectWindow(); | ||
1963 | } | 1968 | } | ||
1964 | 1969 | | |||
1965 | return nullptr; | 1970 | return nullptr; | ||
1966 | } | 1971 | } | ||
1967 | 1972 | | |||
1968 | QWindow *EffectWindowImpl::internalWindow() const | 1973 | QWindow *EffectWindowImpl::internalWindow() const | ||
1969 | { | 1974 | { | ||
1970 | auto client = qobject_cast<ShellClient*>(toplevel); | 1975 | auto client = qobject_cast<InternalClient *>(toplevel); | ||
1971 | if (!client) { | 1976 | if (!client) { | ||
1972 | return nullptr; | 1977 | return nullptr; | ||
1973 | } | 1978 | } | ||
1974 | return client->internalWindow(); | 1979 | return client->internalWindow(); | ||
1975 | } | 1980 | } | ||
1976 | 1981 | | |||
1977 | template <typename T> | 1982 | template <typename T> | ||
1978 | EffectWindowList getMainWindows(T *c) | 1983 | EffectWindowList getMainWindows(T *c) | ||
▲ Show 20 Lines • Show All 406 Lines • Show Last 20 Lines |
On X is this not needed anymore? I.e. on X all internal clients now also are of type InternalClient and not anymore Unmanaged? If so, this needs to be mentioned in the commit message.