Ensure Qt::WA_Mapped is set in case of obscured native windows.
Task-number: QTBUG-33520 Change-Id: I51f9b4634be29fd32f4ad9cc8b5d3e10b19ea2f5 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>bb10
parent
558b0a24d6
commit
829b1d13b2
|
|
@ -506,9 +506,9 @@ void QWidgetPrivate::show_sys()
|
|||
|
||||
QWindow *window = q->windowHandle();
|
||||
|
||||
q->setAttribute(Qt::WA_Mapped);
|
||||
if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
|
||||
invalidateBuffer(q->rect());
|
||||
q->setAttribute(Qt::WA_Mapped);
|
||||
if (q->isWindow() && q->windowModality() != Qt::NonModal && window) {
|
||||
// add our window to the modal window list
|
||||
QGuiApplicationPrivate::showModalWindow(window);
|
||||
|
|
|
|||
|
|
@ -713,6 +713,10 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event
|
|||
break;
|
||||
}
|
||||
|
||||
// Note that widgetState == m_widget->data->window_state when triggered by QWidget::setWindowState().
|
||||
if (!(widgetState & Qt::WindowMinimized))
|
||||
m_widget->setAttribute(Qt::WA_Mapped);
|
||||
|
||||
// Sent event if the state changed (that is, it is not triggered by
|
||||
// QWidget::setWindowState(), which also sends an event to the widget).
|
||||
if (widgetState != int(m_widget->data->window_state)) {
|
||||
|
|
|
|||
|
|
@ -7192,6 +7192,10 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
|
|||
#if !defined(Q_OS_WINCE)
|
||||
void tst_QWidget::updateWhileMinimized()
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity"))
|
||||
QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason.
|
||||
#endif // Q_OS_UNIX
|
||||
UpdateWidget widget;
|
||||
// Filter out activation change and focus events to avoid update() calls in QWidget.
|
||||
widget.updateOnActivationChangeAndFocusIn = false;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ private slots:
|
|||
void tst_showWithoutActivating();
|
||||
void tst_paintEventOnSecondShow();
|
||||
|
||||
void obscuredNativeMapped();
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
void tst_dnd();
|
||||
#endif
|
||||
|
|
@ -368,6 +370,32 @@ void tst_QWidget_window::tst_paintEventOnSecondShow()
|
|||
QTRY_VERIFY(w.paintEventReceived);
|
||||
}
|
||||
|
||||
// QTBUG-33520, a toplevel fully obscured by native children should still receive Qt::WA_Mapped
|
||||
void tst_QWidget_window::obscuredNativeMapped()
|
||||
{
|
||||
enum { size = 200 };
|
||||
|
||||
QWidget topLevel;
|
||||
topLevel.setWindowFlags(Qt::FramelessWindowHint);
|
||||
QWidget *child = new QWidget(&topLevel);
|
||||
child->resize(size, size);
|
||||
topLevel.resize(size, size);
|
||||
topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(size /2 , size / 2));
|
||||
child->winId();
|
||||
topLevel.show();
|
||||
QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped));
|
||||
#if defined(Q_OS_MAC)
|
||||
QSKIP("This test fails on Mac."); // Minimized windows are not unmapped for some reason.
|
||||
#elif defined(Q_OS_UNIX)
|
||||
if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity"))
|
||||
QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason.
|
||||
#endif // Q_OS_UNIX
|
||||
topLevel.setWindowState(Qt::WindowMinimized);
|
||||
QTRY_VERIFY(!topLevel.testAttribute(Qt::WA_Mapped));
|
||||
topLevel.setWindowState(Qt::WindowNoState);
|
||||
QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
|
||||
/* DnD test for QWidgetWindow (handleDrag*Event() functions).
|
||||
|
|
|
|||
Loading…
Reference in New Issue