From 846cf1a13f80fe4590cc9ad4d9972d7a173accd6 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 8 Mar 2013 15:19:33 +0100 Subject: Fix sluggish resizing for opengl windows on X11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable sync protocol for OpenGL surfaces in the XCB plugin. Task-number: QTBUG-29304 Change-Id: I4cb47b04637e15e012758d3b0840abd13d27df69 Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbwindow.cpp | 11 +++++++---- src/plugins/platforms/xcb/qxcbwindow.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index abd2f7a147..11ce1126ae 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -156,6 +156,7 @@ QXcbWindow::QXcbWindow(QWindow *window) , m_gravity(XCB_GRAVITY_STATIC) , m_mapped(false) , m_transparent(false) + , m_usingSyncProtocol(false) , m_deferredActivation(false) , m_netWmUserTimeWindow(XCB_NONE) , m_dirtyFrameMargins(false) @@ -318,7 +319,9 @@ void QXcbWindow::create() properties[propertyCount++] = atom(QXcbAtom::WM_TAKE_FOCUS); properties[propertyCount++] = atom(QXcbAtom::_NET_WM_PING); - if (m_screen->syncRequestSupported()) + m_usingSyncProtocol = m_screen->syncRequestSupported() && window()->surfaceType() != QSurface::OpenGLSurface; + + if (m_usingSyncProtocol) properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST); if (window()->flags() & Qt::WindowContextHelpButtonHint) @@ -335,7 +338,7 @@ void QXcbWindow::create() m_syncValue.hi = 0; m_syncValue.lo = 0; - if (m_screen->syncRequestSupported()) { + if (m_usingSyncProtocol) { m_syncCounter = xcb_generate_id(xcb_connection()); Q_XCB_CALL(xcb_sync_create_counter(xcb_connection(), m_syncCounter, m_syncValue)); @@ -418,7 +421,7 @@ void QXcbWindow::destroy() if (connection()->focusWindow() == this) connection()->setFocusWindow(0); - if (m_syncCounter && m_screen->syncRequestSupported()) + if (m_syncCounter && m_usingSyncProtocol) Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter)); if (m_window) { if (m_netWmUserTimeWindow) { @@ -1694,7 +1697,7 @@ void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *) void QXcbWindow::updateSyncRequestCounter() { - if (m_screen->syncRequestSupported() && (m_syncValue.lo != 0 || m_syncValue.hi != 0)) { + if (m_usingSyncProtocol && (m_syncValue.lo != 0 || m_syncValue.hi != 0)) { Q_XCB_CALL(xcb_sync_set_counter(xcb_connection(), m_syncCounter, m_syncValue)); xcb_flush(xcb_connection()); connection()->sync(); diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 3b5404684f..6a8b98ff0d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -181,6 +181,7 @@ private: bool m_mapped; bool m_transparent; + bool m_usingSyncProtocol; bool m_deferredActivation; bool m_deferredExpose; bool m_configureNotifyPending; -- cgit v1.2.3