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 132 Lines • ▼ Show 20 Line(s) | 168 | connect(ws, &Workspace::clientAdded, this, | |||
173 | } | 174 | } | ||
174 | ); | 175 | ); | ||
175 | connect(ws, &Workspace::unmanagedAdded, this, | 176 | connect(ws, &Workspace::unmanagedAdded, this, | ||
176 | [this](Unmanaged *u) { | 177 | [this](Unmanaged *u) { | ||
177 | // it's never initially ready but has synthetic 50ms delay | 178 | // it's never initially ready but has synthetic 50ms delay | ||
178 | connect(u, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotUnmanagedShown); | 179 | connect(u, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotUnmanagedShown); | ||
179 | } | 180 | } | ||
180 | ); | 181 | ); | ||
182 | connect(ws, &Workspace::internalClientAdded, this, | ||||
183 | [this](InternalClient *client) { | ||||
184 | setupAbstractClientConnections(client); | ||||
185 | emit windowAdded(client->effectWindow()); | ||||
186 | } | ||||
187 | ); | ||||
181 | connect(ws, &Workspace::clientActivated, this, | 188 | connect(ws, &Workspace::clientActivated, this, | ||
182 | [this](KWin::AbstractClient *c) { | 189 | [this](KWin::AbstractClient *c) { | ||
183 | emit windowActivated(c ? c->effectWindow() : nullptr); | 190 | emit windowActivated(c ? c->effectWindow() : nullptr); | ||
184 | } | 191 | } | ||
185 | ); | 192 | ); | ||
186 | connect(ws, &Workspace::deletedRemoved, this, | 193 | connect(ws, &Workspace::deletedRemoved, this, | ||
187 | [this](KWin::Deleted *d) { | 194 | [this](KWin::Deleted *d) { | ||
188 | emit windowDeleted(d->effectWindow()); | 195 | emit windowDeleted(d->effectWindow()); | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 218 | #endif | |||
240 | 247 | | |||
241 | // connect all clients | 248 | // connect all clients | ||
242 | for (Client *c : ws->clientList()) { | 249 | for (Client *c : ws->clientList()) { | ||
243 | setupClientConnections(c); | 250 | setupClientConnections(c); | ||
244 | } | 251 | } | ||
245 | for (Unmanaged *u : ws->unmanagedList()) { | 252 | for (Unmanaged *u : ws->unmanagedList()) { | ||
246 | setupUnmanagedConnections(u); | 253 | setupUnmanagedConnections(u); | ||
247 | } | 254 | } | ||
255 | for (InternalClient *client : ws->internalClients()) { | ||||
256 | setupAbstractClientConnections(client); | ||||
257 | } | ||||
248 | if (auto w = waylandServer()) { | 258 | if (auto w = waylandServer()) { | ||
249 | connect(w, &WaylandServer::shellClientAdded, this, | 259 | connect(w, &WaylandServer::shellClientAdded, this, | ||
250 | [this](ShellClient *c) { | 260 | [this](ShellClient *c) { | ||
251 | if (c->readyForPainting()) | 261 | if (c->readyForPainting()) | ||
252 | slotShellClientShown(c); | 262 | slotShellClientShown(c); | ||
253 | else | 263 | else | ||
254 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotShellClientShown); | 264 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotShellClientShown); | ||
255 | } | 265 | } | ||
▲ Show 20 Lines • Show All 826 Lines • ▼ Show 20 Line(s) | 1091 | if (ShellClient *w = waylandServer()->findClient(surf)) { | |||
1082 | return w->effectWindow(); | 1092 | return w->effectWindow(); | ||
1083 | } | 1093 | } | ||
1084 | } | 1094 | } | ||
1085 | return nullptr; | 1095 | return nullptr; | ||
1086 | } | 1096 | } | ||
1087 | 1097 | | |||
1088 | EffectWindow *EffectsHandlerImpl::findWindow(QWindow *w) const | 1098 | EffectWindow *EffectsHandlerImpl::findWindow(QWindow *w) const | ||
1089 | { | 1099 | { | ||
1090 | if (waylandServer()) { | 1100 | if (Toplevel *toplevel = workspace()->findInternal(w)) { | ||
1091 | if (auto c = waylandServer()->findClient(w)) { | 1101 | return toplevel->effectWindow(); | ||
1092 | return c->effectWindow(); | | |||
1093 | } | | |||
1094 | } | | |||
1095 | if (auto u = Workspace::self()->findUnmanaged(w->winId())) { | | |||
1096 | 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… | |||||
1097 | } | 1102 | } | ||
1098 | return nullptr; | 1103 | return nullptr; | ||
1099 | } | 1104 | } | ||
1100 | 1105 | | |||
1101 | EffectWindow *EffectsHandlerImpl::findWindow(const QUuid &id) const | 1106 | EffectWindow *EffectsHandlerImpl::findWindow(const QUuid &id) const | ||
1102 | { | 1107 | { | ||
1103 | if (const auto client = workspace()->findAbstractClient([&id] (const AbstractClient *c) { return c->internalId() == id; })) { | 1108 | if (const auto client = workspace()->findAbstractClient([&id] (const AbstractClient *c) { return c->internalId() == id; })) { | ||
1104 | return client->effectWindow(); | 1109 | return client->effectWindow(); | ||
▲ Show 20 Lines • Show All 606 Lines • ▼ Show 20 Line(s) | 1713 | { | |||
1711 | // windows(e.g. combo box popups, popup menus, etc). Save value of the | 1716 | // windows(e.g. combo box popups, popup menus, etc). Save value of the | ||
1712 | // managed property during construction of EffectWindow. At that time, | 1717 | // managed property during construction of EffectWindow. At that time, | ||
1713 | // parent can be Client, ShellClient, or Unmanaged. So, later on, when | 1718 | // parent can be Client, ShellClient, or Unmanaged. So, later on, when | ||
1714 | // an instance of Deleted becomes parent of the EffectWindow, effects | 1719 | // an instance of Deleted becomes parent of the EffectWindow, effects | ||
1715 | // can still figure out whether it is/was a managed window. | 1720 | // can still figure out whether it is/was a managed window. | ||
1716 | managed = toplevel->isClient(); | 1721 | managed = toplevel->isClient(); | ||
1717 | 1722 | | |||
1718 | waylandClient = qobject_cast<KWin::ShellClient *>(toplevel) != nullptr; | 1723 | waylandClient = qobject_cast<KWin::ShellClient *>(toplevel) != nullptr; | ||
1719 | x11Client = !waylandClient; | 1724 | x11Client = qobject_cast<KWin::Client *>(toplevel) != nullptr; | ||
1720 | } | 1725 | } | ||
1721 | 1726 | | |||
1722 | EffectWindowImpl::~EffectWindowImpl() | 1727 | EffectWindowImpl::~EffectWindowImpl() | ||
1723 | { | 1728 | { | ||
1724 | QVariant cachedTextureVariant = data(LanczosCacheRole); | 1729 | QVariant cachedTextureVariant = data(LanczosCacheRole); | ||
1725 | if (cachedTextureVariant.isValid()) { | 1730 | if (cachedTextureVariant.isValid()) { | ||
1726 | GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); | 1731 | GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); | ||
1727 | delete cachedTexture; | 1732 | delete cachedTexture; | ||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Line(s) | 1968 | if (modal) { | |||
1964 | return modal->effectWindow(); | 1969 | return modal->effectWindow(); | ||
1965 | } | 1970 | } | ||
1966 | 1971 | | |||
1967 | return nullptr; | 1972 | return nullptr; | ||
1968 | } | 1973 | } | ||
1969 | 1974 | | |||
1970 | QWindow *EffectWindowImpl::internalWindow() const | 1975 | QWindow *EffectWindowImpl::internalWindow() const | ||
1971 | { | 1976 | { | ||
1972 | auto client = qobject_cast<ShellClient*>(toplevel); | 1977 | auto client = qobject_cast<InternalClient *>(toplevel); | ||
1973 | if (!client) { | 1978 | if (!client) { | ||
1974 | return nullptr; | 1979 | return nullptr; | ||
1975 | } | 1980 | } | ||
1976 | return client->internalWindow(); | 1981 | return client->internalWindow(); | ||
1977 | } | 1982 | } | ||
1978 | 1983 | | |||
1979 | template <typename T> | 1984 | template <typename T> | ||
1980 | EffectWindowList getMainWindows(T *c) | 1985 | 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.