Allow configuring WASM without draganddrop

Pick-to: 6.9 6.8
Fixes: QTBUG-135874
Change-Id: I84459af06d34682ca3bed1e2e1dab773c77bbcae
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Juha Vuolle 2025-04-10 14:02:16 +03:00
parent 0bf2fafd38
commit a66c73d95e
3 changed files with 15 additions and 1 deletions

View File

@ -33,7 +33,6 @@ qt_internal_add_plugin(QWasmIntegrationPlugin
qwasmwindownonclientarea.cpp qwasmwindownonclientarea.h
qwasminputcontext.cpp qwasminputcontext.h
qwasmwindowstack.cpp qwasmwindowstack.h
qwasmdrag.cpp qwasmdrag.h
DEFINES
QT_EGL_NO_X11
QT_NO_FOREACH
@ -67,6 +66,11 @@ qt_internal_extend_target(QWasmIntegrationPlugin CONDITION QT_FEATURE_clipboard
qwasmclipboard.cpp qwasmclipboard.h
)
qt_internal_extend_target(QWasmIntegrationPlugin CONDITION QT_FEATURE_draganddrop
SOURCES
qwasmdrag.cpp qwasmdrag.h
)
qt_internal_extend_target(QWasmIntegrationPlugin CONDITION QT_FEATURE_opengl
SOURCES
qwasmbackingstore.cpp qwasmbackingstore.h

View File

@ -16,7 +16,9 @@
#include "qwasmwindow.h"
#include "qwasmbackingstore.h"
#include "qwasmfontdatabase.h"
#if QT_CONFIG(draganddrop)
#include "qwasmdrag.h"
#endif
#include <qpa/qplatformwindow.h>
#include <QtGui/qscreen.h>
@ -31,7 +33,9 @@
// this is where EGL headers are pulled in, make sure it is last
#include "qwasmscreen.h"
#if QT_CONFIG(draganddrop)
#include <private/qsimpledrag_p.h>
#endif
QT_BEGIN_NAMESPACE
@ -148,7 +152,9 @@ QWasmIntegration::QWasmIntegration()
visualViewport.call<void>("addEventListener", val("resize"),
val::module_property("qtResizeAllScreens"));
}
#if QT_CONFIG(draganddrop)
m_drag = std::make_unique<QWasmDrag>();
#endif
}
QWasmIntegration::~QWasmIntegration()

View File

@ -23,7 +23,9 @@
#include "qwasmevent.h"
#include "qwasmeventdispatcher.h"
#include "qwasmaccessibility.h"
#if QT_CONFIG(draganddrop)
#include "qwasmdrag.h"
#endif
#include <iostream>
#include <sstream>
@ -143,6 +145,7 @@ void QWasmWindow::registerEventHandlers()
[this](emscripten::val event) { this->handlePointerEnterLeaveEvent(PointerEvent(EventType::PointerLeave, event)); }
);
#if QT_CONFIG(draganddrop)
m_window.call<void>("setAttribute", emscripten::val("draggable"), emscripten::val("true"));
m_dragStartCallback = QWasmEventHandler(m_window, "dragstart",
[this](emscripten::val event) {
@ -174,6 +177,7 @@ void QWasmWindow::registerEventHandlers()
QWasmDrag::instance()->onNativeDragLeave(&dragEvent);
}
);
#endif // QT_CONFIG(draganddrop)
m_wheelEventCallback = QWasmEventHandler(m_window, "wheel",
[this](emscripten::val event) { this->handleWheelEvent(event); });