[英]When calling isActive() on window while dragging/resizing it, false returns. (X11, Qt 5.4.0)
[英]X11 window resizing stutters
我正在X11中创建一个openGL窗口,并使用glxswapbuffers
进行双缓冲。
问题是:渲染看起来很好,但我得到了openGL内容的弹跳和窗口边框在调整大小时口吃。
我尝试过滤ConfigureNotify事件,延迟它们,用glXSwapInterval
设置glXSwapInterval
关闭......没有任何效果。
这是我正在使用的代码
void Window::redraw() { // Called by any control which needs redrawing
XEvent event;
memset(&event, 0, sizeof(event));
event.type = Expose;
event.xexpose.display = display;
XSendEvent(display, window, False, ExposureMask, &event);
}
void Window::resize(int width, int height) {
this->Width = width;
this->Height = height;
}
bool Window::wndProc(XEvent *evt) {
switch (evt->type) {
case Expose: {
if (evt->xexpose.count == 0) { // handle last one only
while (XCheckTypedWindowEvent(display, window, Expose, evt));
if (Width != oldWidth || Height != oldHeight)
resizeViewportAndUpdateDimensions();
Renderer.drawGLStuff();
this->redraw();
}
return true;
} break;
case ConfigureNotify: {
this->resize(evt->xconfigure.width, evt->xconfigure.height);
this->redraw();
return true;
} break;
}
}
请注意,这是一个与我之前通过XCheckTypedWindowEvent
解决的上XCheckTypedWindowEvent
文章不同的问题(严格地与调整大小相关联)。
https://tronche.com/gui/x/xlib/events/window-state-change/configure.html
https://tronche.com/gui/x/xlib/events/structure-control/resize.html
从我可以从这两个链接中读取的内容,当更改完成时,会发生ConfigureNotify。 尝试调整大小时发生ResizeRequest。 特别:
X服务器可以向希望获得有关另一个客户端尝试更改窗口大小的信息的客户端报告ResizeRequest事件。
我不喜欢“CAN报告”的声音,但我想你应该试一试。 不要忘记按照链接中的说明设置正确的事件位。 至于捕获事件时你应该做些什么我不太确定...我会清除前缓冲区并等待调整大小来完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.