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

X11 error (X_CopyRect/BadMatch) when using a translucent widge in multi-screen environment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • None
    • 4.6.2
    • None
    • None
    • openSUSE 11.3 / proprietary NVidia driver, xorg 7.5, also tested with latest nvidia driver and latest xorg 7.5 from opensuse x11 repository

      After upgrading to KDE 4.4/4.5 I had a problem that my application which is using :0.0 and :0.1 (separate X screens) throws some X11 errors and not displaying anything when trying to open a QMenu or a QToolTip. The fist idea was that oxygen is doing something weird and after some digging I could fix it by not using a translucent background for QMenu/QToolTip. Digging deeper I soon came to QX11WindowSurface::flush(). I could confirm that this XCopyArea call is really the culprit. In the end I added a debug line just before the XCopyArea call:

      QX11WindowSurface::flush()
      {
      ...
          XSync(X11->display, false);
          qDebug("Before XCopyArea %p %p '%s' %d %d",d_ptr->device.handle(), widget->handle(), qPrintable(widget->objectName()), d_ptr->device.x11Info().screen(), widget->x11Info().screen());
          XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc,
                    br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y());
          XSync(X11->display, false);
          qDebug("After XSync");
      ...
      }
      

      The output was the following:
      ---------------8<---------------
      Before XCopyArea 0x3c00042 0x3c0003b 'Menu for display 0' 1 0
      X Error: BadMatch (invalid parameter attributes) 8
      Major opcode: 62 (X_CopyArea)
      Resource id: 0x3c00041
      After XSync
      ---------------8<---------------

      As you can see the source bitmap for the back buffer was created on the wrong screen. It is created in QX11WindowSurface::setGeometry() and there you can see that a call to QPixmap::x11SetDefaultScreen() is missing when there's a translucent background. After adding the appropriate call all works fine:

      ---------------8<---------------
      QX11WindowSurface::flush 0x719f70, 0x7fff018c70c0
      Before XCopyArea 0x3c0013c 0x3c00139 'Menu for display 0' 0 0
      After XSync
      ---------------8<---------------

      I've attached the testcase. You need two separate X screens :0.0 and :0.1 and the oxygen style (or a style which is using a translucent background for the QMenu/QToolTip) from KDE 4.4 or higher.

      It would be nice to get this fix added to 4.6.x too if possible.

      Thx,
      Christian

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

            cduclos Carlos Duclos (Inactive)
            chehrlic Christian Ehrlicher
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes