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 <lorn.potter@gmail.com>
This commit is contained in:
Mikolaj Boc 2023-03-24 15:14:04 +01:00
parent e2b2bb7ff1
commit 00f4e5c937
3 changed files with 3 additions and 58 deletions

View File

@ -3,19 +3,10 @@
#include "qwasmcompositor.h" #include "qwasmcompositor.h"
#include "qwasmwindow.h" #include "qwasmwindow.h"
#include "qwasmeventdispatcher.h"
#include "qwasmclipboard.h"
#include "qwasmevent.h"
#include <QtGui/private/qwindow_p.h>
#include <private/qguiapplication_p.h>
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qguiapplication.h>
#include <emscripten/bind.h> #include <emscripten/html5.h>
namespace { namespace {
QWasmWindow *asWasmWindow(QWindow *window) QWasmWindow *asWasmWindow(QWindow *window)
@ -32,11 +23,7 @@ QWasmWindowStack::PositionPreference positionPreferenceFromWindowFlags(Qt::Windo
return QWasmWindowStack::PositionPreference::Regular; return QWasmWindowStack::PositionPreference::Regular;
} }
} // namespace } // namespace
using namespace emscripten;
Q_GUI_EXPORT int qt_defaultDpiX();
QWasmCompositor::QWasmCompositor(QWasmScreen *screen) QWasmCompositor::QWasmCompositor(QWasmScreen *screen)
: QObject(screen), m_windowStack(std::bind(&QWasmCompositor::onTopWindowChanged, this)) : QObject(screen), m_windowStack(std::bind(&QWasmCompositor::onTopWindowChanged, this))
@ -49,27 +36,6 @@ QWasmCompositor::~QWasmCompositor()
if (m_requestAnimationFrameId != -1) if (m_requestAnimationFrameId != -1)
emscripten_cancel_animation_frame(m_requestAnimationFrameId); 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 // TODO(mikolaj.boc): Investigate if m_isEnabled is needed at all. It seems like a frame should
// not be generated after this instead. // not be generated after this instead.
m_isEnabled = false; // prevent frame() from creating a new m_context m_isEnabled = false; // prevent frame() from creating a new m_context
@ -228,11 +194,6 @@ void QWasmCompositor::handleBackingStoreFlush(QWindow *window)
requestUpdateWindow(asWasmWindow(window)); requestUpdateWindow(asWasmWindow(window));
} }
int dpiScaled(qreal value)
{
return value * (qreal(qt_defaultDpiX()) / 96.0);
}
void QWasmCompositor::frame(const QList<QWasmWindow *> &windows) void QWasmCompositor::frame(const QList<QWasmWindow *> &windows)
{ {
if (!m_isEnabled || !screen()) if (!m_isEnabled || !screen())

View File

@ -7,21 +7,13 @@
#include "qwasmwindowstack.h" #include "qwasmwindowstack.h"
#include <qpa/qplatformwindow.h> #include <qpa/qplatformwindow.h>
#include <QMap> #include <QMap>
#include <QtGui/qinputdevice.h>
#include <QtCore/private/qstdweb_p.h>
#include <emscripten/html5.h>
#include <emscripten/emscripten.h>
#include <emscripten/bind.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QWasmWindow; class QWasmWindow;
class QWasmScreen; class QWasmScreen;
class QOpenGLContext;
class QOpenGLTexture;
class QWasmCompositor final : public QObject class QWasmCompositor final : public QObject
{ {
@ -39,8 +31,6 @@ public:
void lower(QWasmWindow *window); void lower(QWasmWindow *window);
void windowPositionPreferenceChanged(QWasmWindow *window, Qt::WindowFlags flags); void windowPositionPreferenceChanged(QWasmWindow *window, Qt::WindowFlags flags);
void onScreenDeleting();
QWindow *windowAt(QPoint globalPoint, int padding = 0) const; QWindow *windowAt(QPoint globalPoint, int padding = 0) const;
QWindow *keyWindow() const; QWindow *keyWindow() const;
@ -58,16 +48,11 @@ private:
void onTopWindowChanged(); void onTopWindowChanged();
void deregisterEventHandlers(); void deregisterEventHandlers();
void destroy();
void requestUpdate(); void requestUpdate();
void deliverUpdateRequests(); void deliverUpdateRequests();
void deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType); 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(); void updateEnabledState();
QWasmWindowStack m_windowStack; QWasmWindowStack m_windowStack;

View File

@ -95,7 +95,6 @@ QWasmScreen::~QWasmScreen()
void QWasmScreen::deleteScreen() void QWasmScreen::deleteScreen()
{ {
m_compositor->onScreenDeleting();
// Deletes |this|! // Deletes |this|!
QWindowSystemInterface::handleScreenRemoved(this); QWindowSystemInterface::handleScreenRemoved(this);
} }