From 09109bcf96e733b09903420d97996c340b9e1b71 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 23 Nov 2018 16:57:33 +0200 Subject: [PATCH] support plasmoid.screenGeometry properly BUG: 401333 --- app/dockcorona.cpp | 22 ++++++++++++++++++++++ plasmoid/package/contents/ui/main.qml | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index b8e3dd418..d3c6c53de 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -216,6 +216,15 @@ void DockCorona::load() } m_layoutManager->loadLayoutOnStartup(loadLayoutName); + + + //! load screens signals such screenGeometryChanged in order to support + //! plasmoid.screenGeometry properly + for (QScreen *screen : qGuiApp->screens()) { + addOutput(screen); + } + + connect(qGuiApp, &QGuiApplication::screenAdded, this, &DockCorona::addOutput, Qt::UniqueConnection); } } @@ -598,6 +607,19 @@ void DockCorona::addOutput(QScreen *screen) int newId = m_screenPool->firstAvailableId(); m_screenPool->insertScreenMapping(newId, screen->name()); } + + connect(screen, &QScreen::geometryChanged, this, [ = ]() { + const int id = m_screenPool->id(screen->name()); + + if (id >= 0) { + emit screenGeometryChanged(id); + emit availableScreenRegionChanged(); + emit availableScreenRectChanged(); + } + }); + + emit availableScreenRectChanged(); + emit screenAdded(m_screenPool->id(screen->name())); } void DockCorona::primaryOutputChanged() diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index d99c19471..58d1216a0 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -676,7 +676,7 @@ Item { id: tasksModel virtualDesktop: virtualDesktopInfo.currentDesktop - screenGeometry: latteDock ? latteDock.screenGeometry : plasmoid.screenGeometry + screenGeometry: plasmoid.screenGeometry // comment in order to support LTS Plasma 5.8 // screen: plasmoid.screen activity: activityInfo.currentActivity