我创建了2个窗口。窗口A是具有32位颜色深度的窗口,窗口B具有24位颜色深度。创建窗口B时使用A作为父级。我想重新打开窗口,使得窗口A总是在窗口B之上,但是通过运行这个片段,它告诉我它给了我一个错误并告诉我这是一个不好的匹配。在我的例子中,opengl_window是窗口A,gstreamer_window是窗口B.
Window windows[2] = {opengl_window, gstreamer_window};
XRestackWindows(x_display, windows, 2);
以下是我创建窗口的方法。
int nxvisuals = 0;
XVisualInfo visual_template;
XVisualInfo *visual_list;
XVisualInfo vinfo;
Visual *visual;
int depth;
/* Open the standard display (the primary screen) */
x_display = XOpenDisplay ( NULL );
if ( x_display == NULL )
{
return 1;
}
visual_template.screen = DefaultScreen(x_display);
visual_list = XGetVisualInfo(x_display, VisualScreenMask, &visual_template, &nxvisuals);
if (!XMatchVisualInfo(x_display, XDefaultScreen(x_display), 32, TrueColor, &vinfo))
{
return 1;
}
parent = XDefaultRootWindow(x_display);
XSync(x_display, True);
visual = vinfo.visual;
depth = vinfo.depth;
XSetWindowAttributes swa;
swa.event_mask = ExposureMask | PointerMotionMask | KeyPressMask;
swa.colormap = XCreateColormap(x_display, XDefaultRootWindow(x_display), visual, AllocNone);
swa.background_pixel = 0;
swa.border_pixel = 0;
/* Create a window */
opengl_window = XCreateWindow (
x_display, parent,
0, 0, m_plane_width, m_plane_height, 0,
depth, InputOutput,
visual, CWEventMask | CWBackPixel | CWColormap | CWBorderPixel,
&swa );
同样地,我用相同的东西创建了gstreamer窗口,除了这一行改为24。
if (!XMatchVisualInfo(x_display, XDefaultScreen(x_display), 24, TrueColor, &vinfo))
{
return 1;
}
我的确切错误是:
Start laptop loading file handle 12
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 12 (X_ConfigureWindow)
Serial number of failed request: 32
Current serial number in output stream: 32
[Inferior 1 (process 2232) exited with code 01]