[Interest] Qt/XCB drawing on the root window (again?!)

René J.V. Bertin rjvbertin at gmail.com
Sat Sep 12 19:51:48 CEST 2020


Hi,

I have some old Qt4 code I'm porting to Qt5 that includes this

```
void
MyApplication::renderDone()
{
    QPalette palette = desktop()->palette();
    palette.setBrush(desktop()->backgroundRole(), QBrush(renderer->pixmap()));
    desktop()->setPalette(palette);
    //QApplication::setPalette(palette);
    if (dpy) {
       //XSynchronize(dpy, true);
        XClearWindow(dpy, desktop()->winId());
    }

    renderer->saveCacheFile();
    renderer->cleanup();
// ...
    QTimer::singleShot(1000, this, &MyApplication::quit);
//     quit();
}

main()
{
//....
        // Keep color resources after termination
        XSetCloseDownMode(app.display(), RetainTemporary);
//....
}
```

Displayed in a window, `renderer->pixmap()` is identical in Qt4 and Qt5, but only Qt4 gives me an actual image on the X11 root window (tested with the Xephyr nested window server). QDesktopWidget::winID() returns the correct X11 Window so the differences can only be in what the QWidget::setPalette() does behind the scenes and how that trickles down to the underlying Window atom. Or in what it does in addition, like only actually applying the setting before doing some actual painting via the QPA, and then restoring the initial configuration?

I've tried to achieve what I want via Qt calls but have gotten nowhere with that either.

How does one do this sort of thing in Qt5?!

Thanks,
R.


More information about the Interest mailing list