1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

restore add/remove dock buttons

--also use a single timer for screen sync
for dockview
This commit is contained in:
Michail Vourlakos 2017-02-26 19:15:20 +02:00
parent 8aa5021645
commit 14b72f49e6
4 changed files with 16 additions and 7 deletions

View File

@ -267,11 +267,11 @@ void DockCorona::primaryOutputChanged()
qDebug() << "Found screen: "<<scr->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)

View File

@ -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() << " - " <<m_screenToFollow->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);

View File

@ -197,6 +197,8 @@ private:
QPointer<QScreen> m_screenToFollow;
QString m_screenToFollowId;
QTimer m_screenSyncTimer;
//only for the mask, not to actually paint
Plasma::FrameSvg::EnabledBorders m_enabledBorders = Plasma::FrameSvg::AllBorders;
};

View File

@ -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)