Xnest embedded in a QWidget



  • I do need to display a remote Xnest terminal without close button, for this purpose I feel forced to embed this Xnest in a Qwidget without borders and as a consequence

    According to Xnest documentation, we have the option "-parent"

    -parent window_id This option tells Xnest to use window_id as the root window instead of creating a window.

    Taking into account this option I have done the following:

    ...
    windowContainer = new QWidget();
    ...
    QProcess process;
    process.setProcessChannelMode(QProcess::ForwardedChannels);
    QString program("Xnest");
    QStringList args;
    args << "-query " << ip << " -parent" << QString::number(windowContainer.winId(), 16).prepend("0x") << ":1";

    process.start(program, args);

    However, after executing Xnest I got the following error:

    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: 252
    Current serial number in output stream: 253

    This happens when I add the option "-parent".

    Please, I would appreciate if you could help me.

    Thanks in advance.


  • Qt Champions 2017

    Hi and welcome
    Have you tried with other window to verify -parent does work?
    Maybe try to use xprop to see the ID directly ?



  • Yes, I tried with another window to discard WindowId was wrong, but it failed again.


  • Qt Champions 2017

    @Jupiter_80
    It also failed with other non Qt window?



  • The problem appears when I try to run Xnest as a child.

    bash$ display /home/user/images/example.png &

    bash$ xwininfo |grep id:
    -> parent window ID

    bash$ Xnest -parent 0x2000011 :1

    Produced error message:

    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: 69
    Current serial number in output stream: 70


  • Qt Champions 2017

    @Jupiter_80
    Hi
    Yes, I also tried with both Qt and non Qt windows.
    I cannot get -parent to work at all.

    Did you have it work with any non Qt window?



  • Unfortunatelly, it does not work even with a Non Qt Window.


  • Qt Champions 2017

    @Jupiter_80
    Hi, i didn't have any luck either. (with Xnest)
    I wonder if
    http://manpages.ubuntu.com/manpages/wily/man1/Xephyr.1.html
    might be an option?



  • Thanks but it is mandatory to use Xnest in our system ....


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.