diff options
author | Liang Qi <liang.qi@qt.io> | 2022-10-17 15:11:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2022-11-03 21:43:57 +0200 |
commit | 71c3aab7baae9220b37178711a49746f66975d63 (patch) | |
tree | 7dcef806d8b4fd338e8ca6a9f0790cad4b995700 /src/plugins/platforms/xcb | |
parent | be4d339ce784921e0d1b127a86e025a1274e25b4 (diff) |
xcb: Flush Display when processing xcb events
Only calling xcb_flush() is not enough when users use xlib calls
to paint with the Display, for example in QWidget::paintEvent(),
and not call XFlush().
This fixes a regression since Qt 4.x.
In Qt 4, we use XNextEvent() in x11 event dispatcher which
implicitly called XFlush(). In Qt 5 and 6, we use xcb calls.
See also https://www.x.org/releases/X11R7.5/doc/man/man3/XFlush.3.html
Most client applications need not use this function because the
output buffer is automatically flushed as needed by calls to
XPending, XNextEvent, and XWindowEvent.
Pick-to: 6.4 6.2 5.15
Fixes: QTBUG-46681
Fixes: QTBUG-100085
Change-Id: I08dc0800ad0e23f0c2293d0d4e4bd29d92155752
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 48b5dc90ee..056075886f 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -35,6 +35,10 @@ #undef explicit #include <xcb/xinput.h> +#if QT_CONFIG(xcb_xlib) +#include "qt_xlib_wrapper.h" +#endif + QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; @@ -1090,6 +1094,10 @@ void QXcbConnection::processXcbEvents(QEventLoop::ProcessEventsFlags flags) m_eventQueue->flushBufferedEvents(); } +#if QT_CONFIG(xcb_xlib) + qt_XFlush(static_cast<Display *>(xlib_display())); +#endif + xcb_flush(xcb_connection()); } |