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

API for switching input method at compositor-side

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: QPA: Wayland
    • Labels:
      None

      Description

      Proof of concept patch: [1]

      Text input protocol enables input method support at compositor-side. Qt Wayland implements the protocol but does not expose API for switching input method at run-time. Qt applications traditionally have selected input method at start up (set via QT_IM_MODULE) and did not offer a way to switch to a different input method at run-time. We have an accessor QPlatformIntegration::inputContext(), but do not have a setter.

      Restarting an application to switch an input method might be inconvenient for some users, but to restart a text-input enabled compositor to switch, for example, from virtual keyboard to 'compose' input context is not acceptable user experience. Hence the need for this API.

      Input context plugins might need some adjusting to take into consideration that they can be loaded at other time, not just on start up. E.g: https://codereview.qt-project.org/#/c/255896/

      Notes #1:

      The patch currently uses Proxy class, which is sub-optimal due to code duplication (see qwaylandcompositorintegration_p.h). Other option would be to introduce QPlatformIntegration::setInputContext(ctx). With multi-seat support it would look something more like:

      QPlatformIntegration::setInputContext(device, ctx);

      As a temporary solution to address the issue purely in Qt Wayland compositor and to avoid the mentioned bloat of proxy class, we can add override function in QPlatformIntegration::inputContext(). Pseudo code:

      QPlatformIntegration::inputContext()
      {
           if (hasOverride)
              return inputContextOverride();
      
          ..
      }
      

      from qtwayland:

      QPlatformIntegration::setOverride("inputContext", [] {
           logic from QWaylandCompositorIntegration::inputContext() (see https://codereview.qt-project.org/#/c/255673/1/src/compositor/compositor_api/qwaylandcompositorintegration.cpp)
      })
      

      Note #2:

      If vkb not created on startup (via QT_IM_MODULE=qtvirtualkeyboard) it uses the size of physical screen, instead of the size of the nested compositor. It could be an issue in qt wayland or in qtvirtualkeyboard plugin or in [1].

      [1] https://codereview.qt-project.org/#/c/255673/

        Attachments

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

          Activity

            People

            Assignee:
            liaqi Liang Qi
            Reporter:
            paeglis Gatis Paeglis
            PM Owner:
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes