Changeset View
Changeset View
Standalone View
Standalone View
shell/shellcorona.cpp
Show First 20 Lines • Show All 1143 Lines • ▼ Show 20 Line(s) | 1132 | { | |||
---|---|---|---|---|---|
1144 | 1144 | | |||
1145 | int insertPosition = m_screenPool->id(screen->name()); | 1145 | int insertPosition = m_screenPool->id(screen->name()); | ||
1146 | if (insertPosition < 0) { | 1146 | if (insertPosition < 0) { | ||
1147 | insertPosition = m_screenPool->firstAvailableId(); | 1147 | insertPosition = m_screenPool->firstAvailableId(); | ||
1148 | } | 1148 | } | ||
1149 | 1149 | | |||
1150 | DesktopView *view = new DesktopView(this, screen); | 1150 | DesktopView *view = new DesktopView(this, screen); | ||
1151 | connect(view, &QQuickWindow::sceneGraphError, this, &ShellCorona::showOpenGLNotCompatibleWarning); | 1151 | connect(view, &QQuickWindow::sceneGraphError, this, &ShellCorona::showOpenGLNotCompatibleWarning); | ||
1152 | // a particular edge case: when we switch the only enabled screen | ||||
1153 | // we don't have any signal about it, the primary screen changes but we have the same old QScreen* getting recycled | ||||
1154 | // see https://bugs.kde.org/show_bug.cgi?id=373880 | ||||
1155 | // if this slot will be invoked many times, their//second time on will do nothing as name and primaryconnector will be the same by then | ||||
1156 | connect(view, &DesktopView::screenRenamed, this, [=](){ | ||||
1157 | if (qGuiApp->primaryScreen()->name() != m_screenPool->primaryConnector()) { | ||||
1158 | //new screen? | ||||
1159 | if (m_screenPool->id(qGuiApp->primaryScreen()->name()) < 0) { | ||||
1160 | m_screenPool->insertScreenMapping(m_screenPool->firstAvailableId(), qGuiApp->primaryScreen()->name()); | ||||
1161 | } | ||||
1162 | //switch the primary screen in the pool | ||||
1163 | m_screenPool->setPrimaryConnector(qGuiApp->primaryScreen()->name()); | ||||
1164 | } | ||||
1165 | }); | ||||
1152 | 1166 | | |||
1153 | Plasma::Containment *containment = createContainmentForActivity(m_activityController->currentActivity(), insertPosition); | 1167 | Plasma::Containment *containment = createContainmentForActivity(m_activityController->currentActivity(), insertPosition); | ||
1154 | Q_ASSERT(containment); | 1168 | Q_ASSERT(containment); | ||
1155 | 1169 | | |||
1156 | QAction *removeAction = containment->actions()->action(QStringLiteral("remove")); | 1170 | QAction *removeAction = containment->actions()->action(QStringLiteral("remove")); | ||
1157 | if (removeAction) { | 1171 | if (removeAction) { | ||
1158 | removeAction->deleteLater(); | 1172 | removeAction->deleteLater(); | ||
1159 | } | 1173 | } | ||
▲ Show 20 Lines • Show All 867 Lines • Show Last 20 Lines |