3#include <qpa/qplatforminputcontext.h>
10#include <QtCore/qloggingcategory.h>
11#include <QtGui/QGuiApplication>
12#include <QtGui/private/qguiapplication_p.h>
13#include <QtGui/private/qhighdpiscaling_p.h>
14#include <QtGui/qpa/qplatformintegration.h>
15#include <QtGui/qevent.h>
16#include <QtGui/qwindow.h>
17#include <QTextCharFormat>
30const Qt::InputMethodQueries supportedQueries1 =
Qt::ImEnabled |
40 :
QtWayland::zwp_text_input_v1(text_input)
48 wl_callback_destroy(m_resetCallback);
49 zwp_text_input_v1_destroy(
object());
63 event.setCommitString(m_preeditCommit);
70const wl_callback_listener QWaylandTextInputv1::callbackListener = {
71 QWaylandTextInputv1::resetCallback
74void QWaylandTextInputv1::resetCallback(
void *
data, wl_callback *, uint32_t)
78 if (self->m_resetCallback) {
79 wl_callback_destroy(self->m_resetCallback);
80 self->m_resetCallback =
nullptr;
93 auto *surface =
window->wlSurface();
94 if (!surface || (surface != m_surface))
97 queries &= supportedQueries1;
126 set_content_type(contentType.
hint, contentType.
purpose);
135 set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
144 QtWayland::zwp_text_input_v1::reset();
146 commit_state(m_serial);
156 return m_inputPanelVisible;
161 return m_keyboardRectangle;
171 return m_inputDirection;
190 m_modifiersMap.
clear();
192 for (
const QByteArray &modifier : modifiersMap) {
193 if (modifier ==
"Shift")
195 else if (modifier ==
"Control")
197 else if (modifier ==
"Alt")
199 else if (modifier ==
"Mod1")
201 else if (modifier ==
"Mod4")
210 const bool inputPanelVisible = (visible == 1);
211 if (m_inputPanelVisible != inputPanelVisible) {
212 m_inputPanelVisible = inputPanelVisible;
221 if (m_resetCallback) {
222 qCDebug(qLcQpaInputMethods()) <<
"discard preedit_string: reset not confirmed";
253 if (m_resetCallback) {
254 qCDebug(qLcQpaInputMethods()) <<
"discard commit_string: reset not confirmed";
264 m_preeditCommit.
clear();
289#if QT_CONFIG(xkbcommon)
290 if (m_resetCallback) {
291 qCDebug(qLcQpaInputMethods()) <<
"discard keysym: reset not confirmed";
298 Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(
modifiers);
318 if (m_resetCallback) {
319 qCDebug(qLcQpaInputMethods()) <<
"discard language: reset not confirmed";
334 if (m_resetCallback) {
335 qCDebug(qLcQpaInputMethods()) <<
"discard text_direction: reset not confirmed";
348Qt::KeyboardModifiers QWaylandTextInputv1::modifiersToQtModifiers(uint32_t
modifiers)
351 for (
int i = 0;
i < m_modifiersMap.
size(); ++
i) {
353 ret |= m_modifiersMap[
i];
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
Type
This enum type defines the valid event types in Qt.
static QPlatformIntegration * platformIntegration()
static QObject * focusObject()
Returns the QObject in currently active window that will be final receiver of events tied to focus,...
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
static QInputMethod * inputMethod()
returns the input method.
qsizetype size() const noexcept
void append(parameter_type t)
constexpr int left() const noexcept
Returns the left margin.
constexpr int top() const noexcept
Returns the top margin.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr QRect translated(int dx, int dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString mid(qsizetype position, qsizetype n=-1) const &
void clear()
Clears the contents of the string and makes it null.
qsizetype size() const noexcept
Returns the number of characters in this string.
QByteArray toUtf8() const &
static bool handleKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
static QString lookupStringNoKeysymTransformations(xkb_keysym_t keysym)
static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers)
QRectF keyboardRect() const override
void zwp_text_input_v1_language(uint32_t serial, const QString &language) override
void zwp_text_input_v1_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override
QWaylandTextInputv1(QWaylandDisplay *display, struct ::zwp_text_input_v1 *text_input)
void zwp_text_input_v1_enter(struct ::wl_surface *surface) override
void zwp_text_input_v1_input_panel_state(uint32_t state) override
Qt::LayoutDirection inputDirection() const override
QLocale locale() const override
~QWaylandTextInputv1() override
bool isInputPanelVisible() const override
void zwp_text_input_v1_cursor_position(int32_t index, int32_t anchor) override
void zwp_text_input_v1_leave() override
void zwp_text_input_v1_modifiers_map(wl_array *map) override
void zwp_text_input_v1_preedit_string(uint32_t serial, const QString &text, const QString &commit) override
void zwp_text_input_v1_commit_string(uint32_t serial, const QString &text) override
void zwp_text_input_v1_delete_surrounding_text(int32_t before_length, uint32_t after_length) override
void updateState(Qt::InputMethodQueries queries, uint32_t flags) override
void zwp_text_input_v1_preedit_cursor(int32_t index) override
void zwp_text_input_v1_text_direction(uint32_t serial, uint32_t direction) override
void zwp_text_input_v1_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override
void setCursorInsidePreedit(int cursor) override
EGLImageKHR int int EGLuint64KHR * modifiers
QMap< QString, QString > map
[6]
struct wl_display * display
T toNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr T qAbs(const T &t)
GLuint64 GLenum void * handle
GLenum GLuint GLenum GLsizei length
GLint GLint GLint GLint GLsizei GLsizei GLsizei GLboolean commit
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints)