diff --git a/shell/shellcorona.h b/shell/shellcorona.h --- a/shell/shellcorona.h +++ b/shell/shellcorona.h @@ -203,7 +203,7 @@ void desktopContainmentDestroyed(QObject*); void showOpenGLNotCompatibleWarning(); void interactiveConsoleVisibilityChanged(bool visible); - void screenRemoved(QScreen* screen); + void handleScreenRemoved(QScreen* screen); void activateTaskManagerEntry(int index); diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -699,7 +699,7 @@ } connect(qGuiApp, &QGuiApplication::screenAdded, this, &ShellCorona::addOutput, Qt::UniqueConnection); connect(qGuiApp, &QGuiApplication::primaryScreenChanged, this, &ShellCorona::primaryOutputChanged, Qt::UniqueConnection); - connect(qGuiApp, &QGuiApplication::screenRemoved, this, &ShellCorona::screenRemoved, Qt::UniqueConnection); + connect(qGuiApp, &QGuiApplication::screenRemoved, this, &ShellCorona::handleScreenRemoved, Qt::UniqueConnection); if (!m_waitingPanels.isEmpty()) { m_waitingPanelsTimer.start(); @@ -1067,6 +1067,8 @@ Q_ASSERT(m_desktopViewforId.value(idx) == desktopView); m_desktopViewforId.remove(idx); delete desktopView; + + emit screenRemoved(idx); } PanelView *ShellCorona::panelView(Plasma::Containment *containment) const @@ -1092,7 +1094,7 @@ return m_desktopViewforId.value(m_screenPool->id(screen->name())); } -void ShellCorona::screenRemoved(QScreen* screen) +void ShellCorona::handleScreenRemoved(QScreen* screen) { if (DesktopView* v = desktopForScreen(screen)) { removeDesktop(v); @@ -1156,8 +1158,9 @@ } else if (isOutputRedundant(screen)) { qDebug() << "new redundant screen" << screen << "with primary screen" << qGuiApp->primaryScreen(); - if (DesktopView* v = desktopForScreen(screen)) + if (DesktopView* v = desktopForScreen(screen)) { removeDesktop(v); + } m_redundantOutputs.insert(screen); } @@ -1224,6 +1227,7 @@ } emit availableScreenRectChanged(); + emit screenAdded(m_screenPool->id(screen->name())); CHECK_SCREEN_INVARIANTS }