Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135341

text input v3: input method window is misplaced after closing a popup

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2, 6.8.3
    • None
    • KDE & Wayfire on Arch Linux
    • Linux/Wayland

    Description

      To reproduce:

      1. focus an input field and activate input method, maybe type something
      2. right click to bring up a popup menu
      3. dismiss the popup
      4. continue to type
      5. the input method window appears at the topleft corner for some time

      This happens because when the popup is closed, the text input is entered and
      enabled, but Qt doesn't call set_cursor_rectangle as it thinks there is no need
      to update the position. However, the position is invalidated by the disable
      request when focus switches to the popup.

      This happens with Wayfire (misplaced briefly) and KDE (misplaced for longer; QT_WAYLAND_TEXT_INPUT_PROTOCOL=zwp_text_input_v3 needs to be set).

      This doesn't happen for GNOME, Sway & niri because they don't hide input method window when the popup is shown.

      The following patch fixes this:

      diff --git a/src/client/qwaylandtextinputv3.cpp b/src/client/qwaylandtextinputv3.cpp
      index 792d360e..3dcc9c46 100644
      --- a/src/client/qwaylandtextinputv3.cpp
      +++ b/src/client/qwaylandtextinputv3.cpp
      @@ -283,7 +283,7 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f
               const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
               const QMargins margins = window->clientSideMargins();
               const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
      -        if (surfaceRect != m_cursorRect) {
      +        if (surfaceRect != m_cursorRect || flags == update_state_enter) {
                   set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
                   m_cursorRect = surfaceRect;
                   needsCommit = true;

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            lilydjwg lilydjwg li
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes