diff --git a/abstract_egl_backend.cpp b/abstract_egl_backend.cpp index 85b42b9496..209d372614 100644 --- a/abstract_egl_backend.cpp +++ b/abstract_egl_backend.cpp @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "abstract_egl_backend.h" +#include "composite.h" #include "egl_context_attribute_builder.h" #include "options.h" #include "platform.h" @@ -54,17 +55,18 @@ eglQueryWaylandBufferWL_func eglQueryWaylandBufferWL = nullptr; #endif AbstractEglBackend::AbstractEglBackend() - : OpenGLBackend() + : QObject(nullptr) + , OpenGLBackend() { + connect(Compositor::self(), &Compositor::aboutToDestroy, this, &AbstractEglBackend::unbindWaylandDisplay); } AbstractEglBackend::~AbstractEglBackend() = default; void AbstractEglBackend::unbindWaylandDisplay() { - auto display = kwinApp()->platform()->sceneEglDisplay(); - if (eglUnbindWaylandDisplayWL && display != EGL_NO_DISPLAY) { - eglUnbindWaylandDisplayWL(display, *(WaylandServer::self()->display())); + if (eglUnbindWaylandDisplayWL && m_display != EGL_NO_DISPLAY) { + eglUnbindWaylandDisplayWL(m_display, *(WaylandServer::self()->display())); } } diff --git a/abstract_egl_backend.h b/abstract_egl_backend.h index 6d11f36841..35b4f3bb90 100644 --- a/abstract_egl_backend.h +++ b/abstract_egl_backend.h @@ -29,8 +29,9 @@ class QOpenGLFramebufferObject; namespace KWin { -class KWIN_EXPORT AbstractEglBackend : public OpenGLBackend +class KWIN_EXPORT AbstractEglBackend : public QObject, public OpenGLBackend { + Q_OBJECT public: virtual ~AbstractEglBackend(); bool makeCurrent() override; @@ -49,8 +50,6 @@ public: return m_config; } - static void unbindWaylandDisplay(); - protected: AbstractEglBackend(); void setEglDisplay(const EGLDisplay &display); @@ -69,6 +68,8 @@ protected: bool createContext(); private: + void unbindWaylandDisplay(); + EGLDisplay m_display = EGL_NO_DISPLAY; EGLSurface m_surface = EGL_NO_SURFACE; EGLContext m_context = EGL_NO_CONTEXT; diff --git a/composite.cpp b/composite.cpp index 9c5d9e4412..767f0850db 100644 --- a/composite.cpp +++ b/composite.cpp @@ -19,7 +19,6 @@ along with this program. If not, see . *********************************************************************/ #include "composite.h" -#include "abstract_egl_backend.h" #include "dbusinterface.h" #include "utils.h" #include @@ -146,7 +145,6 @@ Compositor::Compositor(QObject* workspace) Compositor::~Compositor() { emit aboutToDestroy(); - AbstractEglBackend::unbindWaylandDisplay(); finish(); deleteUnusedSupportProperties(); delete cm_selection; diff --git a/plugins/platforms/drm/egl_gbm_backend.cpp b/plugins/platforms/drm/egl_gbm_backend.cpp index a1d722857d..646e775666 100644 --- a/plugins/platforms/drm/egl_gbm_backend.cpp +++ b/plugins/platforms/drm/egl_gbm_backend.cpp @@ -36,8 +36,7 @@ namespace KWin { EglGbmBackend::EglGbmBackend(DrmBackend *b) - : QObject(NULL) - , AbstractEglBackend() + : AbstractEglBackend() , m_backend(b) { // Egl is always direct rendering diff --git a/plugins/platforms/drm/egl_gbm_backend.h b/plugins/platforms/drm/egl_gbm_backend.h index f43a75c0d8..30e17e6824 100644 --- a/plugins/platforms/drm/egl_gbm_backend.h +++ b/plugins/platforms/drm/egl_gbm_backend.h @@ -33,7 +33,7 @@ class DrmOutput; /** * @brief OpenGL Backend using Egl on a GBM surface. **/ -class EglGbmBackend : public QObject, public AbstractEglBackend +class EglGbmBackend : public AbstractEglBackend { Q_OBJECT public: diff --git a/plugins/platforms/virtual/egl_gbm_backend.cpp b/plugins/platforms/virtual/egl_gbm_backend.cpp index 6e676f3fcb..f009003ced 100644 --- a/plugins/platforms/virtual/egl_gbm_backend.cpp +++ b/plugins/platforms/virtual/egl_gbm_backend.cpp @@ -42,8 +42,7 @@ namespace KWin { EglGbmBackend::EglGbmBackend(VirtualBackend *b) - : QObject(nullptr) - , AbstractEglBackend() + : AbstractEglBackend() , m_backend(b) { // Egl is always direct rendering diff --git a/plugins/platforms/virtual/egl_gbm_backend.h b/plugins/platforms/virtual/egl_gbm_backend.h index 409fafbc40..b4560ed259 100644 --- a/plugins/platforms/virtual/egl_gbm_backend.h +++ b/plugins/platforms/virtual/egl_gbm_backend.h @@ -31,9 +31,8 @@ class GLRenderTarget; /** * @brief OpenGL Backend using Egl on a GBM surface. **/ -class EglGbmBackend : public QObject, public AbstractEglBackend +class EglGbmBackend : public AbstractEglBackend { - Q_OBJECT public: EglGbmBackend(VirtualBackend *b); virtual ~EglGbmBackend(); diff --git a/plugins/platforms/wayland/egl_wayland_backend.cpp b/plugins/platforms/wayland/egl_wayland_backend.cpp index 1c3910ff8a..3107780f3e 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.cpp +++ b/plugins/platforms/wayland/egl_wayland_backend.cpp @@ -39,8 +39,7 @@ namespace KWin { EglWaylandBackend::EglWaylandBackend(Wayland::WaylandBackend *b) - : QObject(NULL) - , AbstractEglBackend() + : AbstractEglBackend() , m_bufferAge(0) , m_wayland(b) , m_overlay(NULL) diff --git a/plugins/platforms/wayland/egl_wayland_backend.h b/plugins/platforms/wayland/egl_wayland_backend.h index 3057c2c384..0b2893d86f 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.h +++ b/plugins/platforms/wayland/egl_wayland_backend.h @@ -47,7 +47,7 @@ namespace Wayland { * repaints, which is obviously not optimal. Best solution is probably to go for buffer_age extension * and make it the only available solution next to fullscreen repaints. **/ -class EglWaylandBackend : public QObject, public AbstractEglBackend +class EglWaylandBackend : public AbstractEglBackend { Q_OBJECT public: