From 86ea95259d3fe827e340b4691710d7d971efc35a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 15 Oct 2011 00:04:09 +0300 Subject: Do not fail user time window creation when xcb is using xlib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/xcb/qxcbwindow.cpp | 8 ++++++-- src/plugins/platforms/xcb/qxcbwindow.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index f65b50456a..8c2b2d53fd 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -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; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index f33ff5c2eb..6ff1627f98 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -161,6 +161,8 @@ private: #endif QRegion m_exposeRegion; + + xcb_visualid_t m_visualId; }; QT_END_NAMESPACE -- cgit v1.2.3