Changeset View
Changeset View
Standalone View
Standalone View
shell/shellcorona.cpp
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 73 | #ifndef NDEBUG | |||
---|---|---|---|---|---|
74 | #define CHECK_SCREEN_INVARIANTS screenInvariants(); | 74 | #define CHECK_SCREEN_INVARIANTS screenInvariants(); | ||
75 | #else | 75 | #else | ||
76 | #define CHECK_SCREEN_INVARIANTS | 76 | #define CHECK_SCREEN_INVARIANTS | ||
77 | #endif | 77 | #endif | ||
78 | 78 | | |||
79 | #if HAVE_X11 | 79 | #if HAVE_X11 | ||
80 | #include <NETWM> | 80 | #include <NETWM> | ||
81 | #include <QtX11Extras/QX11Info> | 81 | #include <QtX11Extras/QX11Info> | ||
82 | #include <xcb/xcb.h> | ||||
82 | #endif | 83 | #endif | ||
83 | 84 | | |||
84 | 85 | | |||
85 | static const int s_configSyncDelay = 10000; // 10 seconds | 86 | static const int s_configSyncDelay = 10000; // 10 seconds | ||
86 | 87 | | |||
87 | ShellCorona::ShellCorona(QObject *parent) | 88 | ShellCorona::ShellCorona(QObject *parent) | ||
88 | : Plasma::Corona(parent), | 89 | : Plasma::Corona(parent), | ||
89 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | 90 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | ||
▲ Show 20 Lines • Show All 1049 Lines • ▼ Show 20 Line(s) | 1128 | { | |||
1139 | 1140 | | |||
1140 | int insertPosition = m_screenPool->id(screen->name()); | 1141 | int insertPosition = m_screenPool->id(screen->name()); | ||
1141 | if (insertPosition < 0) { | 1142 | if (insertPosition < 0) { | ||
1142 | insertPosition = m_screenPool->firstAvailableId(); | 1143 | insertPosition = m_screenPool->firstAvailableId(); | ||
1143 | } | 1144 | } | ||
1144 | 1145 | | |||
1145 | DesktopView *view = new DesktopView(this, screen); | 1146 | DesktopView *view = new DesktopView(this, screen); | ||
1146 | connect(view, &QQuickWindow::sceneGraphError, this, &ShellCorona::showOpenGLNotCompatibleWarning); | 1147 | connect(view, &QQuickWindow::sceneGraphError, this, &ShellCorona::showOpenGLNotCompatibleWarning); | ||
1147 | // a particular edge case: when we switch the only enabled screen | | |||
1148 | // we don't have any signal about it, the primary screen changes but we have the same old QScreen* getting recycled | | |||
1149 | // see https://bugs.kde.org/show_bug.cgi?id=373880 | | |||
1150 | // 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 | | |||
1151 | connect(view, &DesktopView::screenRenamed, this, [=](){ | | |||
1152 | if (qGuiApp->primaryScreen()->name() != m_screenPool->primaryConnector()) { | | |||
1153 | //new screen? | | |||
1154 | if (m_screenPool->id(qGuiApp->primaryScreen()->name()) < 0) { | | |||
1155 | m_screenPool->insertScreenMapping(m_screenPool->firstAvailableId(), qGuiApp->primaryScreen()->name()); | | |||
1156 | } | | |||
1157 | //switch the primary screen in the pool | | |||
1158 | m_screenPool->setPrimaryConnector(qGuiApp->primaryScreen()->name()); | | |||
1159 | } | | |||
1160 | }); | | |||
1161 | 1148 | | |||
1162 | Plasma::Containment *containment = createContainmentForActivity(m_activityController->currentActivity(), insertPosition); | 1149 | Plasma::Containment *containment = createContainmentForActivity(m_activityController->currentActivity(), insertPosition); | ||
1163 | Q_ASSERT(containment); | 1150 | Q_ASSERT(containment); | ||
1164 | 1151 | | |||
1165 | QAction *removeAction = containment->actions()->action(QStringLiteral("remove")); | 1152 | QAction *removeAction = containment->actions()->action(QStringLiteral("remove")); | ||
1166 | if (removeAction) { | 1153 | if (removeAction) { | ||
1167 | removeAction->deleteLater(); | 1154 | removeAction->deleteLater(); | ||
1168 | } | 1155 | } | ||
▲ Show 20 Lines • Show All 925 Lines • Show Last 20 Lines |