diff --git a/composite.cpp b/composite.cpp index 754e06b119..ecb61bb4c8 100644 --- a/composite.cpp +++ b/composite.cpp @@ -221,6 +221,11 @@ void Compositor::slotCompositingOptionsInitialized() m_starting = false; cm_selection->owning = false; cm_selection->release(); + if (kwinApp()->requiresCompositing()) { + qCritical() << "The used windowing system requires compositing"; + qCritical() << "We are going to quit KWin now as it is broken"; + qApp->quit(); + } return; } if (m_scene == NULL || m_scene->initFailed()) { @@ -231,6 +236,11 @@ void Compositor::slotCompositingOptionsInitialized() m_starting = false; cm_selection->owning = false; cm_selection->release(); + if (kwinApp()->requiresCompositing()) { + qCritical() << "The used windowing system requires compositing"; + qCritical() << "We are going to quit KWin now as it is broken"; + qApp->quit(); + } return; } m_xrrRefreshRate = KWin::currentRefreshRate(); @@ -412,6 +422,10 @@ void Compositor::slotReinitialize() // for the shortcut void Compositor::slotToggleCompositing() { + if (kwinApp()->requiresCompositing()) { + // we are not allowed to turn on/off compositing + return; + } if (m_suspended) { // direct user call; clear all bits resume(AllReasonSuspend); } else { // but only set the user one (sufficient to suspend) @@ -442,6 +456,9 @@ void Compositor::updateCompositeBlocking() void Compositor::updateCompositeBlocking(Client *c) { + if (kwinApp()->requiresCompositing()) { + return; + } if (c) { // if c == 0 we just check if we can resume if (c->isBlockingCompositing()) { if (!(m_suspended & BlockRuleSuspend)) // do NOT attempt to call suspend(true); from within the eventchain! @@ -464,6 +481,9 @@ void Compositor::updateCompositeBlocking(Client *c) void Compositor::suspend(Compositor::SuspendReason reason) { + if (kwinApp()->requiresCompositing()) { + return; + } Q_ASSERT(reason != NoReasonSuspend); m_suspended |= reason; finish(); @@ -478,6 +498,9 @@ void Compositor::resume(Compositor::SuspendReason reason) void Compositor::setCompositing(bool active) { + if (kwinApp()->requiresCompositing()) { + return; + } if (active) { resume(ScriptSuspend); } else { diff --git a/main.cpp b/main.cpp index cc36c13085..c3fc859681 100644 --- a/main.cpp +++ b/main.cpp @@ -218,6 +218,11 @@ bool Application::shouldUseWaylandForCompositing() const return m_operationMode == OperationModeWaylandAndX11; } +bool Application::requiresCompositing() const +{ + return shouldUseWaylandForCompositing(); +} + void Application::start() { setQuitOnLastWindowClosed(false); diff --git a/main.h b/main.h index 4911c18bad..7c32f65ed0 100644 --- a/main.h +++ b/main.h @@ -87,6 +87,7 @@ public: OperationMode operationMode() const; void setOperationMode(OperationMode mode); bool shouldUseWaylandForCompositing() const; + bool requiresCompositing() const; static void setCrashCount(int count); static bool wasCrash(); diff --git a/options.h b/options.h index d0f0fefb46..48ce693681 100644 --- a/options.h +++ b/options.h @@ -25,6 +25,7 @@ along with this program. If not, see . #include +#include "main.h" #include "placement.h" namespace KWin @@ -496,7 +497,7 @@ public: } // Separate to mode so the user can toggle bool isUseCompositing() const { - return m_useCompositing; + return m_useCompositing || kwinApp()->requiresCompositing(); } bool isCompositingInitialized() const { return m_compositingInitialized; @@ -507,7 +508,7 @@ public: return m_hiddenPreviews; } bool isUnredirectFullscreen() const { - return m_unredirectFullscreen; + return m_unredirectFullscreen && !kwinApp()->requiresCompositing(); } // OpenGL // 0 = no, 1 = yes when transformed,