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

Qt may hit failed state if Wayland compositor provides no supported shell integrations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.1, 6.6.0
    • 6.2.4
    • QPA: Wayland
    • None
    • Linux/Wayland
    • b66d93c6b (dev), 2eb17abf4 (dev), 5b64b363b (6.5), 23a026cd3 (6.5)

    Description

      Let's imagine we have a system with unsupported shell integration and XWayland (e.g. xdg-shell-v5 - Chrome OS before version 97). In such environment, Qt application "works" (the process doesn't exit, it feels like a hang), but can't show any window while it can fallback to xcb and work just fine. The naive way to fix this is:

      diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
      index 8806773d..c4e251e9 100644
      --- a/src/client/qwaylanddisplay.cpp
      +++ b/src/client/qwaylanddisplay.cpp
      @@ -163,6 +163,13 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
           if (!mXkbContext)
               qCWarning(lcQpaWayland, "failed to create xkb context");
       #endif
      +
      +    forceRoundTrip();
      +
      +    if (!mWaitingScreens.isEmpty()) {
      +        // Give wl_output.done and zxdg_output_v1.done events a chance to arrive
      +        forceRoundTrip();
      +    }
       }
       
       QWaylandDisplay::~QWaylandDisplay(void)
      @@ -191,12 +198,6 @@ QWaylandDisplay::~QWaylandDisplay(void)
       // so that factory functions in integration can be overridden.
       void QWaylandDisplay::initialize()
       {
      -    forceRoundTrip();
      -
      -    if (!mWaitingScreens.isEmpty()) {
      -        // Give wl_output.done and zxdg_output_v1.done events a chance to arrive
      -        forceRoundTrip();
      -    }
       }
       
       void QWaylandDisplay::ensureScreen()
      diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
      index 41e6c50f..728d4d5a 100644
      --- a/src/client/qwaylandintegration.cpp
      +++ b/src/client/qwaylandintegration.cpp
      @@ -115,7 +115,7 @@ QWaylandIntegration::QWaylandIntegration()
       #endif
       {
           mDisplay.reset(new QWaylandDisplay(this));
      -    if (!mDisplay->isInitialized()) {
      +    if (!mDisplay->isInitialized() || !shellIntegration()) {
               mFailed = true;
               return;
           }
      

      But looks like the code in QWaylandDisplay::initialize() was separated from the constructor on a reason previously, so I haven't pushed this to gerrit.

      Attachments

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

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            ilya-fedin Ilya Fedin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: