diff --git a/plugins/qpa/CMakeLists.txt b/plugins/qpa/CMakeLists.txt --- a/plugins/qpa/CMakeLists.txt +++ b/plugins/qpa/CMakeLists.txt @@ -7,7 +7,6 @@ integration.cpp main.cpp nativeinterface.cpp - platformcontextwayland.cpp platformcursor.cpp screen.cpp sharingplatformcontext.cpp @@ -34,10 +33,6 @@ ${FREETYPE_LIBRARIES} ) -if(HAVE_WAYLAND_EGL) - target_link_libraries(KWinQpaPlugin Wayland::Egl) -endif() - install( TARGETS KWinQpaPlugin diff --git a/plugins/qpa/integration.h b/plugins/qpa/integration.h --- a/plugins/qpa/integration.h +++ b/plugins/qpa/integration.h @@ -69,7 +69,6 @@ private: void initScreens(); - void initEgl(); KWayland::Client::Shell *shell() const; QPlatformFontDatabase *m_fontDb; diff --git a/plugins/qpa/integration.cpp b/plugins/qpa/integration.cpp --- a/plugins/qpa/integration.cpp +++ b/plugins/qpa/integration.cpp @@ -22,7 +22,6 @@ #include "platform.h" #include "backingstore.h" #include "nativeinterface.h" -#include "platformcontextwayland.h" #include "screen.h" #include "sharingplatformcontext.h" #include "window.h" @@ -192,13 +191,7 @@ return new SharingPlatformContext(context, s, kwinApp()->platform()->sceneEglConfig()); } } - if (m_eglDisplay == EGL_NO_DISPLAY) { - const_cast(this)->initEgl(); - } - if (m_eglDisplay == EGL_NO_DISPLAY) { - return nullptr; - } - return new PlatformContextWayland(context, const_cast(this)); + return nullptr; } void Integration::initScreens() @@ -252,38 +245,6 @@ return m_eglDisplay; } -void Integration::initEgl() -{ - Q_ASSERT(m_eglDisplay == EGL_NO_DISPLAY); - // This variant uses Wayland as the EGL platform - qputenv("EGL_PLATFORM", "wayland"); - m_eglDisplay = eglGetDisplay(waylandServer()->internalClientConection()->display()); - if (m_eglDisplay == EGL_NO_DISPLAY) { - return; - } - // call eglInitialize in a thread to not block - QFuture future = QtConcurrent::run([this] () -> bool { - EGLint major, minor; - if (eglInitialize(m_eglDisplay, &major, &minor) == EGL_FALSE) { - return false; - } - EGLint error = eglGetError(); - if (error != EGL_SUCCESS) { - return false; - } - return true; - }); - // TODO: make this better - while (!future.isFinished()) { - waylandServer()->internalClientConection()->flush(); - QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); - } - if (!future.result()) { - eglTerminate(m_eglDisplay); - m_eglDisplay = EGL_NO_DISPLAY; - } -} - QPlatformInputContext *Integration::inputContext() const { return m_inputContext.data(); diff --git a/plugins/qpa/platformcontextwayland.h b/plugins/qpa/platformcontextwayland.h deleted file mode 100644 --- a/plugins/qpa/platformcontextwayland.h +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2015 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#ifndef KWIN_QPA_PLATFORMCONTEXTWAYLAND_H -#define KWIN_QPA_PLATFORMCONTEXTWAYLAND_H - -#include "abstractplatformcontext.h" - -namespace KWin -{ -namespace QPA -{ -class Integration; - -class PlatformContextWayland : public AbstractPlatformContext -{ -public: - explicit PlatformContextWayland(QOpenGLContext *context, Integration *integration); - - void swapBuffers(QPlatformSurface *surface) override; - - bool makeCurrent(QPlatformSurface *surface) override; - - bool isSharing() const override; - -private: - void create(); -}; - -} -} - -#endif diff --git a/plugins/qpa/platformcontextwayland.cpp b/plugins/qpa/platformcontextwayland.cpp deleted file mode 100644 --- a/plugins/qpa/platformcontextwayland.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2015 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#include "platformcontextwayland.h" -#include "integration.h" -#include "window.h" - -namespace KWin -{ - -namespace QPA -{ - -PlatformContextWayland::PlatformContextWayland(QOpenGLContext *context, Integration *integration) - : AbstractPlatformContext(context, integration, integration->eglDisplay()) -{ - create(); -} - -bool PlatformContextWayland::makeCurrent(QPlatformSurface *surface) -{ - Window *window = static_cast(surface); - EGLSurface s = window->eglSurface(); - if (s == EGL_NO_SURFACE) { - window->createEglSurface(eglDisplay(), config()); - s = window->eglSurface(); - if (s == EGL_NO_SURFACE) { - return false; - } - } - return eglMakeCurrent(eglDisplay(), s, s, eglContext()); -} - -bool PlatformContextWayland::isSharing() const -{ - return false; -} - -void PlatformContextWayland::swapBuffers(QPlatformSurface *surface) -{ - Window *window = static_cast(surface); - EGLSurface s = window->eglSurface(); - if (s == EGL_NO_SURFACE) { - return; - } - eglSwapBuffers(eglDisplay(), s); -} - -void PlatformContextWayland::create() -{ - if (config() == 0) { - return; - } - if (!bindApi()) { - return; - } - createContext(); -} - -} -} diff --git a/plugins/qpa/window.h b/plugins/qpa/window.h --- a/plugins/qpa/window.h +++ b/plugins/qpa/window.h @@ -25,17 +25,9 @@ #include #include -// wayland -#include -#if HAVE_WAYLAND_EGL -#include -#endif class QOpenGLFramebufferObject; -#if HAVE_WAYLAND_EGL -struct wl_egl_window; -#endif namespace KWayland { @@ -69,10 +61,6 @@ KWayland::Client::Surface *surface() const { return m_surface; } - EGLSurface eglSurface() const { - return m_eglSurface; - } - void createEglSurface(EGLDisplay dpy, EGLConfig config); int scale() const; qreal devicePixelRatio() const override; @@ -90,13 +78,9 @@ KWayland::Client::Surface *m_surface; KWayland::Client::ShellSurface *m_shellSurface; - EGLSurface m_eglSurface = EGL_NO_SURFACE; QSharedPointer m_contentFBO; bool m_resized = false; ShellClient *m_shellClient = nullptr; -#if HAVE_WAYLAND_EGL - wl_egl_window *m_eglWaylandWindow = nullptr; -#endif quint32 m_windowId; const Integration *m_integration; int m_scale = 1; diff --git a/plugins/qpa/window.cpp b/plugins/qpa/window.cpp --- a/plugins/qpa/window.cpp +++ b/plugins/qpa/window.cpp @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -#define WL_EGL_PLATFORM 1 #include "integration.h" #include "window.h" #include "screens.h" @@ -57,14 +56,6 @@ Window::~Window() { unmap(); - if (m_eglSurface != EGL_NO_SURFACE) { - eglDestroySurface(m_integration->eglDisplay(), m_eglSurface); - } -#if HAVE_WAYLAND_EGL - if (m_eglWaylandWindow) { - wl_egl_window_destroy(m_eglWaylandWindow); - } -#endif delete m_shellSurface; delete m_surface; } @@ -106,11 +97,6 @@ m_resized = true; } } -#if HAVE_WAYLAND_EGL - if (m_eglWaylandWindow) { - wl_egl_window_resize(m_eglWaylandWindow, nativeSize.width(), nativeSize.height(), 0, 0); - } -#endif QWindowSystemInterface::handleGeometryChange(window(), geometry()); } @@ -128,21 +114,6 @@ } } -void Window::createEglSurface(EGLDisplay dpy, EGLConfig config) -{ -#if HAVE_WAYLAND_EGL - const QSize size = window()->size() * m_scale; - m_eglWaylandWindow = wl_egl_window_create(*m_surface, size.width(), size.height()); - if (!m_eglWaylandWindow) { - return; - } - m_eglSurface = eglCreateWindowSurface(dpy, config, m_eglWaylandWindow, nullptr); -#else - Q_UNUSED(dpy) - Q_UNUSED(config) -#endif -} - void Window::bindContentFBO() { if (m_resized || !m_contentFBO) {