ignore spurious resize events to empty sizes

Summary:
on multiscreen systems, the notification dialog gets resized to 0x0
right after componentcomplete by someone else (either kwin, notification
 applet  or Qt code) causing 382340, resizing a window to a null size is not correct anyways
and should never happen.
with this, all other resize events are correct and notifications are ok on multiscreen
systems

BUG:382340

Test Plan:
system with primary monitor and panel in the external monitor
at the right of a panel, notifications are fine

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, broulik, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D7127
This commit is contained in:
Marco Martin 2017-08-04 13:39:36 +02:00
parent 6a61d10f54
commit 0c27df529d

View File

@ -1042,6 +1042,16 @@ void Dialog::resizeEvent(QResizeEvent* re)
{
QQuickWindow::resizeEvent(re);
//it's a spontaneous event generated in qguiapplication.cpp QGuiApplicationPrivate::processWindowScreenChangedEvent
//QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window), QRect());
//This happens before the first show event when there is more than one screen,
//right after the window has been created, the window is still 0x0,
//but the resize event gets delivered with 0x0 again and executed with all the bad side effects
//this seems to happen for every window when there are multiple screens, so something we have probably to watch out for in the future
if (re->size().isEmpty() || re->size() != re->oldSize()) {
return;
}
//A dialog can be resized even if no mainItem has ever been set
if (!d->mainItem) {
return;