-   Linux - Software (
-   -   ERROR Embedding Xnest in a Window (

Earth_80 07-11-2016 03:46 AM

ERROR Embedding Xnest in a Window
I'm trying to use the -parent flag to Xnest, and not having much luck
with it. I'm using an xembed container in Qt (which works with
mplayer, source below), and I'm trying to run Xnest as

Xnest -parent <winid> :1

I've tried different variations on -class, -sss, -install, and other
things that don't make sense to me, but everything I try gives me the

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: 155
Current serial number in output stream: 156

Just before Xnest exits, I see a flash of XScreenSaver in a grainy
black and white pattern. Xnest works fine without the -parent flag,
aside from the fact that it isn't embedded that way.

Does anybody use Xnest in Xembed mode, and if so, can anybody lend me
a hand? I've pasted the source for my simple Qt app, and attached the
output of an strace of my failed Xnest run.

jpollard 07-11-2016 06:38 AM

I THINK you are bumping into an X security block. The block was put there to help prevent hacks from interposing key/display intercepts. I think the block has been in existence for a couple of years now.

And no, I also don't know of how to fix it - but I believe it depends on how the window is created that defines the access modes. As to whether you can change the modes without having to create the window using Xlib functions I don't know.

A bit of follow up.

I was able to get it to work using the "Xeyes" utility to create the window, I then used the "xwininfo" to identify the window. Using "Xnest -parent 0x360000a :20" (the 0x360000a was provided as the window id by "xwininfo") worked. But some windows don't work (Mate terminal doesn't for instance - giving "invalid parameter attributes" error).

Even got it do display an X terminal in the nested X server (with the window created by xeyes). Couldn't change the xeyes window size afterward though - even after terminating the X server

Elizine 07-11-2016 06:48 AM

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

Earth_80 07-11-2016 01:45 PM

ERROR Embedding Xnest in a Window
jpollard, you are right I could do it with a window created with Xeyes utility, but there is no way to do it with another window.

I do not only tested with a Qt window. I also checked the following:

$ display image.png &

I obtained the windowId with "xwininfo" command and also with xprop.

$ Xnest -parent windowID

And the error was the same.

The problem is that I don't really know if I can modify the access mode of a window.

All times are GMT -5. The time now is 03:28 AM.