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

text-input-v3 skips advertising capabilities

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2
    • None
    • Fedora 40, compositor: cosmic-comp (but wlroots should also work, anything based on smithay too, gnome probably also)
    • Linux/Wayland

    Description

      When focusing the text input field, sometimes events are missing that the protocol requires.

      One symptom of the problem that after losing focus and receiving again, the text field doesn't send the surrounding text to the input method. The input method cannot cache that value from a previous call, causing a problem: it doesn't know what other text is present.

      This also breaks the capabilities advertisement. Quoting text-input-unstable-v3::zwp_text_input_v3::enable, after the `enable` event:

      >  The set_surrounding_text, set_content_type and set_cursor_rectangle
      > requests must follow if the text input supports the necessary
      > functionality.

      Instead, those do not get sent on refocus:

       

      # WAYLAND_DEBUG=1 WAYLAND_DISPLAY=wayland-1 qmlscene-qt6 ./text.qml 2>&1 | grep text
      [skipped]
      ----FIRST ENABLE
      [3409217.774] {Default Queue} zwp_text_input_v3#21.enter(wl_surface#35)
      [3409217.786] {Default Queue}  -> zwp_text_input_v3#21.enable()
      
      [3418455.395] {Default Queue}  -> zwp_text_input_v3#21.commit()
      
      [3418455.534] {Default Queue}  -> zwp_text_input_v3#21.set_cursor_rectangle(164, 
      31, 1, 16)
      
      [3418455.546] {Default Queue}  -> zwp_text_input_v3#21.set_surrounding_text("x", 
      1, 1)
      
      [3418455.552] {Default Queue}  -> zwp_text_input_v3#21.set_content_type(7, 0)
      --- The above are perfect according to protocol
      [3418455.556] {Default Queue}  -> zwp_text_input_v3#21.commit()
      
      [3423034.466] {Default Queue} zwp_text_input_v3#21.leave(wl_surface#35)
      
      [3423034.472] {Default Queue}  -> zwp_text_input_v3#21.disable()
      
      [3423034.476] {Default Queue}  -> zwp_text_input_v3#21.commit()
      
      [3423039.315] {Default Queue}  -> zwp_text_input_v3#21.commit()
      
      [3423039.345] {Default Queue}  -> zwp_text_input_v3#21.commit()
      --- REENABLING
      [3429549.972] {Default Queue} zwp_text_input_v3#21.enter(wl_surface#35)
      
      [3429550.027] {Default Queue}  -> zwp_text_input_v3#21.enable()
      
      [3429553.521] {Default Queue}  -> zwp_text_input_v3#21.commit()
      --- ALL 3 events missing. set_cursor_rectangle - the compositor can't place a popup. set_surrounding_text - the input method assumes content is unknowable. set_content_type - the input method can't display the correct layout
      
      --- Typing some text
      [3570442.017] {Default Queue}  -> zwp_text_input_v3#21.set_cursor_rectangle(173, 
      31, 1, 16)
      
      [3570442.123] {Default Queue}  -> zwp_text_input_v3#21.set_surrounding_text("xu",
       2, 2)
      --- Some events come back, but the capabilities are already selected
      [3570442.177] {Default Queue}  -> zwp_text_input_v3#21.commit()
      

      The solution would be to set all those 3 events every time the "enable" request is sent.

       

      Attached the `text.qml` test program.

       

      Attachments

        Issue Links

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

          Activity

            People

              inho Inho Lee
              dorotac dcz dcz
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change