kwin/plugins/qpa/offscreensurface.h
Vlad Zagorodniy f5b66a583d [plugins/qpa] Implement native offscreen surface
Summary:
Depending on whether the underlying platform supports offscreen surfaces,
QOffscreenSurface may create an invisible QWindow. In our case that's the
case, for each offscreen surface a native window is created. This may
lead to some funky results related to window decorations, see bug 407612.

There are several ways to implement offscreen surfaces - either use pbuffers
or utilize a surfaceless context extension. For the sake of simplicity
this change sticks with pbuffers, but it's a good idea to support both
methods.

CCBUG: 407612

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, alexeymin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22150
2019-07-01 22:04:40 +03:00

53 lines
1.5 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2019 Vlad Zagorodniy <vladzzag@gmail.com>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
#pragma once
#define MESA_EGL_NO_X11_HEADERS
#include <epoxy/egl.h>
#include "fixqopengl.h"
#include <qpa/qplatformoffscreensurface.h>
namespace KWin
{
namespace QPA
{
class OffscreenSurface : public QPlatformOffscreenSurface
{
public:
explicit OffscreenSurface(QOffscreenSurface *surface);
~OffscreenSurface() override;
QSurfaceFormat format() const override;
bool isValid() const override;
EGLSurface nativeHandle() const;
private:
QSurfaceFormat m_format;
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
EGLSurface m_surface = EGL_NO_SURFACE;
};
} // namespace QPA
} // namespace KWin