Changeset View
Changeset View
Standalone View
Standalone View
effects.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
50 | #include <QDebug> | 50 | #include <QDebug> | ||
51 | #include <QDesktopWidget> | 51 | #include <QDesktopWidget> | ||
52 | 52 | | |||
53 | #include <Plasma/Theme> | 53 | #include <Plasma/Theme> | ||
54 | 54 | | |||
55 | #include "composite.h" | 55 | #include "composite.h" | ||
56 | #include "xcbutils.h" | 56 | #include "xcbutils.h" | ||
57 | #include "platform.h" | 57 | #include "platform.h" | ||
58 | #include "shell_client.h" | 58 | #include "xdgshellclient.h" | ||
59 | #include "wayland_server.h" | 59 | #include "wayland_server.h" | ||
60 | 60 | | |||
61 | #include "decorations/decorationbridge.h" | 61 | #include "decorations/decorationbridge.h" | ||
62 | #include <KDecoration2/DecorationSettings> | 62 | #include <KDecoration2/DecorationSettings> | ||
63 | 63 | | |||
64 | namespace KWin | 64 | namespace KWin | ||
65 | { | 65 | { | ||
66 | //--------------------- | 66 | //--------------------- | ||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Line(s) | 218 | #endif | |||
252 | for (Unmanaged *u : ws->unmanagedList()) { | 252 | for (Unmanaged *u : ws->unmanagedList()) { | ||
253 | setupUnmanagedConnections(u); | 253 | setupUnmanagedConnections(u); | ||
254 | } | 254 | } | ||
255 | for (InternalClient *client : ws->internalClients()) { | 255 | for (InternalClient *client : ws->internalClients()) { | ||
256 | setupAbstractClientConnections(client); | 256 | setupAbstractClientConnections(client); | ||
257 | } | 257 | } | ||
258 | if (auto w = waylandServer()) { | 258 | if (auto w = waylandServer()) { | ||
259 | connect(w, &WaylandServer::shellClientAdded, this, | 259 | connect(w, &WaylandServer::shellClientAdded, this, | ||
260 | [this](ShellClient *c) { | 260 | [this](XdgShellClient *c) { | ||
261 | if (c->readyForPainting()) | 261 | if (c->readyForPainting()) | ||
262 | slotShellClientShown(c); | 262 | slotXdgShellClientShown(c); | ||
263 | else | 263 | else | ||
264 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotShellClientShown); | 264 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotXdgShellClientShown); | ||
265 | } | 265 | } | ||
266 | ); | 266 | ); | ||
267 | const auto clients = waylandServer()->clients(); | 267 | const auto clients = waylandServer()->clients(); | ||
268 | for (ShellClient *c : clients) { | 268 | for (XdgShellClient *c : clients) { | ||
269 | if (c->readyForPainting()) { | 269 | if (c->readyForPainting()) { | ||
270 | setupAbstractClientConnections(c); | 270 | setupAbstractClientConnections(c); | ||
271 | } else { | 271 | } else { | ||
272 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotShellClientShown); | 272 | connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotXdgShellClientShown); | ||
273 | } | 273 | } | ||
274 | } | 274 | } | ||
275 | } | 275 | } | ||
276 | reconfigure(); | 276 | reconfigure(); | ||
277 | } | 277 | } | ||
278 | 278 | | |||
279 | EffectsHandlerImpl::~EffectsHandlerImpl() | 279 | EffectsHandlerImpl::~EffectsHandlerImpl() | ||
280 | { | 280 | { | ||
▲ Show 20 Lines • Show All 288 Lines • ▼ Show 20 Line(s) | |||||
569 | { | 569 | { | ||
570 | Q_ASSERT(qobject_cast<Client *>(t)); | 570 | Q_ASSERT(qobject_cast<Client *>(t)); | ||
571 | Client *c = static_cast<Client*>(t); | 571 | Client *c = static_cast<Client*>(t); | ||
572 | disconnect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotClientShown); | 572 | disconnect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotClientShown); | ||
573 | setupClientConnections(c); | 573 | setupClientConnections(c); | ||
574 | emit windowAdded(c->effectWindow()); | 574 | emit windowAdded(c->effectWindow()); | ||
575 | } | 575 | } | ||
576 | 576 | | |||
577 | void EffectsHandlerImpl::slotShellClientShown(Toplevel *t) | 577 | void EffectsHandlerImpl::slotXdgShellClientShown(Toplevel *t) | ||
578 | { | 578 | { | ||
579 | ShellClient *c = static_cast<ShellClient*>(t); | 579 | XdgShellClient *c = static_cast<XdgShellClient *>(t); | ||
580 | setupAbstractClientConnections(c); | 580 | setupAbstractClientConnections(c); | ||
581 | emit windowAdded(t->effectWindow()); | 581 | emit windowAdded(t->effectWindow()); | ||
582 | } | 582 | } | ||
583 | 583 | | |||
584 | void EffectsHandlerImpl::slotUnmanagedShown(KWin::Toplevel *t) | 584 | void EffectsHandlerImpl::slotUnmanagedShown(KWin::Toplevel *t) | ||
585 | { // regardless, unmanaged windows are -yet?- not synced anyway | 585 | { // regardless, unmanaged windows are -yet?- not synced anyway | ||
586 | Q_ASSERT(qobject_cast<Unmanaged *>(t)); | 586 | Q_ASSERT(qobject_cast<Unmanaged *>(t)); | ||
587 | Unmanaged *u = static_cast<Unmanaged*>(t); | 587 | Unmanaged *u = static_cast<Unmanaged*>(t); | ||
▲ Show 20 Lines • Show All 485 Lines • ▼ Show 20 Line(s) | |||||
1073 | 1073 | | |||
1074 | EffectWindow* EffectsHandlerImpl::findWindow(WId id) const | 1074 | EffectWindow* EffectsHandlerImpl::findWindow(WId id) const | ||
1075 | { | 1075 | { | ||
1076 | if (Client* w = Workspace::self()->findClient(Predicate::WindowMatch, id)) | 1076 | if (Client* w = Workspace::self()->findClient(Predicate::WindowMatch, id)) | ||
1077 | return w->effectWindow(); | 1077 | return w->effectWindow(); | ||
1078 | if (Unmanaged* w = Workspace::self()->findUnmanaged(id)) | 1078 | if (Unmanaged* w = Workspace::self()->findUnmanaged(id)) | ||
1079 | return w->effectWindow(); | 1079 | return w->effectWindow(); | ||
1080 | if (waylandServer()) { | 1080 | if (waylandServer()) { | ||
1081 | if (ShellClient *w = waylandServer()->findClient(id)) { | 1081 | if (XdgShellClient *w = waylandServer()->findClient(id)) { | ||
1082 | return w->effectWindow(); | 1082 | return w->effectWindow(); | ||
1083 | } | 1083 | } | ||
1084 | } | 1084 | } | ||
1085 | return nullptr; | 1085 | return nullptr; | ||
1086 | } | 1086 | } | ||
1087 | 1087 | | |||
1088 | EffectWindow* EffectsHandlerImpl::findWindow(KWayland::Server::SurfaceInterface *surf) const | 1088 | EffectWindow* EffectsHandlerImpl::findWindow(KWayland::Server::SurfaceInterface *surf) const | ||
1089 | { | 1089 | { | ||
1090 | if (waylandServer()) { | 1090 | if (waylandServer()) { | ||
1091 | if (ShellClient *w = waylandServer()->findClient(surf)) { | 1091 | if (XdgShellClient *w = waylandServer()->findClient(surf)) { | ||
1092 | return w->effectWindow(); | 1092 | return w->effectWindow(); | ||
1093 | } | 1093 | } | ||
1094 | } | 1094 | } | ||
1095 | return nullptr; | 1095 | return nullptr; | ||
1096 | } | 1096 | } | ||
1097 | 1097 | | |||
1098 | EffectWindow *EffectsHandlerImpl::findWindow(QWindow *w) const | 1098 | EffectWindow *EffectsHandlerImpl::findWindow(QWindow *w) const | ||
1099 | { | 1099 | { | ||
▲ Show 20 Lines • Show All 610 Lines • ▼ Show 20 Line(s) | 1709 | EffectWindowImpl::EffectWindowImpl(Toplevel *toplevel) | |||
1710 | : EffectWindow(toplevel) | 1710 | : EffectWindow(toplevel) | ||
1711 | , toplevel(toplevel) | 1711 | , toplevel(toplevel) | ||
1712 | , sw(nullptr) | 1712 | , sw(nullptr) | ||
1713 | { | 1713 | { | ||
1714 | // Deleted windows are not managed. So, when windowClosed signal is | 1714 | // Deleted windows are not managed. So, when windowClosed signal is | ||
1715 | // emitted, effects can't distinguish managed windows from unmanaged | 1715 | // emitted, effects can't distinguish managed windows from unmanaged | ||
1716 | // 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 | ||
1717 | // managed property during construction of EffectWindow. At that time, | 1717 | // managed property during construction of EffectWindow. At that time, | ||
1718 | // parent can be Client, ShellClient, or Unmanaged. So, later on, when | 1718 | // parent can be Client, XdgShellClient, or Unmanaged. So, later on, when | ||
1719 | // an instance of Deleted becomes parent of the EffectWindow, effects | 1719 | // an instance of Deleted becomes parent of the EffectWindow, effects | ||
1720 | // can still figure out whether it is/was a managed window. | 1720 | // can still figure out whether it is/was a managed window. | ||
1721 | managed = toplevel->isClient(); | 1721 | managed = toplevel->isClient(); | ||
1722 | 1722 | | |||
1723 | waylandClient = qobject_cast<KWin::ShellClient *>(toplevel) != nullptr; | 1723 | waylandClient = qobject_cast<KWin::XdgShellClient *>(toplevel) != nullptr; | ||
1724 | x11Client = qobject_cast<KWin::Client *>(toplevel) != nullptr; | 1724 | x11Client = qobject_cast<KWin::Client *>(toplevel) != nullptr; | ||
1725 | } | 1725 | } | ||
1726 | 1726 | | |||
1727 | EffectWindowImpl::~EffectWindowImpl() | 1727 | EffectWindowImpl::~EffectWindowImpl() | ||
1728 | { | 1728 | { | ||
1729 | QVariant cachedTextureVariant = data(LanczosCacheRole); | 1729 | QVariant cachedTextureVariant = data(LanczosCacheRole); | ||
1730 | if (cachedTextureVariant.isValid()) { | 1730 | if (cachedTextureVariant.isValid()) { | ||
1731 | GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); | 1731 | GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>()); | ||
▲ Show 20 Lines • Show All 660 Lines • Show Last 20 Lines |