diff --git a/abstract_backend.cpp b/abstract_backend.cpp index d30f6f6249..bdded1f75b 100644 --- a/abstract_backend.cpp +++ b/abstract_backend.cpp @@ -19,9 +19,11 @@ along with this program. If not, see . *********************************************************************/ #include "abstract_backend.h" #include +#include "abstract_egl_backend.h" #include "composite.h" #include "cursor.h" #include "input.h" +#include "scene_opengl.h" #include "wayland_server.h" #include "wayland_cursor_theme.h" // KWayland @@ -303,4 +305,24 @@ void AbstractBackend::warpPointer(const QPointF &globalPos) Q_UNUSED(globalPos) } +EGLDisplay AbstractBackend::sceneEglDisplay() const +{ + if (Compositor *c = Compositor::self()) { + if (SceneOpenGL *s = dynamic_cast(c->scene())) { + return static_cast(s->backend())->eglDisplay(); + } + } + return EGL_NO_DISPLAY; +} + +EGLContext AbstractBackend::sceneEglContext() const +{ + if (Compositor *c = Compositor::self()) { + if (SceneOpenGL *s = dynamic_cast(c->scene())) { + return static_cast(s->backend())->context(); + } + } + return EGL_NO_CONTEXT; +} + } diff --git a/abstract_backend.h b/abstract_backend.h index 4efbac5165..bb93f783d8 100644 --- a/abstract_backend.h +++ b/abstract_backend.h @@ -20,6 +20,8 @@ along with this program. If not, see . #ifndef KWIN_ABSTRACT_BACKEND_H #define KWIN_ABSTRACT_BACKEND_H #include +#include +#include #include #include @@ -44,6 +46,14 @@ public: virtual OpenGLBackend *createOpenGLBackend(); virtual QPainterBackend *createQPainterBackend(); virtual void warpPointer(const QPointF &globalPos); + /** + * The EGLDisplay used by the compositing scene. + **/ + virtual EGLDisplay sceneEglDisplay() const; + /** + * The EGLContext used by the compositing scene. + **/ + virtual EGLContext sceneEglContext() const; bool usesSoftwareCursor() const { return m_softWareCursor; diff --git a/abstract_egl_backend.h b/abstract_egl_backend.h index 858986971b..b2ae051905 100644 --- a/abstract_egl_backend.h +++ b/abstract_egl_backend.h @@ -34,12 +34,12 @@ public: EGLDisplay eglDisplay() const { return m_display; } - -protected: - AbstractEglBackend(); EGLContext context() const { return m_context; } + +protected: + AbstractEglBackend(); EGLSurface surface() const { return m_surface; }