From 5fb67c1dacce58c034980c5c559f74ce9ec2c756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 22 Sep 2011 09:02:40 +0200 Subject: [PATCH] Don't flood expose events in the xcb plugin. The X server sends a series of expose events, where the count member specifies how many expose events are remaining in the current series. By merging them into an expose region we can send a single expose event to the lighthouse interface. Change-Id: If73c9972fe02c5e4137e8742aaaf5679ccea5a09 Reviewed-on: http://codereview.qt-project.org/5366 Reviewed-by: Qt Sanity Bot Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbwindow.cpp | 12 +++++++++++- src/plugins/platforms/xcb/qxcbwindow.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 56c5c4836f..bf882bdf84 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1122,7 +1122,17 @@ QXcbEGLSurface *QXcbWindow::eglSurface() const void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { QRect rect(event->x, event->y, event->width, event->height); - QWindowSystemInterface::handleSynchronousExposeEvent(window(), rect); + + if (m_exposeRegion.isEmpty()) + m_exposeRegion = rect; + else + m_exposeRegion |= rect; + + // if count is non-zero there are more expose events pending + if (event->count == 0) { + QWindowSystemInterface::handleSynchronousExposeEvent(window(), m_exposeRegion); + m_exposeRegion = QRegion(); + } } void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index e864c14f0f..e70686cba0 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -156,6 +156,8 @@ private: #if defined(XCB_USE_EGL) mutable QXcbEGLSurface *m_eglSurface; #endif + + QRegion m_exposeRegion; }; #endif