From 00f4e5c9372ec43f405eab0ce6e5464ba2b634ab Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Fri, 24 Mar 2023 15:14:04 +0100 Subject: [PATCH] Remove unused code in qwasmcompositor Some dead code was left after transferring event support to QWasmWindow. Remove it now. Change-Id: I40e15bc62bcbb6fff071f53c45223c8a2d12e348 Reviewed-by: Lorn Potter --- .../platforms/wasm/qwasmcompositor.cpp | 43 +------------------ src/plugins/platforms/wasm/qwasmcompositor.h | 17 +------- src/plugins/platforms/wasm/qwasmscreen.cpp | 1 - 3 files changed, 3 insertions(+), 58 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index 5cb111d59a..1fafd5d9e8 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -3,19 +3,10 @@ #include "qwasmcompositor.h" #include "qwasmwindow.h" -#include "qwasmeventdispatcher.h" -#include "qwasmclipboard.h" -#include "qwasmevent.h" - -#include - -#include #include -#include -#include -#include +#include namespace { QWasmWindow *asWasmWindow(QWindow *window) @@ -32,11 +23,7 @@ QWasmWindowStack::PositionPreference positionPreferenceFromWindowFlags(Qt::Windo return QWasmWindowStack::PositionPreference::Regular; } -} // namespace - -using namespace emscripten; - -Q_GUI_EXPORT int qt_defaultDpiX(); +} // namespace QWasmCompositor::QWasmCompositor(QWasmScreen *screen) : QObject(screen), m_windowStack(std::bind(&QWasmCompositor::onTopWindowChanged, this)) @@ -49,27 +36,6 @@ QWasmCompositor::~QWasmCompositor() if (m_requestAnimationFrameId != -1) emscripten_cancel_animation_frame(m_requestAnimationFrameId); - destroy(); -} - -void QWasmCompositor::onScreenDeleting() -{ - deregisterEventHandlers(); -} - -void QWasmCompositor::deregisterEventHandlers() -{ - QByteArray screenElementSelector = screen()->eventTargetId().toUtf8(); - - emscripten_set_touchstart_callback(screenElementSelector.constData(), 0, 0, NULL); - emscripten_set_touchend_callback(screenElementSelector.constData(), 0, 0, NULL); - emscripten_set_touchmove_callback(screenElementSelector.constData(), 0, 0, NULL); - - emscripten_set_touchcancel_callback(screenElementSelector.constData(), 0, 0, NULL); -} - -void QWasmCompositor::destroy() -{ // TODO(mikolaj.boc): Investigate if m_isEnabled is needed at all. It seems like a frame should // not be generated after this instead. m_isEnabled = false; // prevent frame() from creating a new m_context @@ -228,11 +194,6 @@ void QWasmCompositor::handleBackingStoreFlush(QWindow *window) requestUpdateWindow(asWasmWindow(window)); } -int dpiScaled(qreal value) -{ - return value * (qreal(qt_defaultDpiX()) / 96.0); -} - void QWasmCompositor::frame(const QList &windows) { if (!m_isEnabled || !screen()) diff --git a/src/plugins/platforms/wasm/qwasmcompositor.h b/src/plugins/platforms/wasm/qwasmcompositor.h index 251e9997ef..7d3ea52b39 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.h +++ b/src/plugins/platforms/wasm/qwasmcompositor.h @@ -7,21 +7,13 @@ #include "qwasmwindowstack.h" #include + #include -#include -#include - -#include -#include -#include - QT_BEGIN_NAMESPACE class QWasmWindow; class QWasmScreen; -class QOpenGLContext; -class QOpenGLTexture; class QWasmCompositor final : public QObject { @@ -39,8 +31,6 @@ public: void lower(QWasmWindow *window); void windowPositionPreferenceChanged(QWasmWindow *window, Qt::WindowFlags flags); - void onScreenDeleting(); - QWindow *windowAt(QPoint globalPoint, int padding = 0) const; QWindow *keyWindow() const; @@ -58,16 +48,11 @@ private: void onTopWindowChanged(); void deregisterEventHandlers(); - void destroy(); void requestUpdate(); void deliverUpdateRequests(); void deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType); - static int touchCallback(int eventType, const EmscriptenTouchEvent *ev, void *userData); - - bool processTouch(int eventType, const EmscriptenTouchEvent *touchEvent); - void updateEnabledState(); QWasmWindowStack m_windowStack; diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp index fbe9ffdd71..eac6ce0332 100644 --- a/src/plugins/platforms/wasm/qwasmscreen.cpp +++ b/src/plugins/platforms/wasm/qwasmscreen.cpp @@ -95,7 +95,6 @@ QWasmScreen::~QWasmScreen() void QWasmScreen::deleteScreen() { - m_compositor->onScreenDeleting(); // Deletes |this|! QWindowSystemInterface::handleScreenRemoved(this); }