7#include <QtWaylandCompositor/QWaylandCompositor>
8#include <QtWaylandCompositor/private/qwaylandseat_p.h>
14#include <QGuiApplication>
15#include <QInputMethodEvent>
16#include <qpa/qwindowsysteminterface.h>
18#if QT_CONFIG(xkbcommon)
19#include <QtGui/private/qxkbcommon_p.h>
34 Qt::InputMethodQueries queries;
52 Qt::InputMethodQueries queries;
96 bool needsDone =
false;
98 const QString &newPreeditString =
event->preeditString();
102 int32_t preeditCursorPos = newPreeditString.
length();
104 if (
event->replacementLength() > 0 ||
event->replacementStart() < 0) {
105 if (
event->replacementStart() <= 0 && (
event->replacementLength() >= -
event->replacementStart())) {
110 send_delete_surrounding_text(
focusResource->handle, before, after);
113 qCWarning(qLcWaylandCompositorTextInput) <<
"Not yet supported case of replacement. Start:" <<
event->replacementStart() <<
"length:" <<
event->replacementLength();
115 preeditCursorPos =
event->replacementStart() +
event->replacementLength();
123 if (!
event->commitString().isEmpty()) {
200 qApp->inputMethod()->commit();
203 qApp->inputMethod()->hide();
209 if (
focus != surface)
212 Resource *resource = surface ? resourceMap().value(surface->
waylandClient()) : 0;
213 if (resource && surface) {
214 send_enter(resource->handle, surface->
resource());
216 if (
focus != surface)
244 wl_resource_destroy(resource->handle);
259 qApp->inputMethod()->show();
269 emit q->surfaceDisabled(
s);
274 qApp->inputMethod()->commit();
276 qApp->inputMethod()->reset();
300 qCDebug(qLcWaylandCompositorTextInput) <<
Q_FUNC_INFO <<
"pendingState is not changed";
309 qApp->inputMethod()->reset();
320 qCDebug(qLcWaylandCompositorTextInput) <<
"QInputMethod::update() after commit with" << queries;
322 qApp->inputMethod()->update(queries);
335 if ((
hint & content_hint_completion) == 0)
337 if ((
hint & content_hint_auto_capitalization) == 0)
339 if ((
hint & content_hint_lowercase) != 0)
341 if ((
hint & content_hint_uppercase) != 0)
343 if ((
hint & content_hint_hidden_text) != 0)
345 if ((
hint & content_hint_sensitive_data) != 0)
347 if ((
hint & content_hint_latin) != 0)
349 if ((
hint & content_hint_multiline) != 0)
353 case content_purpose_normal:
355 case content_purpose_alpha:
358 case content_purpose_digits:
361 case content_purpose_number:
364 case content_purpose_phone:
367 case content_purpose_url:
370 case content_purpose_email:
373 case content_purpose_name:
374 case content_purpose_password:
376 case content_purpose_date:
379 case content_purpose_time:
382 case content_purpose_datetime:
385 case content_purpose_terminal:
421 this, &QWaylandTextInputV3::focusSurfaceDestroyed);
432 d->sendInputMethodEvent(
event);
460 d->setFocus(surface);
463void QWaylandTextInputV3::focusSurfaceDestroyed(
void *)
469 d->focusDestroyListener.reset();
472 d->focusResource =
nullptr;
481 return d->enabledSurfaces.values().contains(surface);
490 d->add(client,
id, version);
495 return QWaylandTextInputV3Private::interface();
500 return QWaylandTextInputV3Private::interfaceName();
bool remove(const Key &key)
Removes the item that has the key from the hash.
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QKeyEvent class describes a key event.
\inmodule QtCore\reentrant
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
QString mid(qsizetype position, qsizetype n=-1) const &
void clear()
Clears the contents of the string and makes it null.
QString right(qsizetype n) const &
qsizetype length() const noexcept
Returns the number of characters in this string.
\inmodule QtWaylandCompositor
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
void listenForDestruction(struct wl_resource *resource)
\inmodule QtWaylandCompositor
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
struct wl_resource * resource() const
Returns the Wayland resource corresponding to this QWaylandSurface.
::wl_client * waylandClient() const
Holds the wl_client using this QWaylandSurface.
Qt::InputMethodQueries changedState
Qt::InputMethodQueries mergeChanged(const QWaylandTextInputV3ClientState &other)
Qt::InputMethodHints hints
Qt::InputMethodQueries updatedQueries(const QWaylandTextInputV3ClientState &other) const
void zwp_text_input_v3_destroy_resource(Resource *resource) override
QWaylandTextInputV3Private(QWaylandCompositor *compositor)
void zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override
void zwp_text_input_v3_enable(Resource *resource) override
void zwp_text_input_v3_commit(Resource *resource) override
QScopedPointer< QWaylandTextInputV3ClientState > currentState
void sendInputMethodEvent(QInputMethodEvent *event)
void zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause) override
QString currentPreeditString
void zwp_text_input_v3_disable(Resource *resource) override
QWaylandDestroyListener focusDestroyListener
void zwp_text_input_v3_bind_resource(Resource *resource) override
QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
QHash< Resource *, uint32_t > serials
void sendKeyEvent(QKeyEvent *event)
void zwp_text_input_v3_destroy(Resource *resource) override
void zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override
QHash< Resource *, QWaylandSurface * > enabledSurfaces
void setFocus(QWaylandSurface *surface)
void zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override
QScopedPointer< QWaylandTextInputV3ClientState > pendingState
static const struct wl_interface * interface()
QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
void sendInputMethodEvent(QInputMethodEvent *event)
static QByteArray interfaceName()
void setFocus(QWaylandSurface *surface)
void add(::wl_client *client, uint32_t id, int version)
QWaylandTextInputV3(QWaylandObject *container, QWaylandCompositor *compositor)
QWaylandSurface * focus() const
void sendKeyEvent(QKeyEvent *event)
~QWaylandTextInputV3() override
bool isSurfaceEnabled(QWaylandSurface *surface) const
Combined button and popup list for selecting options.
@ ImhFormattedNumbersOnly
@ ImhDialableCharactersOnly
#define QByteArrayLiteral(str)
#define qCWarning(category,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
static QOpenGLCompositor * compositor
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble GLdouble q
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)