Do not fail user time window creation when xcb is using xlib

QXcbWindow::updateNetWmUserTime() creates a new window using the
actual window as its parent. This operation was failing when Xlib
usage and GLX (or EGL) was enabled because in these cases the real
window was created with a different visual using XCreateWindow.

For the user time window however we were passing the xcb_screen's
root_visual always, and this cannot work when Xlib+GLX/EGL is in use,
resulting in a BAD_MATCH (followed by some annoying flicker on the
screen on Ubuntu at least, or a full log off (X crash?) on Fedora).

The patch saves the visual id used to create the actual window and
passes that when creating the user time window. This way the creation
of the user time window succeeds with Xlib+GLX too.

Change-Id: If3925d9ac1670d385dcc7c2b475c196908569f06
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Laszlo Agocs 2011-10-15 00:04:09 +03:00 committed by Qt by Nokia
parent 83611473ac
commit 86ea95259d
2 changed files with 8 additions and 2 deletions

View File

@ -230,6 +230,9 @@ void QXcbWindow::create()
a.background_pixel = WhitePixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber());
a.border_pixel = BlackPixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber());
a.colormap = cmap;
m_visualId = visualInfo->visualid;
m_window = XCreateWindow(DISPLAY_FROM_XCB(this), xcb_parent_id, rect.x(), rect.y(), rect.width(), rect.height(),
0, visualInfo->depth, InputOutput, visualInfo->visual,
CWBackPixel|CWBorderPixel|CWColormap, &a);
@ -242,6 +245,7 @@ void QXcbWindow::create()
m_window = xcb_generate_id(xcb_connection());
m_depth = m_screen->screen()->root_depth;
m_imageFormat = imageFormatForDepth(m_depth);
m_visualId = m_screen->screen()->root_visual;
Q_XCB_CALL(xcb_create_window(xcb_connection(),
XCB_COPY_FROM_PARENT, // depth -- same as root
@ -253,7 +257,7 @@ void QXcbWindow::create()
rect.height(),
0, // border width
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
m_screen->screen()->root_visual, // visual
m_visualId, // visual
0, // value mask
0)); // value list
}
@ -982,7 +986,7 @@ void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp)
-1, -1, 1, 1,
0, // border width
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
m_screen->screen()->root_visual, // visual
m_visualId, // visual
0, // value mask
0)); // value list
wid = m_netWmUserTimeWindow;

View File

@ -161,6 +161,8 @@ private:
#endif
QRegion m_exposeRegion;
xcb_visualid_t m_visualId;
};
QT_END_NAMESPACE