kwin/plugins/qpa/window.h
Vlad Zahorodnii 9b89a3d967 qpa: Merge OpenGL platform context classes
This makes our QPlatformOpenGLContext private subclass simpler.

As a slightly unrelated change, this patch also fixes a bug where our
platform opengl context may return a wrong surface format if surfaceless
contexts are unsupported.
2020-10-13 05:32:48 +00:00

63 lines
1.3 KiB
C++

/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KWIN_QPA_WINDOW_H
#define KWIN_QPA_WINDOW_H
#include <epoxy/egl.h>
#include "fixqopengl.h"
#include <fixx11h.h>
#include <QPointer>
#include <qpa/qplatformwindow.h>
class QOpenGLFramebufferObject;
namespace KWin
{
class InternalClient;
namespace QPA
{
class Window : public QPlatformWindow
{
public:
explicit Window(QWindow *window);
~Window() override;
void setVisible(bool visible) override;
void setGeometry(const QRect &rect) override;
WId winId() const override;
qreal devicePixelRatio() const override;
void bindContentFBO();
const QSharedPointer<QOpenGLFramebufferObject> &contentFBO() const;
QSharedPointer<QOpenGLFramebufferObject> swapFBO();
InternalClient *client() const;
EGLSurface eglSurface() const;
private:
void createFBO();
void map();
void unmap();
QPointer<InternalClient> m_handle;
QSharedPointer<QOpenGLFramebufferObject> m_contentFBO;
quint32 m_windowId;
bool m_resized = false;
int m_scale = 1;
};
}
}
#endif