summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmeventtranslator.h
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-07-29 08:57:16 +0200
committerMikolaj Boc <mikolaj.boc@qt.io>2022-08-10 12:25:36 +0200
commit784555cc2fa9d1625a4cac458c15d28cf0c1f4d7 (patch)
treee15072f2e48c4186ec04ea5cd50dd0686d2058bb /src/plugins/platforms/wasm/qwasmeventtranslator.h
parent595526e44623b950acd2bae1e958d21d55df0333 (diff)
Refactor QWasmEventTranslator for added readability
Change listing: - change names of abbreviated structures/variables (e.g. KeyTbl -> WebToQtKeyCodeMappings) - add constants for commonly used magic strings ("Dead", StringTerminator) - use common idioms for common tasks (find_if, std::optional) - use binary search as facilitated by the sorted array instead of a full search - this optimizes the code at no cost - remove dead code (double translateEmscriptKey in QWasmEventTranslator::getKey, remove sticky dead key support as it was write-only, remove the dead setIsMac and g_usePlatformMacSpecifics, remove the dead getWindowAt). - cull the public interface on QWasmEventTranslator as some functions are only used internally (translateEmscriptKey) - simplify / shorten functions by short-circuiting - modernize definitions (= default) - auto-format the changes using clang-format The file is now much easier to read and understand. Change-Id: I5ea2bdafd9b9abc009feeb5516ddd87fb0ca212e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmeventtranslator.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.h12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.h b/src/plugins/platforms/wasm/qwasmeventtranslator.h
index c076ba38bc..5bde30ab91 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.h
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.h
@@ -24,30 +24,18 @@ class QWasmEventTranslator : public QObject
Q_OBJECT
public:
-
explicit QWasmEventTranslator();
~QWasmEventTranslator();
- static Qt::Key translateEmscriptKey(const EmscriptenKeyboardEvent *emscriptKey);
static QCursor cursorForMode(QWasmCompositor::ResizeMode mode);
QString getKeyText(const EmscriptenKeyboardEvent *keyEvent, Qt::Key key);
Qt::Key getKey(const EmscriptenKeyboardEvent *keyEvent);
- void setStickyDeadKey(const EmscriptenKeyboardEvent *keyEvent);
-
- void setIsMac(bool is_mac) {g_usePlatformMacSpecifics = is_mac;};
- bool g_usePlatformMacSpecifics = false;
-
-Q_SIGNALS:
- void getWindowAt(const QPoint &point, QWindow **window);
-private:
- static Qt::Key translateDeadKey(Qt::Key deadKey, Qt::Key accentBaseKey);
private:
static quint64 getTimestamp();
Qt::Key m_emDeadKey = Qt::Key_unknown;
- bool m_emStickyDeadKey = false;
};