diff --git a/egl_wayland_backend.cpp b/egl_wayland_backend.cpp
index 05feda9dad..d4132b4fe5 100644
--- a/egl_wayland_backend.cpp
+++ b/egl_wayland_backend.cpp
@@ -1,3 +1,4 @@
+
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
@@ -23,17 +24,24 @@ along with this program. If not, see .
#include "composite.h"
#include "options.h"
#include "wayland_backend.h"
+#include "wayland_server.h"
#include
// kwin libs
#include
// KDE
#include
+#include
// Qt
#include
namespace KWin
{
+typedef GLboolean(*eglBindWaylandDisplayWL_func)(EGLDisplay dpy, wl_display *display);
+typedef GLboolean(*eglUnbindWaylandDisplayWL_func)(EGLDisplay dpy, wl_display *display);
+eglBindWaylandDisplayWL_func eglBindWaylandDisplayWL = nullptr;
+eglUnbindWaylandDisplayWL_func eglUnbindWaylandDisplayWL = nullptr;
+
EglWaylandBackend::EglWaylandBackend()
: QObject(NULL)
, OpenGLBackend()
@@ -64,6 +72,9 @@ EglWaylandBackend::EglWaylandBackend()
EglWaylandBackend::~EglWaylandBackend()
{
+ if (eglUnbindWaylandDisplayWL && m_display != EGL_NO_DISPLAY) {
+ eglUnbindWaylandDisplayWL(m_display, *(WaylandServer::self()->display()));
+ }
cleanupGL();
doneCurrent();
eglDestroyContext(m_display, m_context);
@@ -147,6 +158,14 @@ void EglWaylandBackend::init()
if (useBufferAge != "0")
setSupportsBufferAge(true);
}
+
+ if (hasGLExtension(QByteArrayLiteral("EGL_WL_bind_wayland_display"))) {
+ eglBindWaylandDisplayWL = (eglBindWaylandDisplayWL_func)eglGetProcAddress("eglBindWaylandDisplayWL");
+ eglUnbindWaylandDisplayWL = (eglUnbindWaylandDisplayWL_func)eglGetProcAddress("eglUnbindWaylandDisplayWL");
+ if (!eglBindWaylandDisplayWL(m_display, *(WaylandServer::self()->display()))) {
+ eglUnbindWaylandDisplayWL = nullptr;
+ }
+ }
}
bool EglWaylandBackend::initRenderingContext()