From 14b72f49e615d7ddf3c867c149850636f3e53b64 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 26 Feb 2017 19:15:20 +0200 Subject: [PATCH] restore add/remove dock buttons --also use a single timer for screen sync for dockview --- app/dockcorona.cpp | 10 +++++----- app/dockview.cpp | 10 ++++++++-- app/dockview.h | 2 ++ shell/contents/configuration/BehaviorConfig.qml | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index ba13dd414..b0a7706b9 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -267,11 +267,11 @@ void DockCorona::primaryOutputChanged() qDebug() << "Found screen: "<name(); } - if (m_dockViews.count()==1 && qGuiApp->screens().size()==1) { - foreach(auto view, m_dockViews) { - view->setScreenToFollow(qGuiApp->primaryScreen()); - } - } + //if (m_dockViews.count()==1 && qGuiApp->screens().size()==1) { + // foreach(auto view, m_dockViews) { + // view->setScreenToFollow(qGuiApp->primaryScreen()); + // } + // } } void DockCorona::screenRemoved(QScreen *screen) diff --git a/app/dockview.cpp b/app/dockview.cpp index ce54acfbf..053038863 100644 --- a/app/dockview.cpp +++ b/app/dockview.cpp @@ -93,6 +93,10 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen) connect(dockCorona, &DockCorona::docksCountChanged, this, &DockView::docksCountChanged); connect(dockCorona, &DockCorona::dockLocationChanged, this, &DockView::dockLocationChanged); } + + m_screenSyncTimer.setSingleShot(true); + m_screenSyncTimer.setInterval(3000); + connect(&m_screenSyncTimer, &QTimer::timeout, this, &DockView::reconsiderScreen); } DockView::~DockView() @@ -226,7 +230,8 @@ void DockView::screenChanged(QScreen *scr) // } // qDebug() << "Screen inconsistency!!! :" << scr->name() << " - " <name(); - QTimer::singleShot(2500, this, &DockView::reconsiderScreen); + m_screenSyncTimer.start(); + //QTimer::singleShot(2500, this, &DockView::reconsiderScreen); /*bool found{false}; foreach(auto scr, qGuiApp->screens()){ @@ -477,7 +482,8 @@ inline void DockView::syncGeometry() // found=true; } } - QTimer::singleShot(2500, this, &DockView::reconsiderScreen); + m_screenSyncTimer.start(); + //QTimer::singleShot(2500, this, &DockView::reconsiderScreen); //if (found) // setScreenToFollow(m_screenToFollow); diff --git a/app/dockview.h b/app/dockview.h index b5d086b99..215fb63ce 100644 --- a/app/dockview.h +++ b/app/dockview.h @@ -197,6 +197,8 @@ private: QPointer m_screenToFollow; QString m_screenToFollowId; + QTimer m_screenSyncTimer; + //only for the mask, not to actually paint Plasma::FrameSvg::EnabledBorders m_enabledBorders = Plasma::FrameSvg::AllBorders; }; diff --git a/shell/contents/configuration/BehaviorConfig.qml b/shell/contents/configuration/BehaviorConfig.qml index 7fb802c7f..c5733af65 100644 --- a/shell/contents/configuration/BehaviorConfig.qml +++ b/shell/contents/configuration/BehaviorConfig.qml @@ -57,6 +57,7 @@ PlasmaComponents.Page { Layout.leftMargin: units.smallSpacing * 2 Layout.rightMargin: units.smallSpacing * 2 spacing: 1 + visible: false function updateScreens() { if (dock.screens.length > 1)