[plasma-workspace] shell: Delay desktop view geometry update

Aleix Pol aleixpol at kde.org
Tue Sep 29 17:26:09 UTC 2015


Git commit 35003951e4b6d18b3761ee266255526f0370f2f8 by Aleix Pol.
Committed on 29/09/2015 at 17:21.
Pushed by apol into branch 'master'.

Delay desktop view geometry update

Otherwise it enters an infinite loop where the DesktopView starts to be
moved from a screen to another. That happens on XCB (only platform I've
tested) because setScreen and setGeometry will send an XCB event that is
later processed by the application again.

This should probably backported to Plasma/5.4, but considering I'm running
Qt 5.6 I would really appreciate it if someone can check if it works for
him and cherry-pick it there. An easy way to test is to change the primary
screen (in a 2-screen set up) using the kcm or xrandr.

CCMAIL: plasma-devel at kde.org

M  +2    -8    shell/desktopview.cpp
M  +1    -1    shell/desktopview.h

http://commits.kde.org/plasma-workspace/35003951e4b6d18b3761ee266255526f0370f2f8

diff --git a/shell/desktopview.cpp b/shell/desktopview.cpp
index 8e20d44..11f29a8 100644
--- a/shell/desktopview.cpp
+++ b/shell/desktopview.cpp
@@ -89,14 +89,8 @@ void DesktopView::adaptToScreen()
 
 //     qDebug() << "adapting to screen" << screen()->name() << this;
     if ((m_windowType == Desktop || m_windowType == WindowedDesktop) && !ShellManager::s_forceWindowed) {
-        setGeometry(screen()->geometry());
-        setMinimumSize(screen()->geometry().size());
-        setMaximumSize(screen()->geometry().size());
 
-        if(m_oldScreen) {
-            disconnect(m_oldScreen.data(), &QScreen::geometryChanged,
-                       this, &DesktopView::screenGeometryChanged);
-        }
+        QTimer::singleShot(200, this, &DesktopView::screenGeometryChanged);
 
         connect(screen(), &QScreen::geometryChanged,
                 this, &DesktopView::screenGeometryChanged, Qt::UniqueConnection);
@@ -250,7 +244,7 @@ void DesktopView::showConfigurationInterface(Plasma::Applet *applet)
     m_configView.data()->show();
 }
 
-void DesktopView::screenGeometryChanged(const QRect &geom)
+void DesktopView::screenGeometryChanged()
 {
     setGeometry(screen()->geometry());
     setMinimumSize(screen()->geometry().size());
diff --git a/shell/desktopview.h b/shell/desktopview.h
index 867cfdc..6a4d42c 100644
--- a/shell/desktopview.h
+++ b/shell/desktopview.h
@@ -77,7 +77,7 @@ protected Q_SLOTS:
     virtual void showConfigurationInterface(Plasma::Applet *applet);
 
 private Q_SLOTS:
-    void screenGeometryChanged(const QRect &geom);
+    void screenGeometryChanged();
 
 Q_SIGNALS:
     void stayBehindChanged();



More information about the Plasma-devel mailing list