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

API for switching input method at compositor-side

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • QPA: Wayland
    • 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

        For Gerrit Dashboard: QTBUG-74465
        # Subject Branch Project Status CR V

        Activity

          People

            liaqi Liang Qi
            paeglis Gatis Paeglis
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes