Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandeglwindow.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtWaylandClient/private/qwaylandscreen_p.h>
7#include <QtWaylandClient/private/qwaylandsurface_p.h>
9
10#include <QtGui/private/qeglconvenience_p.h>
11
12#include <QDebug>
13#include <QtGui/QWindow>
14#include <qpa/qwindowsysteminterface.h>
15#include <QOpenGLFramebufferObject>
16#include <QOpenGLContext>
17
19
20namespace QtWaylandClient {
21
32
45
50
52{
53 // this is always called on the main thread
57 {
60 }
61
63 updateSurface(false);
64}
65
67{
68 // eglSurfaceLock should be locked before calling this method
69
71 {
74 }
75
76 // wl_egl_windows must have both width and height > 0
77 // mesa's egl returns NULL if we try to create a, invalid wl_egl_window, however not all EGL
78 // implementations may do that, so check the size ourself. Besides, we must deal with resizing
79 // a valid window to 0x0, which would make it invalid. Hence, destroy it.
81 if (m_eglSurface) {
83 m_eglSurface = 0;
84 }
88 }
89 mOffset = QPoint();
90 } else {
93 int current_width = 0;
94 int current_height = 0;
95 static bool disableResizeCheck = qgetenv("QT_WAYLAND_DISABLE_RESIZECHECK").toInt();
96
97 if (!disableResizeCheck) {
99 }
103 mOffset = QPoint();
104
105 m_resize = true;
106 }
107 } else if (create && mSurface) {
109 if (Q_UNLIKELY(!eglWindow)) {
110 qCWarning(lcQpaWayland, "Could not create wl_egl_window with size %dx%d\n", sizeWithMargins.width(), sizeWithMargins.height());
111 return;
112 }
113
119
122 qCWarning(lcQpaWayland, "Could not create EGL surface (EGL error 0x%x)\n", eglGetError());
124 return;
125 }
126
130 }
131 }
132}
133
135{
136 QRect r = geometry();
138 return QRect(m.left(), m.bottom(), r.width(), r.height());
139}
140
156
161
166
168{
169 if (!decoration())
170 return 0;
171
172 if (m_resize || !m_contentFBO) {
174 QSize fboSize = geometry().size() * scale();
176
177 delete old;
178 m_resize = false;
179 }
180
181 return m_contentFBO->handle();
182}
183
188
190{
191 if (decoration()) {
192 contentFBO();
194 }
195}
196
197}
198
199QT_END_NAMESPACE
200
201#include "moc_qwaylandeglwindow_p.cpp"