Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Embed Xnest in QX11EmbedContainer

    General and Desktop
    1
    1
    1280
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      surlykke last edited by

      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;
      container.show();
      
      QProcess process;
      process.setProcessChannelMode(QProcess::ForwardedChannels);
      
      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

      1 Reply Last reply Reply Quote 0
      • First post
        Last post