Merge branch 'Plasma/5.17'
This commit is contained in:
commit
11502b7928
3 changed files with 17 additions and 12 deletions
|
@ -886,7 +886,6 @@ X11Compositor::X11Compositor(QObject *parent)
|
||||||
, m_suspended(options->isUseCompositing() ? NoReasonSuspend : UserSuspend)
|
, m_suspended(options->isUseCompositing() ? NoReasonSuspend : UserSuspend)
|
||||||
, m_xrrRefreshRate(0)
|
, m_xrrRefreshRate(0)
|
||||||
{
|
{
|
||||||
qRegisterMetaType<X11Compositor::SuspendReason>("X11Compositor::SuspendReason");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11Compositor::toggleCompositing()
|
void X11Compositor::toggleCompositing()
|
||||||
|
@ -1015,25 +1014,27 @@ void X11Compositor::updateClientCompositeBlocking(X11Client *c)
|
||||||
if (c->isBlockingCompositing()) {
|
if (c->isBlockingCompositing()) {
|
||||||
// Do NOT attempt to call suspend(true) from within the eventchain!
|
// Do NOT attempt to call suspend(true) from within the eventchain!
|
||||||
if (!(m_suspended & BlockRuleSuspend))
|
if (!(m_suspended & BlockRuleSuspend))
|
||||||
QMetaObject::invokeMethod(this, "suspend", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(this, [this]() {
|
||||||
Q_ARG(SuspendReason, BlockRuleSuspend));
|
suspend(BlockRuleSuspend);
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_suspended & BlockRuleSuspend) {
|
else if (m_suspended & BlockRuleSuspend) {
|
||||||
// If !c we just check if we can resume in case a blocking client was lost.
|
// 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();
|
for (ClientList::ConstIterator it = Workspace::self()->clientList().constBegin();
|
||||||
it != Workspace::self()->clientList().constEnd(); ++it) {
|
it != Workspace::self()->clientList().constEnd(); ++it) {
|
||||||
if ((*it)->isBlockingCompositing()) {
|
if ((*it)->isBlockingCompositing()) {
|
||||||
resume = false;
|
shouldResume = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resume) {
|
if (shouldResume) {
|
||||||
// Do NOT attempt to call suspend(false) from within the eventchain!
|
// Do NOT attempt to call suspend(false) from within the eventchain!
|
||||||
QMetaObject::invokeMethod(this, "resume", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(this, [this]() {
|
||||||
Q_ARG(SuspendReason, BlockRuleSuspend));
|
resume(BlockRuleSuspend);
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,8 @@ public:
|
||||||
AllReasonSuspend = 0xff
|
AllReasonSuspend = 0xff
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(SuspendReasons, SuspendReason)
|
Q_DECLARE_FLAGS(SuspendReasons, SuspendReason)
|
||||||
|
Q_ENUM(SuspendReason)
|
||||||
|
Q_FLAG(SuspendReasons)
|
||||||
|
|
||||||
static X11Compositor *create(QObject *parent = nullptr);
|
static X11Compositor *create(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
@ -214,7 +216,7 @@ public:
|
||||||
* @see resume
|
* @see resume
|
||||||
* @see isActive
|
* @see isActive
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void suspend(SuspendReason reason);
|
void suspend(SuspendReason reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Resumes the Compositor if it is currently suspended.
|
* @brief Resumes the Compositor if it is currently suspended.
|
||||||
|
@ -233,7 +235,7 @@ public:
|
||||||
* @see isCompositingPossible
|
* @see isCompositingPossible
|
||||||
* @see isOpenGLBroken
|
* @see isOpenGLBroken
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void resume(SuspendReason reason);
|
void resume(SuspendReason reason);
|
||||||
|
|
||||||
void toggleCompositing() override;
|
void toggleCompositing() override;
|
||||||
void reinitialize() override;
|
void reinitialize() override;
|
||||||
|
|
|
@ -830,8 +830,10 @@ bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const {
|
||||||
GLint limit[2];
|
GLint limit[2];
|
||||||
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, limit);
|
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, limit);
|
||||||
if (limit[0] < size.width() || limit[1] < size.height()) {
|
if (limit[0] < size.width() || limit[1] < size.height()) {
|
||||||
QMetaObject::invokeMethod(static_cast<X11Compositor*>(Compositor::self()), "suspend",
|
auto compositor = static_cast<X11Compositor*>(Compositor::self());
|
||||||
Qt::QueuedConnection, Q_ARG(X11Compositor::SuspendReason, X11Compositor::AllReasonSuspend));
|
QMetaObject::invokeMethod(compositor, [compositor]() {
|
||||||
|
compositor->suspend(X11Compositor::AllReasonSuspend);
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue