4#include <QtCore/qtextstream.h>
5#include <qpa/qwindowsysteminterface.h>
6#include <qpa/qplatformintegration.h>
7#include <private/qguiapplication_p.h>
8#include <private/qwindow_p.h>
10# include <QtGui/private/qopenglcontext_p.h>
11# include <QtGui/QOpenGLContext>
12# include <QtOpenGL/private/qopenglcompositorbackingstore_p.h>
14#include <QtGui/private/qeglconvenience_p.h>
30 m_backingStore(
nullptr),
31 m_rasterCompositingContext(
nullptr),
34 m_surface(EGL_NO_SURFACE),
48 if (
id == std::numeric_limits<WId>::max())
49 qWarning(
"QEGLPlatformWindow: Out of window IDs");
83 qFatal(
"EGLFS: OpenGL windows cannot be mixed with others.");
98 EGLint
error = eglGetError();
100 qFatal(
"EGL Error : Could not create the egl surface: error = 0x%x\n",
error);
120 qFatal(
"EGLFS: Failed to create compositing context");
149 screen->setPrimarySurface(EGL_NO_SURFACE);
172 qCWarning(qLcEglDevDebug,
"QEglFSWindow::invalidateSurface() eglDestroySurface failed!"
173 " Follow-up errors or memory leaks are possible."
174 " eglGetError(): %x", eglGetError());
177 if (eglGetCurrentSurface(EGL_READ) ==
m_surface ||
178 eglGetCurrentSurface(EGL_DRAW) ==
m_surface) {
179 bool ok = eglMakeCurrent(eglGetCurrentDisplay(), EGL_NO_DISPLAY, EGL_NO_DISPLAY, EGL_NO_CONTEXT);
180 qCDebug(qLcEglDevDebug) <<
Q_FUNC_INFO <<
" due to eglDestroySurface on *currently* bound surface"
181 <<
"we just called eglMakeCurrent(..,0,0,0)! It returned: " <<
ok;
185 screen()->setPrimarySurface(EGL_NO_SURFACE);
221 windows.
last()->sourceWindow()->requestActivate();
244 if (
rect != lastReportedGeometry)
287 int idx = windows.
indexOf(
this);
291 QRect(
QPoint(0, 0), windows.
last()->sourceWindow()->geometry().size()));
352 qWarning(
"QEglFSWindow: Cannot set opacity for non-raster windows");
virtual QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const
virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow, const QSize &size, const QSurfaceFormat &format)
static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
virtual void destroyNativeWindow(EGLNativeWindowType window)
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
virtual QRect rawGeometry() const
EGLSurface primarySurface() const
EGLDisplay display() const
QOpenGLCompositorBackingStore * backingStore()
QWindow * sourceWindow() const override
void setOpacity(qreal) override
Reimplement to be able to let Qt set the opacity level of a window.
void invalidateSurface() override
Invalidates the window's surface by releasing its surface buffers.
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
EGLNativeWindowType eglWindow() const
void setBackingStore(QOpenGLCompositorBackingStore *backingStore)
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
const QPlatformTextureList * textures() const override
QSurfaceFormat format() const override
Returns the actual surface format of the window.
virtual void resetSurface()
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
EGLSurface surface() const
QRect geometry() const override
Returns the current geometry of a window.
QOpenGLContext * m_rasterCompositingContext
EGLNativeWindowType m_window
void setGeometry(const QRect &) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
QEglFSScreen * screen() const override
void endCompositing() override
QOpenGLCompositorBackingStore * m_backingStore
qsizetype size() const noexcept
A backing store implementation for OpenGL.
const QPlatformTextureList * textures() const
A generic OpenGL-based compositor.
void setTargetContext(QOpenGLContext *context)
void removeWindow(QOpenGLCompositorWindow *window)
static QOpenGLCompositor * instance()
void setTargetWindow(QWindow *window, const QRect &nativeTargetGeometry)
void moveToTop(QOpenGLCompositorWindow *window)
void setRotation(int degrees)
QList< QOpenGLCompositorWindow * > windows() const
QWindow * targetWindow() const
void addWindow(QOpenGLCompositorWindow *window)
void changeWindowIndex(QOpenGLCompositorWindow *window, int newIdx)
bool create()
Attempts to create the OpenGL context with the current configuration.
void setScreen(QScreen *screen)
Sets the screen the OpenGL context should be valid for.
void setShareContext(QOpenGLContext *shareContext)
Makes this context share textures, shaders, and other OpenGL resources with shareContext.
void setFormat(const QSurfaceFormat &format)
Sets the format the OpenGL context should be compatible with.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr QSize size() const noexcept
Returns the size of the rectangle.
SurfaceType
The SurfaceType enum describes what type of surface this is.
static bool flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Make Qt Gui process all events on the event queue immediately.
static void handleGeometryChange(QWindow *window, const QRect &newRect)
static bool handleExposeEvent(QWindow *window, const QRegion ®ion)
static void handleWindowActivated(QWindow *window, Qt::FocusReason r=Qt::OtherFocusReason)
QSurfaceFormat format() const override
Returns the actual format of this window.
SurfaceType surfaceType() const override
Returns the surface type of the window.
struct wl_display * display
Combined button and popup list for selecting options.
@ ActiveWindowFocusReason
DBusConnection const char DBusError * error
QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
QEglFSDeviceIntegration * qt_egl_device_integration()
typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
#define qCWarning(category,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
static QOpenGLCompositor * compositor
QOpenGLContext * qt_gl_global_share_context()
void qt_gl_set_global_share_context(QOpenGLContext *context)
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept