8#include <QtGui/qguiapplication.h>
9#include <QtGui/qtextformat.h>
10#include <QtGui/private/qguiapplication_p.h>
21 :
QtWayland::qt_text_input_method_v1(textInputMethod)
28 qt_text_input_method_v1_destroy(
object());
33 if (m_isVisible != visible) {
34 m_isVisible = visible;
51 const QRectF keyboardRectangle(wl_fixed_to_double(
x),
52 wl_fixed_to_double(
y),
53 wl_fixed_to_double(
width),
54 wl_fixed_to_double(
height));
55 if (m_keyboardRect != keyboardRectangle) {
56 m_keyboardRect = keyboardRectangle;
63 if (m_pendingInputMethodEvents.
contains(serial)) {
64 qCWarning(qLcQpaInputMethods) <<
"Input method event with serial" << serial <<
"already started";
68 m_pendingInputMethodEvents[serial] = QList<QInputMethodEvent::Attribute>{};
69 m_offsetFromCompositor[serial] = surrounding_text_offset;
80 if (cursorPos >
size - halfSize)
82 return cursorPos - halfSize;
102 if (!m_pendingInputMethodEvents.
contains(serial)) {
103 qCWarning(qLcQpaInputMethods) <<
"Input method event with serial" << serial <<
"does not exist";
108 QList<QInputMethodEvent::Attribute> &attributes = m_pendingInputMethodEvents[serial];
151 if (!m_pendingInputMethodEvents.
contains(serial)) {
152 qCWarning(qLcQpaInputMethods) <<
"Input method event with serial" << serial <<
"does not exist";
156 QList<QInputMethodEvent::Attribute> attributes = m_pendingInputMethodEvents.
take(serial);
157 m_offsetFromCompositor.
remove(serial);
160 event.setCommitString(commitString, replacementStart, replacementLength);
171 acknowledge_input_method();
179 int32_t nativeScanCode,
180 int32_t nativeVirtualKey,
181 int32_t nativeModifiers,
205 if (surface != m_surface) {
206 qCWarning(qLcQpaInputMethods) <<
"Got leave event for surface without corresponding enter";
229 if (inputMethod !=
nullptr)
230 inputMethod->reset();
236 if (inputMethod !=
nullptr)
237 inputMethod->commit();
244 wl_surface *currentSurface = m_currentWindow !=
nullptr && m_currentWindow->handle() !=
nullptr
245 ?
static_cast<QWaylandWindow *
>(m_currentWindow->handle())->wlSurface()
248 textInputMethod()->disable(currentSurface);
249 m_currentWindow.
clear();
252 currentSurface =
window !=
nullptr &&
window->handle() !=
nullptr
255 if (currentSurface !=
nullptr) {
256 textInputMethod()->disable(currentSurface);
273 if (queries & queriesNeedingOffset)
274 queries |= queriesNeedingOffset;
281 inputMethod->start_update(
int(queries));
288 inputMethod->update_cursor_rectangle(
rect.x(),
rect.y(),
rect.width(),
rect.height());
296 inputMethod->end_update();
305 if (inputMethod !=
nullptr)
306 inputMethod->invoke_action(
int(action), cursorPosition);
312 if (inputMethod !=
nullptr)
313 inputMethod->show_input_panel();
319 if (inputMethod !=
nullptr)
320 inputMethod->hide_input_panel();
326 if (inputMethod !=
nullptr)
335 if (inputMethod !=
nullptr)
344 if (inputMethod !=
nullptr)
345 return inputMethod->
locale();
353 if (inputMethod !=
nullptr)
362 if (inputMethod ==
nullptr)
366 inputMethod->hide_input_panel();
370 if (m_currentWindow !=
nullptr && m_currentWindow->handle() !=
nullptr) {
372 auto *surface =
static_cast<QWaylandWindow *
>(m_currentWindow->handle())->wlSurface();
374 inputMethod->disable(surface);
375 m_currentWindow.
clear();
382 if (surface !=
nullptr) {
383 inputMethod->enable(surface);
401#include "moc_qwaylandinputmethodcontext_p.cpp"
static QColor fromString(QAnyStringView name) noexcept
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.
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.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
The QKeyEvent class describes a key event.
bool inputMethodAccepted() const
Returns true if current focus object supports input method events.
T * data() const noexcept
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const noexcept
Returns the number of characters in this string.
void setProperty(int propertyId, const QVariant &value)
Sets the property specified by the propertyId to the given value.
QWaylandInputDevice * defaultInputDevice() const
QtWayland::qt_text_input_method_manager_v1 * textInputMethodManager() const
void update(Qt::InputMethodQueries) override
Notification on editor updates.
Qt::LayoutDirection inputDirection() const override
bool isInputPanelVisible() const override
Returns input panel visibility status.
QWaylandInputMethodContext(QWaylandDisplay *display)
void reset() override
Method to be called when input method needs to be reset.
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
void hideInputPanel() override
Request to hide input panel.
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
~QWaylandInputMethodContext() override
void showInputPanel() override
Request to show input panel.
bool isValid() const override
Returns input context validity.
void invokeAction(QInputMethod::Action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
QLocale locale() const override
void text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset) override
void text_input_method_v1_key(int32_t type, int32_t key, int32_t modifiers, int32_t autoRepeat, int32_t count, int32_t nativeScanCode, int32_t nativeVirtualKey, int32_t nativeModifiers, const QString &text) override
void text_input_method_v1_input_method_event_attribute(uint32_t serial, int32_t type, int32_t start, int32_t length, const QString &value) override
QRectF keyboardRect() const
~QWaylandTextInputMethod() override
void text_input_method_v1_leave(struct ::wl_surface *surface) override
void text_input_method_v1_end_input_method_event(uint32_t serial, const QString &commitString, const QString &preeditString, int32_t replacementStart, int32_t replacementLength) override
void sendInputState(QInputMethodQueryEvent *state, Qt::InputMethodQueries queries=Qt::ImQueryInput)
Qt::LayoutDirection inputDirection() const
void text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override
void text_input_method_v1_input_direction_changed(int32_t inputDirection) override
void text_input_method_v1_locale_changed(const QString &localeName) override
void text_input_method_v1_enter(struct ::wl_surface *surface) override
QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod)
void text_input_method_v1_visible_changed(int32_t visible) override
EGLImageKHR int int EGLuint64KHR * modifiers
struct wl_display * display
Combined button and popup list for selecting options.
static int mapPositionFromCompositor(int pos, int offset)
static int calculateOffset(const QString &text, int cursorPos)
static constexpr int maxStringSize
static QString mapSurroundingTextToCompositor(const QString &s, int offset)
static int mapPositionToCompositor(int pos, int offset)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qCWarning(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset