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// Qt-Security score:significant reason:default
4
6
7#include <QtWaylandClient/private/qwaylandscreen_p.h>
8#include <QtWaylandClient/private/qwaylandsurface_p.h>
10
11#include <QtGui/private/qeglconvenience_p.h>
12
13#include <QDebug>
14#include <QtGui/QWindow>
15#include <qpa/qwindowsysteminterface.h>
16#include <QOpenGLFramebufferObject>
17#include <QOpenGLContext>
18
20
21namespace QtWaylandClient {
22
33
46
51
53{
54 // this is always called on the main thread
58 {
61 }
62
64 updateSurface(false);
65}
66
68{
69 // eglSurfaceLock should be locked before calling this method
70
72 {
75 }
76
77 // wl_egl_windows must have both width and height > 0
78 // mesa's egl returns NULL if we try to create a, invalid wl_egl_window, however not all EGL
79 // implementations may do that, so check the size ourself. Besides, we must deal with resizing
80 // a valid window to 0x0, which would make it invalid. Hence, destroy it.
82 if (m_eglSurface) {
84 m_eglSurface = 0;
85 }
89 }
90 mOffset = QPoint();
91 } else {
94 int current_width = 0;
95 int current_height = 0;
96 static bool disableResizeCheck = qgetenv("QT_WAYLAND_DISABLE_RESIZECHECK").toInt();
97
98 if (!disableResizeCheck) {
100 }
104 mOffset = QPoint();
105
106 m_resize = true;
107 }
108 } else if (create && mSurface) {
110 if (Q_UNLIKELY(!eglWindow)) {
111 qCWarning(lcQpaWayland, "Could not create wl_egl_window with size %dx%d\n", sizeWithMargins.width(), sizeWithMargins.height());
112 return;
113 }
114
120
123 qCWarning(lcQpaWayland, "Could not create EGL surface (EGL error 0x%x)\n", eglGetError());
125 return;
126 }
127
131 }
132 }
133}
134
136{
137 QRect r = geometry();
139 return QRect(m.left(), m.bottom(), r.width(), r.height());
140}
141
157
162
167
169{
170 if (!decoration())
171 return 0;
172
173 if (m_resize || !m_contentFBO) {
175 QSize fboSize = geometry().size() * scale();
177
178 delete old;
179 m_resize = false;
180 }
181
182 return m_contentFBO->handle();
183}
184
189
191{
192 if (decoration()) {
193 contentFBO();
195 }
196}
197
198}
199
200QT_END_NAMESPACE
201
202#include "moc_qwaylandeglwindow_p.cpp"
Combined button and popup list for selecting options.