diff --git a/composite.cpp b/composite.cpp index 683b5a5641..cdf5d65f7e 100644 --- a/composite.cpp +++ b/composite.cpp @@ -886,7 +886,6 @@ X11Compositor::X11Compositor(QObject *parent) , m_suspended(options->isUseCompositing() ? NoReasonSuspend : UserSuspend) , m_xrrRefreshRate(0) { - qRegisterMetaType("X11Compositor::SuspendReason"); } void X11Compositor::toggleCompositing() @@ -1015,25 +1014,27 @@ void X11Compositor::updateClientCompositeBlocking(X11Client *c) if (c->isBlockingCompositing()) { // Do NOT attempt to call suspend(true) from within the eventchain! if (!(m_suspended & BlockRuleSuspend)) - QMetaObject::invokeMethod(this, "suspend", Qt::QueuedConnection, - Q_ARG(SuspendReason, BlockRuleSuspend)); + QMetaObject::invokeMethod(this, [this]() { + suspend(BlockRuleSuspend); + }, Qt::QueuedConnection); } } else if (m_suspended & BlockRuleSuspend) { // If !c we just check if we can resume in case a blocking client was lost. - bool resume = true; + bool shouldResume = true; for (ClientList::ConstIterator it = Workspace::self()->clientList().constBegin(); it != Workspace::self()->clientList().constEnd(); ++it) { if ((*it)->isBlockingCompositing()) { - resume = false; + shouldResume = false; break; } } - if (resume) { + if (shouldResume) { // Do NOT attempt to call suspend(false) from within the eventchain! - QMetaObject::invokeMethod(this, "resume", Qt::QueuedConnection, - Q_ARG(SuspendReason, BlockRuleSuspend)); + QMetaObject::invokeMethod(this, [this]() { + resume(BlockRuleSuspend); + }, Qt::QueuedConnection); } } } diff --git a/composite.h b/composite.h index 62825ea19b..84783c8316 100644 --- a/composite.h +++ b/composite.h @@ -201,6 +201,8 @@ public: AllReasonSuspend = 0xff }; Q_DECLARE_FLAGS(SuspendReasons, SuspendReason) + Q_ENUM(SuspendReason) + Q_FLAG(SuspendReasons) static X11Compositor *create(QObject *parent = nullptr); @@ -214,7 +216,7 @@ public: * @see resume * @see isActive */ - Q_INVOKABLE void suspend(SuspendReason reason); + void suspend(SuspendReason reason); /** * @brief Resumes the Compositor if it is currently suspended. @@ -233,7 +235,7 @@ public: * @see isCompositingPossible * @see isOpenGLBroken */ - Q_INVOKABLE void resume(SuspendReason reason); + void resume(SuspendReason reason); void toggleCompositing() override; void reinitialize() override; diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index 325a590fe0..dfca31f3ad 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -830,8 +830,10 @@ bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const { GLint limit[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, limit); if (limit[0] < size.width() || limit[1] < size.height()) { - QMetaObject::invokeMethod(static_cast(Compositor::self()), "suspend", - Qt::QueuedConnection, Q_ARG(X11Compositor::SuspendReason, X11Compositor::AllReasonSuspend)); + auto compositor = static_cast(Compositor::self()); + QMetaObject::invokeMethod(compositor, [compositor]() { + compositor->suspend(X11Compositor::AllReasonSuspend); + }, Qt::QueuedConnection); return false; } return true;