Windows QPA: Fix geometry when firing a full expose

There are several places in the code where a full expose
event is fired, but the geometry in logical coordinates is
used (pre-dating High DPI scaling). Fix by introducing a
helper function for it.

Task-number: QTBUG-83449
Change-Id: Ie8bb306de0b9b2b85306ed1bb6ba71181b76a958
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
bb10
Friedemann Kleint 2020-04-14 11:03:32 +02:00
parent 8907635da5
commit 4bb803477b
2 changed files with 10 additions and 4 deletions

View File

@ -1401,6 +1401,11 @@ void QWindowsWindow::fireExpose(const QRegion &region, bool force)
QWindowSystemInterface::handleExposeEvent(window(), region);
}
void QWindowsWindow::fireFullExpose(bool force)
{
fireExpose(QRect(QPoint(0, 0), m_data.geometry.size()), force);
}
void QWindowsWindow::destroyWindow()
{
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << m_data.hwnd;
@ -1561,7 +1566,7 @@ void QWindowsWindow::setVisible(bool visible)
// over the rendering of the window
// There is nobody waiting for this, so we don't need to flush afterwards.
if (isLayered())
fireExpose(QRect(0, 0, win->width(), win->height()));
fireFullExpose();
// QTBUG-44928, QTBUG-7386: This is to resolve the problem where popups are
// opened from the system tray and not being implicitly activated
@ -1966,7 +1971,7 @@ void QWindowsWindow::handleGeometryChange()
&& m_data.geometry.size() != previousGeometry.size() // Exclude plain move
// One dimension grew -> Windows will send expose, no need to synthesize.
&& !(m_data.geometry.width() > previousGeometry.width() || m_data.geometry.height() > previousGeometry.height())) {
fireExpose(QRect(QPoint(0, 0), m_data.geometry.size()), true);
fireFullExpose(true);
}
const bool wasSync = testFlag(SynchronousGeometryChangeEvent);
@ -2165,7 +2170,7 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowStates state)
QWindow *w = window();
bool exposeEventsSent = false;
if (isLayered()) {
fireExpose(QRegion(0, 0, w->width(), w->height()));
fireFullExpose();
exposeEventsSent = true;
}
const QWindowList allWindows = QGuiApplication::allWindows();
@ -2173,7 +2178,7 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowStates state)
if (child != w && child->isVisible() && child->transientParent() == w) {
QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(child);
if (platformWindow && platformWindow->isLayered()) {
platformWindow->fireExpose(QRegion(0, 0, child->width(), child->height()));
platformWindow->fireFullExpose();
exposeEventsSent = true;
}
}

View File

@ -373,6 +373,7 @@ private:
void handleWindowStateChange(Qt::WindowStates state);
inline void destroyIcon();
void fireExpose(const QRegion &region, bool force=false);
void fireFullExpose(bool force=false);
void calculateFullFrameMargins();
mutable QWindowsWindowData m_data;