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

QEvent::WinIdChange/QEvent::PlatformSurface/QEvent::PlatformWindow and Wayland

    XMLWordPrintable

Details

    Description

      On Wayland, a window is effectively made of two parts - the wl_surface and the surface role (for example, xdg_toplevel, zwlr_layer_surface_v1, etc). This is in contrast to other platforms where the "window id" can be associated to just one object.

      QtWayland QPA can create a new pair of wl_surface and surface role objects when the window visiblity or the window hierarchy changes. When that happens, only native interface specific signals will be emitted, no "standard" events (like QEvent::PlatformWindow) will be sent.

      In order to fit the existing APIs in Qt, QtWayland should send either QEvent::WinIdChange or QEvent::PlatformSurface or QEvent::PlatformWindow event when wl_surface (and the surface role?) changes. For example, to ensure that QVulkanWindow (it watches for platform surface destruction events) works as expected, etc.

      On Wayland, there are two types of window extensions - ones that target the wl_surface object and ones that target the surface role. Furthermore, for some things like the OpenGL context (or VkSurfaceKHR?), we need to have a wl_surface object even if the window is not visible. Ideally, the wl_surface object should be persistent, so it's possible to call QOpenGLContext::makeCurrent() after the window is hidden.

      https://codereview.qt-project.org/c/qt/qtbase/+/547105 introduces a pair of fine-grained signals in the QWaylandWindow to indicate when the surface role goes up or down, which can be used by apps that target wayland platform specifically, but qtwayland still needs to notify high level abstractions about the fact that the wl_surface (and the surface role?) has(ve) been changed in some generic way somehow.

      The problem is that it's not clear when qtwayland should send QEvent::WinIdChange/QEvent::PlatformSurface/QEvent::PlatformWindow because the wl_surface and the surface role have different lifecycles and it makes sense to send those events both when the wl_surface changes and when the surface role changes.

      Related task: https://bugreports.qt.io/browse/QTBUG-106033

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            zzag Vlad Zahorodnii
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes