Important: Please read the Qt Code of Conduct -

Embed Xnest in QX11EmbedContainer

  • Hi list

    I wanted to run the X-server Xnest inside a Qt widget, so I adapted the example from QX11EmbedContainer as follows:

    #include <QApplication>
    #include <QProcess>
    #include <QDebug>
    #include <QX11EmbedContainer>

    int main(int argc, char *argv[])
    QApplication a(argc, argv);

    QX11EmbedContainer container;;
    QProcess process;
    QString program("Xnest");
    QStringList args;
    args << "-parent" << QString::number(container.winId(), 16).prepend("0x")  << ":1";
    process.start(program, args);
    return a.exec&#40;&#41;;


    When I run it I get:

    [dix] Could not init font path element /usr/share/fonts/OTF/, removing from list!
    xnest warning: unhandled event
    xnest warning: unhandled event
    xnest warning: unhandled event
    X Error of failed request: BadAccess (attempt to access private resource denied)
    Major opcode of failed request: 2 (X_ChangeWindowAttributes)
    Serial number of failed request: 135
    Current serial number in output stream: 137

    There is a brief flicker where it looks like Xnest has embedded itself in the QX11EmbedContainer and the title of the widget is changed to Xnest, but Xnest itself exits.

    If i run an instance of xterm I am able to embed Xnest in that xterm-instance with the command:

    @Xnest -parent <windowid-of-xterm-instance> :1@

    Hours of googling has not come up with anything.

    Does anybody know what the problem is? Has anybody ever run Xnest embedded in a Qt widget?

    best regards
    Christian Surlykke

Log in to reply