7#include <private/qeventdispatcher_wasm_p.h>
9#include <qpa/qwindowsysteminterface.h>
11#include <emscripten/html5.h>
15bool QWasmCompositor::m_requestUpdateHoldEnabled =
true;
24 if (m_requestAnimationFrameId != -1)
25 emscripten_cancel_animation_frame(m_requestAnimationFrameId);
37 return !element->context2d().isUndefined();
53 const bool wasEnabled = m_requestUpdateHoldEnabled;
54 m_requestUpdateHoldEnabled =
false;
61 if (
it == m_requestUpdateWindows.
end()) {
76 if (m_requestAnimationFrameId != -1)
79 if (m_requestUpdateHoldEnabled)
82 static auto frame = [](
double frameTime,
void *
context) ->
int {
92 m_requestAnimationFrameId = emscripten_request_animation_frame(
frame,
this);
95void QWasmCompositor::deliverUpdateRequests()
100 auto requestUpdateWindows = m_requestUpdateWindows;
101 m_requestUpdateWindows.
clear();
106 m_inDeliverUpdateRequest =
true;
110 deliverUpdateRequest(
window, updateType);
113 m_inDeliverUpdateRequest =
false;
114 frame(requestUpdateWindows.keys());
117void QWasmCompositor::deliverUpdateRequest(
QWasmWindow *
window, UpdateRequestDeliveryType updateType)
131 if (qwindow->isExposed() ==
false)
133 window->deliverUpdateRequest();
143 if (!m_inDeliverUpdateRequest)
147void QWasmCompositor::frame(
const QList<QWasmWindow *> &windows)
149 if (!m_isEnabled || !
screen())
iterator insert(const Key &key, const T &value)
size_type remove(const Key &key)
iterator find(const Key &key)
QObject * parent() const
Returns a pointer to the parent object.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr QSize size() const noexcept
Returns the size of the rectangle.
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
void onWindowTreeChanged(QWasmWindowTreeNodeChangeType changeType, QWasmWindow *window)
static bool releaseRequestUpdateHold()
void setEnabled(bool enabled)
void requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType=ExposeEventDelivery)
void handleBackingStoreFlush(QWindow *window)
UpdateRequestDeliveryType
QWasmCompositor(QWasmScreen *screen)
QList< QWasmWindow * > allWindows()
static void setSynchronousWindowSystemEvents(bool enable)
static void handleWindowDevicePixelRatioChanged(QWindow *window)
static bool handleExposeEvent(QWindow *window, const QRegion ®ion)
QSet< QString >::iterator it
static QOpenGLCompositor * compositor
GLenum GLenum GLsizei const GLuint GLboolean enabled
QWasmWindowTreeNodeChangeType