| 111 | //**************************************** |
| 112 | |
| 113 | EffectsHandler::EffectsHandler(Compositor *compositor, WorkspaceScene *scene) |
| 114 | : keyboard_grab_effect(nullptr) |
| 115 | , fullscreen_effect(nullptr) |
| 116 | , compositing_type(compositor->backend()->compositingType()) |
| 117 | , m_compositor(compositor) |
| 118 | , m_scene(scene) |
| 119 | , m_effectLoader(new EffectLoader(this)) |
| 120 | { |
| 121 | if (compositing_type == NoCompositing) { |
| 122 | return; |
| 123 | } |
| 124 | KWin::effects = this; |
| 125 | |
| 126 | qRegisterMetaType<QList<KWin::EffectWindow *>>(); |
| 127 | qRegisterMetaType<KWin::SessionState>(); |
| 128 | connect(m_effectLoader, &AbstractEffectLoader::effectLoaded, this, [this](Effect *effect, const QString &name) { |
| 129 | effect_order.insert(effect->requestedEffectChainPosition(), EffectPair(name, effect)); |
| 130 | loaded_effects << EffectPair(name, effect); |
| 131 | effectsChanged(); |
| 132 | }); |
| 133 | m_effectLoader->setConfig(kwinApp()->config()); |
| 134 | new EffectsAdaptor(this); |
| 135 | QDBusConnection dbus = QDBusConnection::sessionBus(); |
| 136 | dbus.registerObject(QStringLiteral("/Effects"), this); |
| 137 | |
| 138 | connect(options, &Options::animationSpeedChanged, this, &EffectsHandler::reconfigureEffects); |
| 139 | |
| 140 | Workspace *ws = Workspace::self(); |
| 141 | VirtualDesktopManager *vds = VirtualDesktopManager::self(); |
| 142 | connect(ws, &Workspace::showingDesktopChanged, this, [this](bool showing, bool animated) { |
| 143 | if (animated) { |
| 144 | Q_EMIT showingDesktopChanged(showing); |
| 145 | } |
| 146 | }); |
| 147 | connect(ws, &Workspace::currentDesktopChanged, this, [this](VirtualDesktop *old, Window *window) { |
| 148 | VirtualDesktop *newDesktop = VirtualDesktopManager::self()->currentDesktop(); |
| 149 | Q_EMIT desktopChanged(old, newDesktop, window ? window->effectWindow() : nullptr); |
| 150 | }); |
| 151 | connect(ws, &Workspace::currentDesktopChanging, this, [this](VirtualDesktop *currentDesktop, QPointF offset, KWin::Window *window) { |
| 152 | Q_EMIT desktopChanging(currentDesktop, offset, window ? window->effectWindow() : nullptr); |
| 153 | }); |
| 154 | connect(ws, &Workspace::currentDesktopChangingCancelled, this, [this]() { |
| 155 | Q_EMIT desktopChangingCancelled(); |
| 156 | }); |
| 157 | connect(ws, &Workspace::windowAdded, this, [this](Window *window) { |
| 158 | setupWindowConnections(window); |
| 159 | Q_EMIT windowAdded(window->effectWindow()); |
| 160 | }); |
| 161 | connect(ws, &Workspace::windowActivated, this, [this](Window *window) { |
| 162 | Q_EMIT windowActivated(window ? window->effectWindow() : nullptr); |
| 163 | }); |
| 164 | connect(ws, &Workspace::deletedRemoved, this, [this](KWin::Window *d) { |
| 165 | Q_EMIT windowDeleted(d->effectWindow()); |
| 166 | }); |
| 167 | connect(ws->sessionManager(), &SessionManager::stateChanged, this, &KWin::EffectsHandler::sessionStateChanged); |
| 168 | connect(vds, &VirtualDesktopManager::layoutChanged, this, [this](int width, int height) { |
| 169 | Q_EMIT desktopGridSizeChanged(QSize(width, height)); |
| 170 | Q_EMIT desktopGridWidthChanged(width); |
nothing calls this directly
no test coverage detected