From 0c27df529d80e0449cfdc6352ad46c904f38c634 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 4 Aug 2017 13:39:36 +0200 Subject: [PATCH] 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 --- src/plasmaquick/dialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp index 43fc19600..98f2403c9 100644 --- a/src/plasmaquick/dialog.cpp +++ b/src/plasmaquick/dialog.cpp @@ -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;