summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmclipboard.cpp
diff options
context:
space:
mode:
authorInho Lee <[email protected]>2023-09-28 13:42:57 +0200
committerInho Lee <[email protected]>2024-07-05 06:54:26 +0200
commitc844a7a5429e74d7cefb9774f288dbaa76fc2bbb (patch)
treebd69ed99324654cd46bec7fe12a471de11f8ba49 /src/plugins/platforms/wasm/qwasmclipboard.cpp
parent385c9397712b771e0f2c3f0a6322f0f624f09a8a (diff)
wasm: Revamp QWasmInputContext
1. Use QWasmInputContext by default 2. Use QInputMethodEvent instead of KeyEvent Todo: 1. Platform dependent preedit control especially when cursor moved with preedit. (Tested on Android, Linux, Windows) (Firefox still has a problem but it's not clear why PointerEvent doesn't happen.) 2. Apply existing text to inputMethodQueries. 3. Test on touchscreen devices. 4. Test on IOS devices. 5. When dragging selection, freezing 6. Support context menu Fixes: QTBUG-107139 Fixes: QTBUG-124932 Fixes: QTBUG-117096 Pick-to: 6.7 6.8 Change-Id: Iceb6af3489b3d1195ad58cf8f3deb91275fd1bf4 Reviewed-by: Lorn Potter <[email protected]>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmclipboard.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmclipboard.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmclipboard.cpp b/src/plugins/platforms/wasm/qwasmclipboard.cpp
index 1aa3ffa5b36..2d00d9f723a 100644
--- a/src/plugins/platforms/wasm/qwasmclipboard.cpp
+++ b/src/plugins/platforms/wasm/qwasmclipboard.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwasmclipboard.h"
+#include "qwasminputcontext.h"
#include "qwasmdom.h"
#include "qwasmevent.h"
#include "qwasmwindow.h"
@@ -47,6 +48,10 @@ static void commonCopyEvent(val event)
static void qClipboardCutTo(val event)
{
+ QWasmInputContext *wasmInput = QWasmIntegration::get()->wasmInputContext();
+ if (wasmInput && wasmInput->usingTextInput())
+ return;
+
if (!QWasmIntegration::get()->getWasmClipboard()->hasClipboardApi()) {
// Send synthetic Ctrl+X to make the app cut data to Qt's clipboard
QWindowSystemInterface::handleKeyEvent(
@@ -58,6 +63,10 @@ static void qClipboardCutTo(val event)
static void qClipboardCopyTo(val event)
{
+ QWasmInputContext *wasmInput = QWasmIntegration::get()->wasmInputContext();
+ if (wasmInput && wasmInput->usingTextInput())
+ return;
+
if (!QWasmIntegration::get()->getWasmClipboard()->hasClipboardApi()) {
// Send synthetic Ctrl+C to make the app copy data to Qt's clipboard
QWindowSystemInterface::handleKeyEvent(
@@ -68,6 +77,10 @@ static void qClipboardCopyTo(val event)
static void qClipboardPasteTo(val event)
{
+ QWasmInputContext *wasmInput = QWasmIntegration::get()->wasmInputContext();
+ if (wasmInput && wasmInput->usingTextInput())
+ return;
+
event.call<void>("preventDefault"); // prevent browser from handling drop event
QWasmIntegration::get()->getWasmClipboard()->sendClipboardData(event);