Changeset View
Changeset View
Standalone View
Standalone View
workspace.cpp
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Line(s) | 145 | #endif | |||
---|---|---|---|---|---|
160 | RuleBook::create(this)->load(); | 160 | RuleBook::create(this)->load(); | ||
161 | 161 | | |||
162 | ScreenEdges::create(this); | 162 | ScreenEdges::create(this); | ||
163 | 163 | | |||
164 | // VirtualDesktopManager needs to be created prior to init shortcuts | 164 | // VirtualDesktopManager needs to be created prior to init shortcuts | ||
165 | // and prior to TabBox, due to TabBox connecting to signals | 165 | // and prior to TabBox, due to TabBox connecting to signals | ||
166 | // actual initialization happens in init() | 166 | // actual initialization happens in init() | ||
167 | VirtualDesktopManager::create(this); | 167 | VirtualDesktopManager::create(this); | ||
168 | //dbus interface | ||||
169 | new VirtualDesktopManagerDBusInterface(VirtualDesktopManager::self()); | ||||
168 | 170 | | |||
169 | #ifdef KWIN_BUILD_TABBOX | 171 | #ifdef KWIN_BUILD_TABBOX | ||
170 | // need to create the tabbox before compositing scene is setup | 172 | // need to create the tabbox before compositing scene is setup | ||
171 | TabBox::TabBox::create(this); | 173 | TabBox::TabBox::create(this); | ||
172 | #endif | 174 | #endif | ||
173 | 175 | | |||
174 | if (Compositor::self()) { | 176 | if (Compositor::self()) { | ||
175 | m_compositor = Compositor::self(); | 177 | m_compositor = Compositor::self(); | ||
Show All 38 Lines | 198 | { | |||
214 | connect(this, &Workspace::clientActivated, focusChain, &FocusChain::setActiveClient); | 216 | connect(this, &Workspace::clientActivated, focusChain, &FocusChain::setActiveClient); | ||
215 | connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), focusChain, SLOT(resize(uint,uint))); | 217 | connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), focusChain, SLOT(resize(uint,uint))); | ||
216 | connect(VirtualDesktopManager::self(), SIGNAL(currentChanged(uint,uint)), focusChain, SLOT(setCurrentDesktop(uint,uint))); | 218 | connect(VirtualDesktopManager::self(), SIGNAL(currentChanged(uint,uint)), focusChain, SLOT(setCurrentDesktop(uint,uint))); | ||
217 | connect(options, SIGNAL(separateScreenFocusChanged(bool)), focusChain, SLOT(setSeparateScreenFocus(bool))); | 219 | connect(options, SIGNAL(separateScreenFocusChanged(bool)), focusChain, SLOT(setSeparateScreenFocus(bool))); | ||
218 | focusChain->setSeparateScreenFocus(options->isSeparateScreenFocus()); | 220 | focusChain->setSeparateScreenFocus(options->isSeparateScreenFocus()); | ||
219 | 221 | | |||
220 | // create VirtualDesktopManager and perform dependency injection | 222 | // create VirtualDesktopManager and perform dependency injection | ||
221 | VirtualDesktopManager *vds = VirtualDesktopManager::self(); | 223 | VirtualDesktopManager *vds = VirtualDesktopManager::self(); | ||
222 | connect(vds, SIGNAL(desktopsRemoved(uint)), SLOT(moveClientsFromRemovedDesktops())); | 224 | connect(vds, &VirtualDesktopManager::desktopRemoved, this, | ||
225 | [this](KWin::VirtualDesktop *desktop) { | ||||
226 | //Wayland | ||||
227 | if (kwinApp()->operationMode() == Application::OperationModeWaylandOnly || | ||||
graesslin: Checking for Wayland server is not the way to check whether we are on Wayland | |||||
228 | kwinApp()->operationMode() == Application::OperationModeXwayland) { | ||||
229 | for (auto it = m_allClients.constBegin(); it != m_allClients.constEnd(); ++it) { | ||||
230 | const bool needsMove = (*it)->desktops().count() == 1; | ||||
231 | (*it)->removeDesktop(desktop); | ||||
232 | if (needsMove) { | ||||
233 | const VirtualDesktop *otherDesktop = VirtualDesktopManager::self()->desktops().first(); | ||||
234 | sendClientToDesktop(*it, qMin(desktop->x11DesktopNumber(), VirtualDesktopManager::self()->count()), true); | ||||
235 | } | ||||
236 | } | ||||
237 | //X11 | ||||
238 | } else { | ||||
239 | for (auto it = m_allClients.constBegin(); it != m_allClients.constEnd(); ++it) { | ||||
240 | if (!(*it)->isOnAllDesktops() && ((*it)->desktop() > static_cast<int>(VirtualDesktopManager::self()->count()))) { | ||||
241 | sendClientToDesktop(*it, VirtualDesktopManager::self()->count(), true); | ||||
242 | } | ||||
243 | } | ||||
244 | } | ||||
245 | } | ||||
246 | ); | ||||
247 | | ||||
223 | connect(vds, SIGNAL(countChanged(uint,uint)), SLOT(slotDesktopCountChanged(uint,uint))); | 248 | connect(vds, SIGNAL(countChanged(uint,uint)), SLOT(slotDesktopCountChanged(uint,uint))); | ||
224 | connect(vds, SIGNAL(currentChanged(uint,uint)), SLOT(slotCurrentDesktopChanged(uint,uint))); | 249 | connect(vds, SIGNAL(currentChanged(uint,uint)), SLOT(slotCurrentDesktopChanged(uint,uint))); | ||
225 | vds->setNavigationWrappingAround(options->isRollOverDesktops()); | 250 | vds->setNavigationWrappingAround(options->isRollOverDesktops()); | ||
226 | connect(options, SIGNAL(rollOverDesktopsChanged(bool)), vds, SLOT(setNavigationWrappingAround(bool))); | 251 | connect(options, SIGNAL(rollOverDesktopsChanged(bool)), vds, SLOT(setNavigationWrappingAround(bool))); | ||
227 | vds->setConfig(config); | 252 | vds->setConfig(config); | ||
228 | 253 | | |||
229 | // Now we know how many desktops we'll have, thus we initialize the positioning object | 254 | // Now we know how many desktops we'll have, thus we initialize the positioning object | ||
230 | Placement::create(this); | 255 | Placement::create(this); | ||
231 | 256 | | |||
232 | // positioning object needs to be created before the virtual desktops are loaded. | 257 | // positioning object needs to be created before the virtual desktops are loaded. | ||
233 | vds->load(); | 258 | vds->load(); | ||
234 | vds->updateLayout(); | 259 | vds->updateLayout(); | ||
260 | //makes sure any autogenerated id is saved, necessary as in case of xwayland, load will be called 2 times | ||||
261 | // load is needed to be called again when starting xwayalnd to sync to RootInfo, see BUG 385260 | ||||
262 | vds->save(); | ||||
235 | 263 | | |||
236 | if (!VirtualDesktopManager::self()->setCurrent(m_initialDesktop)) | 264 | if (!VirtualDesktopManager::self()->setCurrent(m_initialDesktop)) | ||
237 | VirtualDesktopManager::self()->setCurrent(1); | 265 | VirtualDesktopManager::self()->setCurrent(1); | ||
238 | 266 | | |||
239 | reconfigureTimer.setSingleShot(true); | 267 | reconfigureTimer.setSingleShot(true); | ||
240 | updateToolWindowsTimer.setSingleShot(true); | 268 | updateToolWindowsTimer.setSingleShot(true); | ||
241 | 269 | | |||
242 | connect(&reconfigureTimer, SIGNAL(timeout()), this, SLOT(slotReconfigure())); | 270 | connect(&reconfigureTimer, SIGNAL(timeout()), this, SLOT(slotReconfigure())); | ||
▲ Show 20 Lines • Show All 826 Lines • ▼ Show 20 Line(s) | 1019 | #ifdef KWIN_BUILD_ACTIVITIES | |||
1069 | // static_cast<EffectsHandlerImpl*>( effects )->desktopChanged( old_desktop ); | 1097 | // static_cast<EffectsHandlerImpl*>( effects )->desktopChanged( old_desktop ); | ||
1070 | if (compositing() && m_compositor) | 1098 | if (compositing() && m_compositor) | ||
1071 | m_compositor->addRepaintFull(); | 1099 | m_compositor->addRepaintFull(); | ||
1072 | #else | 1100 | #else | ||
1073 | Q_UNUSED(new_activity) | 1101 | Q_UNUSED(new_activity) | ||
1074 | #endif | 1102 | #endif | ||
1075 | } | 1103 | } | ||
1076 | 1104 | | |||
1077 | void Workspace::moveClientsFromRemovedDesktops() | | |||
1078 | { | | |||
1079 | for (auto it = m_allClients.constBegin(); it != m_allClients.constEnd(); ++it) { | | |||
1080 | if (!(*it)->isOnAllDesktops() && (*it)->desktop() > static_cast<int>(VirtualDesktopManager::self()->count())) | | |||
1081 | sendClientToDesktop(*it, VirtualDesktopManager::self()->count(), true); | | |||
1082 | } | | |||
1083 | } | | |||
1084 | | ||||
1085 | void Workspace::slotDesktopCountChanged(uint previousCount, uint newCount) | 1105 | void Workspace::slotDesktopCountChanged(uint previousCount, uint newCount) | ||
1086 | { | 1106 | { | ||
1087 | Q_UNUSED(previousCount) | 1107 | Q_UNUSED(previousCount) | ||
1088 | Placement::self()->reinitCascading(0); | 1108 | Placement::self()->reinitCascading(0); | ||
1089 | 1109 | | |||
1090 | resetClientAreas(newCount); | 1110 | resetClientAreas(newCount); | ||
1091 | } | 1111 | } | ||
1092 | 1112 | | |||
▲ Show 20 Lines • Show All 662 Lines • Show Last 20 Lines |
Checking for Wayland server is not the way to check whether we are on Wayland