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)
32 if (m_isVisible != visible) {
33 m_isVisible = visible;
50 const QRectF keyboardRectangle(wl_fixed_to_double(
x),
51 wl_fixed_to_double(
y),
52 wl_fixed_to_double(
width),
53 wl_fixed_to_double(
height));
54 if (m_keyboardRect != keyboardRectangle) {
55 m_keyboardRect = keyboardRectangle;
62 if (m_pendingInputMethodEvents.
contains(serial)) {
63 qCWarning(qLcQpaInputMethods) <<
"Input method event with serial" << serial <<
"already started";
68 m_offsetFromCompositor[serial] = surrounding_text_offset;
79 if (cursorPos >
size - halfSize)
81 return cursorPos - halfSize;
101 if (!m_pendingInputMethodEvents.
contains(serial)) {
102 qCWarning(qLcQpaInputMethods) <<
"Input method event with serial" << serial <<
"does not exist";
150 if (!m_pendingInputMethodEvents.
contains(serial)) {
151 qCWarning(qLcQpaInputMethods) <<
"Input method event with serial" << serial <<
"does not exist";
156 m_offsetFromCompositor.
remove(serial);
159 event.setCommitString(commitString, replacementStart, replacementLength);
170 acknowledge_input_method();
178 int32_t nativeScanCode,
179 int32_t nativeVirtualKey,
180 int32_t nativeModifiers,
204 if (surface != m_surface) {
205 qCWarning(qLcQpaInputMethods) <<
"Got leave event for surface without corresponding enter";
228 if (inputMethod !=
nullptr)
229 inputMethod->reset();
235 if (inputMethod !=
nullptr)
236 inputMethod->commit();
243 wl_surface *currentSurface = m_currentWindow !=
nullptr && m_currentWindow->handle() !=
nullptr
244 ?
static_cast<QWaylandWindow *
>(m_currentWindow->handle())->wlSurface()
247 textInputMethod()->disable(currentSurface);
248 m_currentWindow.
clear();
251 currentSurface =
window !=
nullptr &&
window->handle() !=
nullptr
254 if (currentSurface !=
nullptr) {
255 textInputMethod()->disable(currentSurface);
272 if (queries & queriesNeedingOffset)
273 queries |= queriesNeedingOffset;
280 inputMethod->start_update(
int(queries));
287 inputMethod->update_cursor_rectangle(
rect.x(),
rect.y(),
rect.width(),
rect.height());
295 inputMethod->end_update();
304 if (inputMethod !=
nullptr)
305 inputMethod->invoke_action(
int(action), cursorPosition);
311 if (inputMethod !=
nullptr)
312 inputMethod->show_input_panel();
318 if (inputMethod !=
nullptr)
319 inputMethod->hide_input_panel();
325 if (inputMethod !=
nullptr)
334 if (inputMethod !=
nullptr)
343 if (inputMethod !=
nullptr)
344 return inputMethod->
locale();
352 if (inputMethod !=
nullptr)
361 if (inputMethod ==
nullptr)
366 if (m_currentWindow !=
nullptr && m_currentWindow->handle() !=
nullptr) {
368 auto *surface =
static_cast<QWaylandWindow *
>(m_currentWindow->handle())->wlSurface();
370 inputMethod->disable(surface);
371 m_currentWindow.
clear();
378 if (surface !=
nullptr) {
379 inputMethod->enable(surface);
397#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.
void append(parameter_type t)
bool inputMethodAccepted() const
Returns true if current focus object supports input method events.
void emitInputPanelVisibleChanged()
Active QPlatformInputContext is responsible for providing visible property to QInputMethod.
void emitKeyboardRectChanged()
Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputMethod.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
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