1// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
5#ifndef QWAYLANDINPUTCONTEXT_H
6#define QWAYLANDINPUTCONTEXT_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <qpa/qplatforminputcontext.h>
20
21#include <QLoggingCategory>
22#include <QPointer>
23
24#include "qwaylandtextinputinterface_p.h"
25#include <qtwaylandclientglobal_p.h>
26#if QT_CONFIG(xkbcommon)
27#include <xkbcommon/xkbcommon-compose.h>
28#endif
29
30struct wl_callback;
31struct wl_callback_listener;
32
33QT_BEGIN_NAMESPACE
34
35Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods)
36
37namespace QtWaylandClient {
38
39class QWaylandDisplay;
40
41class QWaylandInputContext : public QPlatformInputContext
42{
43 Q_OBJECT
44public:
45 explicit QWaylandInputContext(QWaylandDisplay *display);
46 ~QWaylandInputContext() override;
47
48 bool isValid() const override;
49
50 void reset() override;
51 void commit() override;
52 void update(Qt::InputMethodQueries) override;
53
54 void invokeAction(QInputMethod::Action, int cursorPosition) override;
55
56 void showInputPanel() override;
57 void hideInputPanel() override;
58 bool isInputPanelVisible() const override;
59 QRectF keyboardRect() const override;
60
61 QLocale locale() const override;
62 Qt::LayoutDirection inputDirection() const override;
63
64 void setFocusObject(QObject *object) override;
65
66#if QT_CONFIG(xkbcommon)
67 bool filterEvent(const QEvent *event) override;
68
69 // This invokable is called from QXkbCommon::setXkbContext().
70 Q_INVOKABLE void setXkbContext(struct xkb_context *context) { m_XkbContext = context; }
71#endif
72
73private:
74 QWaylandTextInputInterface *textInput() const;
75
76 QWaylandDisplay *mDisplay = nullptr;
77 QPointer<QWindow> mCurrentWindow;
78
79#if QT_CONFIG(xkbcommon)
80 void ensureInitialized();
81
82 bool m_initialized = false;
83 QObject *m_focusObject = nullptr;
84 xkb_compose_table *m_composeTable = nullptr;
85 xkb_compose_state *m_composeState = nullptr;
86 struct xkb_context *m_XkbContext = nullptr;
87#endif
88};
89
90}
91
92QT_END_NAMESPACE
93
94#endif // QWAYLANDINPUTCONTEXT_H
95

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtwayland/src/client/qwaylandinputcontext_p.h