[SCM] qtbase packaging branch, ubuntu, updated. ubuntu/5.5.1+dfsg-13ubuntu2-18-g0839be2

Timo Jyrinki timo at moszumanska.debian.org
Fri Feb 26 07:02:27 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/qt/qtbase.git;a=commitdiff;h=0839be2

The following commit has been merged in the ubuntu branch:
commit 0839be2457d3ca56108053a0751349583e20991d
Author: Timo Jyrinki <timo.jyrinki at canonical.com>
Date:   Fri Feb 26 07:02:01 2016 +0000

    Bring too additional patches in to support the multi monitor fix patch.
---
 .../Notify-when-the-primary-screen-changes.patch   | 232 +++++++++++++++++++++
 debian/patches/enable-tests.patch                  |  11 +
 debian/patches/series                              |   3 +-
 ...dle-screen-siblings-in-QXcbVirtualDesktop.patch | 135 ++++++++++++
 ...laceholder-QScreen-when-there-are-no-outp.patch |  41 ++--
 5 files changed, 396 insertions(+), 26 deletions(-)

diff --git a/debian/patches/Notify-when-the-primary-screen-changes.patch b/debian/patches/Notify-when-the-primary-screen-changes.patch
new file mode 100644
index 0000000..120da83
--- /dev/null
+++ b/debian/patches/Notify-when-the-primary-screen-changes.patch
@@ -0,0 +1,232 @@
+From 8cbaea441a8c9adea6ba804b76bf3bd1e79f77b7 Mon Sep 17 00:00:00 2001
+From: Aleix Pol <aleixpol at kde.org>
+Date: Fri, 4 Sep 2015 16:52:04 +0200
+Subject: [PATCH] Notify when the primary screen changes
+
+Makes it possible to notify that the QGuiApplication::primaryScreen has
+changed.
+XCB backend adopts the new API, as it was accessing QGuiApplication private
+API directly.
+
+Change-Id: Icde05c44138265f865fa42d2cd6974c552fdc5e2
+Task-number: QTBUG-38404
+Task-number: QTBUG-40659
+Reviewed-by: Frederik Gladhorn <frederik.gladhorn at theqtcompany.com>
+Reviewed-by: Shawn Rutledge <shawn.rutledge at theqtcompany.com>
+---
+ src/gui/kernel/qguiapplication.cpp           | 12 +++++++++
+ src/gui/kernel/qguiapplication.h             |  2 ++
+ src/gui/kernel/qplatformintegration.cpp      | 39 +++++++++++++++++++++++++++-
+ src/gui/kernel/qplatformintegration.h        |  4 +++
+ src/gui/kernel/qplatformscreen.cpp           |  2 +-
+ src/plugins/platforms/xcb/qxcbconnection.cpp |  9 +++----
+ src/widgets/kernel/qdesktopwidget.cpp        |  1 +
+ src/widgets/kernel/qdesktopwidget.h          |  1 +
+ src/widgets/kernel/qdesktopwidget.qdoc       | 14 ++++++++++
+ 9 files changed, 76 insertions(+), 8 deletions(-)
+
+diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
+index d0aab73..87bd7ea 100644
+--- a/src/gui/kernel/qguiapplication.cpp
++++ b/src/gui/kernel/qguiapplication.cpp
+@@ -921,6 +921,18 @@ QList<QScreen *> QGuiApplication::screens()
+     \since 5.4
+ */
+ 
++/*!
++    
n void QGuiApplication::primaryScreenChanged(QScreen *screen)
++
++    This signal is emitted whenever the primary  screen changes. This way
++    applications can keep track of the primaryScreen and react if there is a
++    new primary screen.
++
++    \sa primaryScreen
++
++    \since 5.6
++*/
++
+ 
+ /*!
+     Returns the highest screen device pixel ratio found on
+diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
+index c89268d..d995387 100644
+--- a/src/gui/kernel/qguiapplication.h
++++ b/src/gui/kernel/qguiapplication.h
+@@ -70,6 +70,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
+     Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
+     Q_PROPERTY(QString platformName READ platformName STORED false)
+     Q_PROPERTY(bool quitOnLastWindowClosed  READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
++    Q_PROPERTY(QScreen *primaryScreen READ primaryScreen NOTIFY primaryScreenChanged STORED false)
+ 
+ public:
+ #ifdef Q_QDOC
+@@ -158,6 +159,7 @@ Q_SIGNALS:
+     void fontDatabaseChanged();
+     void screenAdded(QScreen *screen);
+     void screenRemoved(QScreen *screen);
++    void primaryScreenChanged(QScreen *screen);
+     void lastWindowClosed();
+     void focusObjectChanged(QObject *focusObject);
+     void focusWindowChanged(QWindow *focusWindow);
+diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
+index e935907..457a420 100644
+--- a/src/gui/kernel/qplatformintegration.cpp
++++ b/src/gui/kernel/qplatformintegration.cpp
+@@ -456,6 +456,24 @@ void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary)
+         QGuiApplicationPrivate::screen_list.append(screen);
+     }
+     emit qGuiApp->screenAdded(screen);
++
++    if (isPrimary)
++        emit qGuiApp->primaryScreenChanged(screen);
++}
++
++/*!
++  Just removes the screen, call destroyScreen instead.
++
++  \sa destroyScreen()
++*/
++
++void QPlatformIntegration::removeScreen(QScreen *screen)
++{
++    const bool wasPrimary = (!QGuiApplicationPrivate::screen_list.isEmpty() && QGuiApplicationPrivate::screen_list[0] == screen);
++    QGuiApplicationPrivate::screen_list.removeOne(screen);
++
++    if (wasPrimary && qGuiApp && !QGuiApplicationPrivate::screen_list.isEmpty())
++        emit qGuiApp->primaryScreenChanged(QGuiApplicationPrivate::screen_list[0]);
+ }
+ 
+ /*!
+@@ -469,11 +487,30 @@ void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary)
+ */
+ void QPlatformIntegration::destroyScreen(QPlatformScreen *screen)
+ {
+-    QGuiApplicationPrivate::screen_list.removeOne(screen->d_func()->screen);
++    removeScreen(screen->d_func()->screen);
+     delete screen->d_func()->screen;
+     delete screen;
+ }
+ 
++/*!
++  Should be called whenever the primary screen changes.
++
++  When the screen specified as primary changes, this method will notify
++  QGuiApplication and emit the QGuiApplication::primaryScreenChanged signal.
++ */
++
++void QPlatformIntegration::setPrimaryScreen(QPlatformScreen *newPrimary)
++{
++    QScreen* newPrimaryScreen = newPrimary->screen();
++    int idx = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen);
++    Q_ASSERT(idx >= 0);
++    if (idx == 0)
++        return;
++
++    QGuiApplicationPrivate::screen_list.swap(0, idx);
++    emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
++}
++
+ QStringList QPlatformIntegration::themeNames() const
+ {
+     return QStringList();
+diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
+index 2aa502b..00c50a9 100644
+--- a/src/gui/kernel/qplatformintegration.h
++++ b/src/gui/kernel/qplatformintegration.h
+@@ -172,9 +172,13 @@ public:
+     virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
+ #endif
+     virtual void setApplicationIcon(const QIcon &icon) const;
++
++    void removeScreen(QScreen *screen);
++
+ protected:
+     void screenAdded(QPlatformScreen *screen, bool isPrimary = false);
+     void destroyScreen(QPlatformScreen *screen);
++    void setPrimaryScreen(QPlatformScreen *newPrimary);
+ };
+ 
+ QT_END_NAMESPACE
+diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
+index 2fb53fe..d1d8eba 100644
+--- a/src/gui/kernel/qplatformscreen.cpp
++++ b/src/gui/kernel/qplatformscreen.cpp
+@@ -56,7 +56,7 @@ QPlatformScreen::~QPlatformScreen()
+     Q_D(QPlatformScreen);
+     if (d->screen) {
+         qWarning("Manually deleting a QPlatformScreen. Call QPlatformIntegration::destroyScreen instead.");
+-        QGuiApplicationPrivate::screen_list.removeOne(d->screen);
++        QGuiApplicationPrivate::platformIntegration()->removeScreen(d->screen);
+         delete d->screen;
+     }
+ }
+diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
+index e612cff..5fd0df5 100644
+--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
++++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
+@@ -305,13 +305,10 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
+                     screen->updateRefreshRate(output.mode);
+ 
+                 // If the screen became primary, reshuffle the order in QGuiApplicationPrivate
+-                // TODO: add a proper mechanism for updating primary screen
+                 if (!wasPrimary && screen->isPrimary()) {
+-                    QScreen *realScreen = static_cast<QPlatformScreen*>(screen)->screen();
+-                    QGuiApplicationPrivate::screen_list.removeOne(realScreen);
+-                    QGuiApplicationPrivate::screen_list.prepend(realScreen);
+-                    m_screens.removeOne(screen);
+-                    m_screens.prepend(screen);
++                    const int idx = m_screens.indexOf(screen);
++                    m_screens.swap(0, idx);
++                    QXcbIntegration::instance()->setPrimaryScreen(screen);
+                 }
+                 qCDebug(lcQpaScreen) << "output has changed" << screen;
+             }
+diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
+index 9471602..b88b3cc 100644
+--- a/src/widgets/kernel/qdesktopwidget.cpp
++++ b/src/widgets/kernel/qdesktopwidget.cpp
+@@ -134,6 +134,7 @@ QDesktopWidget::QDesktopWidget()
+     setObjectName(QLatin1String("desktop"));
+     d->_q_updateScreens();
+     connect(qApp, SIGNAL(screenAdded(QScreen*)), this, SLOT(_q_updateScreens()));
++    connect(qApp, SIGNAL(primaryScreenChanged(QScreen*)), this, SIGNAL(primaryScreenChanged()));
+ }
+ 
+ QDesktopWidget::~QDesktopWidget()
+diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
+index c0cc4f1..f5f7d69 100644
+--- a/src/widgets/kernel/qdesktopwidget.h
++++ b/src/widgets/kernel/qdesktopwidget.h
+@@ -77,6 +77,7 @@ Q_SIGNALS:
+     void resized(int);
+     void workAreaResized(int);
+     void screenCountChanged(int);
++    void primaryScreenChanged();
+ 
+ protected:
+     void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc
+index 31a99f1..d1a6eca 100644
+--- a/src/widgets/kernel/qdesktopwidget.qdoc
++++ b/src/widgets/kernel/qdesktopwidget.qdoc
+@@ -271,3 +271,17 @@
+ 
+     \sa screenCount
+ */
++
++
++/*!
++    
n void QDesktopWidget::primaryScreenChanged()
++
++    \since 5.6
++
++    rief This signal is emitted whenever the primary screen changes.
++
++    
ote This doesn't mean the QDesktopWidget::primaryScreen index will
++    necessarily be different, but now it will refer to the new primary screen.
++
++    \sa primaryScreen, screenGeometry()
++*/
+-- 
+2.7.0
+
diff --git a/debian/patches/enable-tests.patch b/debian/patches/enable-tests.patch
index 0f30eb3..6afdc2c 100644
--- a/debian/patches/enable-tests.patch
+++ b/debian/patches/enable-tests.patch
@@ -23646,3 +23646,14 @@ diff -urN qtbase-opensource-src-5.5.1.old/tests/auto/network/access/qnetworkcook
  }
  
  void tst_QNetworkCookieJar::setCookiesFromUrl()
+diff -urN qtbase-opensource-src-5.5.1.old/tests/auto/corelib/io/qurl/tst_qurl.cpp qtbase-opensource-src-5.5.1/tests/auto/corelib/io/qurl/tst_qurl.cpp
+--- qtbase-opensource-src-5.5.1.old/tests/auto/corelib/io/qurl/tst_qurl.cpp	2015-10-13 04:35:19.000000000 +0000
++++ qtbase-opensource-src-5.5.1/tests/auto/corelib/io/qurl/tst_qurl.cpp	2016-02-24 14:20:10.569909324 +0000
+@@ -3200,6 +3200,7 @@
+ 
+ void tst_QUrl::effectiveTLDs()
+ {
++    QSKIP("skip tests due to LP: #1548686");
+     QFETCH(QUrl, domain);
+     QFETCH(QString, TLD);
+     QCOMPARE(domain.topLevelDomain(QUrl::PrettyDecoded), TLD);
diff --git a/debian/patches/series b/debian/patches/series
index 19b0a0b..4d22b75 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -25,7 +25,8 @@ xcb_dont_select_XInput_events_on_root_window.patch
 xcb_fix_drag_and_drop_when_window_is_hidden.patch
 fix_not_delivering_focus.patch
 fix_potential_division_by_zero.patch
-Fix-for-deferredDelete-bug-when-calling-the-glib-loo.patch
+Notify-when-the-primary-screen-changes.patch
+xcb-Handle-screen-siblings-in-QXcbVirtualDesktop.patch
 xcb-Use-a-placeholder-QScreen-when-there-are-no-outp.patch
 dbusmenu_fixes.diff
 dbustray_fixes.diff
diff --git a/debian/patches/xcb-Handle-screen-siblings-in-QXcbVirtualDesktop.patch b/debian/patches/xcb-Handle-screen-siblings-in-QXcbVirtualDesktop.patch
new file mode 100644
index 0000000..c28df65
--- /dev/null
+++ b/debian/patches/xcb-Handle-screen-siblings-in-QXcbVirtualDesktop.patch
@@ -0,0 +1,135 @@
+From 8beec998999b0ad7abf3192069c649b64aa999f5 Mon Sep 17 00:00:00 2001
+From: Alexander Volkov <a.volkov at rusbitech.ru>
+Date: Thu, 5 Nov 2015 18:31:32 +0300
+Subject: [PATCH] xcb: Handle screen siblings in QXcbVirtualDesktop
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Change-Id: I2f3c3ad75bb3914667cf6f27dc2d91aac103607b
+Reviewed-by: Błażej Szczygieł <spaz16 at wp.pl>
+Reviewed-by: Shawn Rutledge <shawn.rutledge at theqtcompany.com>
+---
+ src/plugins/platforms/xcb/qxcbconnection.cpp | 15 +++++----------
+ src/plugins/platforms/xcb/qxcbscreen.cpp     |  5 +++++
+ src/plugins/platforms/xcb/qxcbscreen.h       | 12 +++++++-----
+ 3 files changed, 17 insertions(+), 15 deletions(-)
+
+diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
+index a20d957..e4eaeef 100644
+--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
++++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
+@@ -263,8 +263,7 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
+ 
+             // Known screen removed -> delete it
+             m_screens.removeOne(screen);
+-            foreach (QXcbScreen *otherScreen, m_screens)
+-                otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
++            virtualDesktop->removeScreen(screen);
+ 
+             QXcbIntegration::instance()->destroyScreen(screen);
+ 
+@@ -283,9 +282,7 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
+                 qCDebug(lcQpaScreen) << "output" << screen->name() << "is connected and enabled";
+ 
+                 screen->setPrimary(checkOutputIsPrimary(output.window, output.output));
+-                foreach (QXcbScreen *otherScreen, m_screens)
+-                    if (otherScreen->root() == output.window)
+-                        otherScreen->addVirtualSibling(screen);
++                virtualDesktop->addScreen(screen);
+                 m_screens << screen;
+                 QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+ 
+@@ -308,8 +305,7 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
+                 if (outputInfo->crtc == XCB_NONE) {
+                     qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
+                     m_screens.removeOne(screen);
+-                    foreach (QXcbScreen *otherScreen, m_screens)
+-                        otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
++                    virtualDesktop->removeScreen(screen);
+                     QXcbIntegration::instance()->destroyScreen(screen);
+                 } else {
+                     qCDebug(lcQpaScreen) << "output" << screen->name() << "has been temporarily disabled for the mode switch";
+@@ -443,8 +439,7 @@ void QXcbConnection::initializeScreens()
+                 }
+             }
+         }
+-        foreach (QPlatformScreen* s, siblings)
+-            ((QXcbScreen*)s)->setVirtualSiblings(siblings);
++        virtualDesktop->setScreens(siblings);
+         xcb_screen_next(&it);
+         ++xcbScreenNumber;
+     } // for each xcb screen
+@@ -460,7 +455,7 @@ void QXcbConnection::initializeScreens()
+     QXcbVirtualDesktop *virtualDesktop = m_virtualDesktops.value(0);
+     if (virtualDesktop && !hasOutputs && !virtualDesktop->size().isEmpty() && m_screens.isEmpty()) {
+         QXcbScreen *screen = createScreen(virtualDesktop, 0, Q_NULLPTR);
+-        screen->setVirtualSiblings(QList<QPlatformScreen *>() << screen);
++        virtualDesktop->setScreens(QList<QPlatformScreen *>() << screen);
+         m_screens << screen;
+         primaryScreen = screen;
+         primaryScreen->setPrimary(true);
+diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
+index 0aa5810..9b24884 100644
+--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
++++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
+@@ -74,6 +74,11 @@ QXcbScreen *QXcbVirtualDesktop::screenAt(const QPoint &pos) const
+     delete m_xSettings;
+ }
+ 
++void QXcbVirtualDesktop::addScreen(QPlatformScreen *s)
++{
++    ((QXcbScreen *) s)->isPrimary() ? m_screens.prepend(s) : m_screens.append(s);
++}
++
+ QXcbXSettings *QXcbVirtualDesktop::xSettings() const
+ {
+     if (!m_xSettings) {
+diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
+index 51c92a4..7b5d3cb 100644
+--- a/src/plugins/platforms/xcb/qxcbscreen.h
++++ b/src/plugins/platforms/xcb/qxcbscreen.h
+@@ -68,6 +68,11 @@ public:
+     QSize size() const { return QSize(m_screen->width_in_pixels, m_screen->height_in_pixels); }
+     QSize physicalSize() const { return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); }
+ 
++    QList<QPlatformScreen *> screens() const { return m_screens; }
++    void setScreens(QList<QPlatformScreen *> sl) { m_screens = sl; }
++    void removeScreen(QPlatformScreen *s) { m_screens.removeOne(s); }
++    void addScreen(QPlatformScreen *s);
++
+     QXcbXSettings *xSettings() const;
+ 
+ private:
+@@ -78,6 +83,7 @@ public:
+ private:
+     xcb_screen_t *m_screen;
+     int m_number;
++    QList<QPlatformScreen *> m_screens;
+ 
+     QXcbXSettings *m_xSettings;
+ };
+@@ -110,10 +116,8 @@ public:
+     QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
+     qreal refreshRate() const Q_DECL_OVERRIDE { return m_refreshRate; }
+     Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE { return m_orientation; }
+-    QList<QPlatformScreen *> virtualSiblings() const Q_DECL_OVERRIDE { return m_siblings; }
+-    void setVirtualSiblings(QList<QPlatformScreen *> sl) { m_siblings = sl; }
+-    void removeVirtualSibling(QPlatformScreen *s) { m_siblings.removeOne(s); }
+-    void addVirtualSibling(QPlatformScreen *s) { ((QXcbScreen *) s)->isPrimary() ? m_siblings.prepend(s) : m_siblings.append(s); }
++    QList<QPlatformScreen *> virtualSiblings() const Q_DECL_OVERRIDE { return m_virtualDesktop->screens(); }
++    QXcbVirtualDesktop *virtualDesktop() const { return m_virtualDesktop; }
+ 
+     void setPrimary(bool primary) { m_primary = primary; }
+     bool isPrimary() const { return m_primary; }
+@@ -171,7 +174,6 @@ private:
+     QRect m_availableGeometry;
+     QSize m_virtualSize;
+     QSizeF m_virtualSizeMillimeters;
+-    QList<QPlatformScreen *> m_siblings;
+     Qt::ScreenOrientation m_orientation;
+     QString m_windowManagerName;
+     bool m_syncRequestSupported;
+-- 
+2.7.0
+
diff --git a/debian/patches/xcb-Use-a-placeholder-QScreen-when-there-are-no-outp.patch b/debian/patches/xcb-Use-a-placeholder-QScreen-when-there-are-no-outp.patch
index ecc13c2..3054ebc 100644
--- a/debian/patches/xcb-Use-a-placeholder-QScreen-when-there-are-no-outp.patch
+++ b/debian/patches/xcb-Use-a-placeholder-QScreen-when-there-are-no-outp.patch
@@ -106,15 +106,14 @@ index 50d49ca..231fe9a 100644
          // Only update geometry when there's a valid mode on the CRTC
          // CRTC with node mode could mean that output has been disabled, and we'll
          // get RRNotifyOutputChange notification for that.
-@@ -260,17 +225,7 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
+@@ -260,16 +225,7 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
  
          if (screen && output.connection == XCB_RANDR_CONNECTION_DISCONNECTED) {
              qCDebug(lcQpaScreen) << "screen" << screen->name() << "has been disconnected";
 -
 -            // Known screen removed -> delete it
 -            m_screens.removeOne(screen);
--            foreach (QXcbScreen *otherScreen, m_screens)
--                otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
+-            virtualDesktop->removeScreen(screen);
 -
 -            QXcbIntegration::instance()->destroyScreen(screen);
 -
@@ -125,7 +124,7 @@ index 50d49ca..231fe9a 100644
          } else if (!screen && output.connection == XCB_RANDR_CONNECTION_CONNECTED) {
              // New XRandR output is available and it's enabled
              if (output.crtc != XCB_NONE && output.mode != XCB_NONE) {
-@@ -278,65 +234,142 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
+@@ -278,59 +234,142 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
                  QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo(
                      xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL));
  
@@ -133,9 +132,7 @@ index 50d49ca..231fe9a 100644
 -                qCDebug(lcQpaScreen) << "output" << screen->name() << "is connected and enabled";
 -
 -                screen->setPrimary(checkOutputIsPrimary(output.window, output.output));
--                foreach (QXcbScreen *otherScreen, m_screens)
--                    if (otherScreen->root() == output.window)
--                        otherScreen->addVirtualSibling(screen);
+-                virtualDesktop->addScreen(screen);
 -                m_screens << screen;
 -                QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
 +                // Find a fake screen
@@ -177,8 +174,7 @@ index 50d49ca..231fe9a 100644
                  if (outputInfo->crtc == XCB_NONE) {
                      qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled";
 -                    m_screens.removeOne(screen);
--                    foreach (QXcbScreen *otherScreen, m_screens)
--                        otherScreen->removeVirtualSibling((QPlatformScreen *) screen);
+-                    virtualDesktop->removeScreen(screen);
 -                    QXcbIntegration::instance()->destroyScreen(screen);
 +                    destroyScreen(screen);
                  } else {
@@ -196,13 +192,10 @@ index 50d49ca..231fe9a 100644
 -                    screen->updateRefreshRate(output.mode);
 -
 -                // If the screen became primary, reshuffle the order in QGuiApplicationPrivate
--                // TODO: add a proper mechanism for updating primary screen
 -                if (!wasPrimary && screen->isPrimary()) {
--                    QScreen *realScreen = static_cast<QPlatformScreen*>(screen)->screen();
--                    QGuiApplicationPrivate::screen_list.removeOne(realScreen);
--                    QGuiApplicationPrivate::screen_list.prepend(realScreen);
--                    m_screens.removeOne(screen);
--                    m_screens.prepend(screen);
+-                    const int idx = m_screens.indexOf(screen);
+-                    m_screens.swap(0, idx);
+-                    QXcbIntegration::instance()->setPrimaryScreen(screen);
 -                }
 +                updateScreen(screen, output);
                  qCDebug(lcQpaScreen) << "output has changed" << screen;
@@ -355,18 +348,16 @@ index 50d49ca..231fe9a 100644
                              m_screens << screen;
  
                              // There can be multiple outputs per screen, use either
-@@ -435,12 +471,24 @@ void QXcbConnection::initializeScreens()
+@@ -435,11 +471,23 @@ void QXcbConnection::initializeScreens()
                                  }
                              }
                          }
-+                        foreach (QPlatformScreen* s, siblings)
-+                           ((QXcbScreen*)s)->setVirtualSiblings(siblings);
++                        virtualDesktop->setScreens(siblings);
                      }
                  }
              }
          }
--        foreach (QPlatformScreen* s, siblings)
--            ((QXcbScreen*)s)->setVirtualSiblings(siblings);
+-        virtualDesktop->setScreens(siblings);
 +        if (virtualDesktop->screens().isEmpty()) {
 +            // If there are no XRandR outputs or XRandR extension is missing,
 +            // then create a fake/legacy screen.
@@ -394,7 +385,7 @@ index 50d49ca..231fe9a 100644
 -    QXcbVirtualDesktop *virtualDesktop = m_virtualDesktops.value(0);
 -    if (virtualDesktop && !hasOutputs && !virtualDesktop->size().isEmpty() && m_screens.isEmpty()) {
 -        QXcbScreen *screen = createScreen(virtualDesktop, 0, Q_NULLPTR);
--        screen->setVirtualSiblings(QList<QPlatformScreen *>() << screen);
+-        virtualDesktop->setScreens(QList<QPlatformScreen *>() << screen);
 -        m_screens << screen;
 -        primaryScreen = screen;
 -        primaryScreen->setPrimary(true);
@@ -479,7 +470,7 @@ index 0e99d58..f05432e 100644
 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp
 +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
 @@ -81,6 +81,13 @@ void QXcbVirtualDesktop::addScreen(QPlatformScreen *s)
-     delete m_xSettings;
+     ((QXcbScreen *) s)->isPrimary() ? m_screens.prepend(s) : m_screens.append(s);
  }
  
 +void QXcbVirtualDesktop::setPrimaryScreen(QPlatformScreen *s)
@@ -577,9 +568,9 @@ index c68c290..79620f4 100644
 --- a/src/plugins/platforms/xcb/qxcbscreen.h
 +++ b/src/plugins/platforms/xcb/qxcbscreen.h
 @@ -72,6 +72,7 @@ public:
-     int number() const { return m_number; }
-     QSize size() const { return QSize(m_screen->width_in_pixels, m_screen->height_in_pixels); }
-     QSize physicalSize() const { return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); }
+     void setScreens(QList<QPlatformScreen *> sl) { m_screens = sl; }
+     void removeScreen(QPlatformScreen *s) { m_screens.removeOne(s); }
+     void addScreen(QPlatformScreen *s);
 +    void setPrimaryScreen(QPlatformScreen *s);
  
      QXcbXSettings *xSettings() const;

-- 
qtbase packaging



More information about the pkg-kde-commits mailing list