如何解决x11 不匹配错误 X_CreateWindow 序列号 7
我正在编写一个带有事件输出的基本 X 应用程序。我在运行程序时遇到 Badmatch 错误。据我所知,代码是正确的,但我不知道为什么我收到错误,并且没有太多关于此的文档。这是我的 createWindow 函数:
void appevent::createWindow() {
XPixmapformatValues *pixmapformats;
int count;
const int bitsPerByte {8};
dpy = XOpendisplay(NULL);
pixmapformats = XListPixmapformats(dpy,&count);
for (int i {} ; i < count ; i++) {
if(pixmapformats[i].depth > depth) {
depth = pixmapformats[i].depth;
bytespp = pixmapformats[i].bits_per_pixel / bitsPerByte;
scanlinePad = pixmapformats[i].scanline_pad;
}
}
XFree(pixmapformats);
std::cout << "Max depth of display: " << depth << std::endl;
std::cout << "Bytes per pixel: " << bytespp << std::endl;
vis = DefaultVisual(dpy,0);
switch(vis->c_class) {
case PseudoColor: std::cout << "Vis is pseudocolor" << std::endl; break;
case StaticColor: std::cout << "Vis is StaticColor" << std::endl; break;
case GrayScale : std::cout << "Vis is GrayScale" << std::endl; break;
case StaticGray : std::cout << "Vis is StaticGray" << std::endl; break;
case DirectColor: std::cout << "Vis is DirectColor" << std::endl; break;
case TrueColor : std::cout << "Vis is TrueColor" << std::endl; break;
}
w = XCreateWindow(dpy,DefaultRootwindow(dpy),100,screenWidth,screenHeight,depth,copyFromParent,vis,NULL);
XStoreName(dpy,w,"Hello");
XMapWindow(dpy,w);
screen = new char[screenWidth * screenHeight * bytespp];
if(ImageByteOrder(dpy) == LSBFirst) std::cout << "LSB first" << std::endl;
else std::cout << "MSB first" << std::endl;
ximg = XCreateImage(dpy,Zpixmap,screen,scanlinePad,0);
XSetForeground(dpy,DefaultGC(dpy,0),-0);
XSetBackground(dpy,0);
}
Max depth of display: 32
Bytes per pixel: 4
Vis is TrueColor
LSB first
X Error of Failed request: BadMatch (invalid parameter attributes)
Major opcode of Failed request: 1 (X_CreateWindow)
Serial number of Failed request: 7
Current serial number in output stream: 10
我在 X 方面没有太多经验。这里有什么错误?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。