mirror of https://github.com/qt/qtbase.git
xcb: Send expose event while shrinking windows
Send synthesized expose event while shrinking the QWindow. This fixes the regression which can break some applications which need the paint events while shrinking the QWindow. Added auto test. Task-number: QTBUG-54040 Change-Id: Iaa992abba67f428237fa12c6cae56592b8fcadb0 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Louai Al-Khanji <louai.al-khanji@qt.io>
This commit is contained in:
parent
25f040820c
commit
e2665600c0
|
@ -2102,6 +2102,15 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
|
|||
// will make the comparison later.
|
||||
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
|
||||
|
||||
// Send the synthetic expose event on resize only when the window is shrinked,
|
||||
// because the "XCB_GRAVITY_NORTH_WEST" flag doesn't send it automatically.
|
||||
if (!m_oldWindowSize.isEmpty()
|
||||
&& (actualGeometry.width() < m_oldWindowSize.width()
|
||||
|| actualGeometry.height() < m_oldWindowSize.height())) {
|
||||
QWindowSystemInterface::handleExposeEvent(window(), QRegion(0, 0, actualGeometry.width(), actualGeometry.height()));
|
||||
}
|
||||
m_oldWindowSize = actualGeometry.size();
|
||||
|
||||
if (m_usingSyncProtocol && m_syncState == SyncReceived)
|
||||
m_syncState = SyncAndConfigureReceived;
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ protected:
|
|||
mutable QMargins m_frameMargins;
|
||||
|
||||
QRegion m_exposeRegion;
|
||||
QSize m_oldWindowSize;
|
||||
|
||||
xcb_visualid_t m_visualId;
|
||||
int m_lastWindowStateEvent;
|
||||
|
|
|
@ -58,6 +58,7 @@ private slots:
|
|||
void setVisible();
|
||||
void eventOrderOnShow();
|
||||
void resizeEventAfterResize();
|
||||
void exposeEventOnShrink_QTBUG54040();
|
||||
void mapGlobal();
|
||||
void positioning_data();
|
||||
void positioning();
|
||||
|
@ -373,6 +374,24 @@ void tst_QWindow::resizeEventAfterResize()
|
|||
QTRY_COMPARE(window.received(QEvent::Resize), 2);
|
||||
}
|
||||
|
||||
void tst_QWindow::exposeEventOnShrink_QTBUG54040()
|
||||
{
|
||||
Window window;
|
||||
window.setGeometry(QRect(m_availableTopLeft + QPoint(80, 80), m_testWindowSize));
|
||||
window.setTitle(QTest::currentTestFunction());
|
||||
window.showNormal();
|
||||
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
||||
|
||||
const int initialExposeCount = window.received(QEvent::Expose);
|
||||
window.resize(window.width(), window.height() - 5);
|
||||
QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 1);
|
||||
window.resize(window.width() - 5, window.height());
|
||||
QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 2);
|
||||
window.resize(window.width() - 5, window.height() - 5);
|
||||
QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 3);
|
||||
}
|
||||
|
||||
void tst_QWindow::positioning_data()
|
||||
{
|
||||
QTest::addColumn<int>("windowflags");
|
||||
|
|
Loading…
Reference in New Issue