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

X11 windows unconditionally have WM_TAKE_FOCUS in WM_PROTOCOLS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8
    • QPA: X11/XCB
    • Linux/X11

    Description

      QtXCB unconditionally adds WM_TAKE_FOCUS to the WM_PROTOCOLS property of windows. This means that the client will use either Locally Active or Globally Active input model as described in https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7.

      This means that if the window has Qt::WindowDoesNotAcceptFocus, the window manager will still try to activate the window. If there's no transient to forward input focus to, it will look as if the input focus goes to void.

      In some clients like plasmashell, that's undesired, we don't want the window manager even consider such clients as potential candidates for window activation. But since WM_TAKE_FOCUS is listed in the WM_PROTOCOLS and Qt calling xcb_icccm_wm_hints_set_input(&hints, false), it's not guaranteed.
      https://github.com/freedesktop-unofficial-mirror/xcb__util-wm/blob/master/icccm/xcb_icccm.h#L828
      https://tronche.com/gui/x/xlib/ICC/client-to-window-manager/wm-hints.html

      It would be great if QtXCB provided a way to opt out of the WM_TAKE_FOCUS protocol. For example by providing an api in the native interface, e.g. void QX11Window::setTakesFocus(bool), or updating the WM_PROTOCOLS property in response to setting or unsetting Qt::WindowDoesNotAcceptFocus flag, although I'm not sure that the protocols property can be changed once the window is in the mapped state.

      Attachments

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

        Activity

          People

            liaqi Liang Qi
            zzag Vlad Zahorodnii
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change