Guard every remaining access to rootInfo

Summary:
For a future XFree KWin. Only remaining not guarded usages are in
Workspace::init, but that one needs to be refactored anyway for
becoming X free.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7173
This commit is contained in:
Martin Flöser 2017-08-07 06:57:37 +02:00
parent ddf3536f19
commit 8794fe548a
3 changed files with 27 additions and 13 deletions

View file

@ -70,10 +70,12 @@ extern bool is_multihead;
void Workspace::desktopResized()
{
QRect geom = screens()->geometry();
NETSize desktop_geometry;
desktop_geometry.width = geom.width();
desktop_geometry.height = geom.height();
rootInfo()->setDesktopGeometry(desktop_geometry);
if (rootInfo()) {
NETSize desktop_geometry;
desktop_geometry.width = geom.width();
desktop_geometry.height = geom.height();
rootInfo()->setDesktopGeometry(desktop_geometry);
}
updateClientArea();
saveOldScreenSizes(); // after updateClientArea(), so that one still uses the previous one
@ -309,13 +311,15 @@ void Workspace::updateClientArea(bool force)
oldrestrictedmovearea = restrictedmovearea;
restrictedmovearea = new_rmoveareas;
screenarea = new_sareas;
NETRect r;
for (int i = 1; i <= numberOfDesktops; i++) {
r.pos.x = workarea[ i ].x();
r.pos.y = workarea[ i ].y();
r.size.width = workarea[ i ].width();
r.size.height = workarea[ i ].height();
rootInfo()->setWorkArea(i, r);
if (rootInfo()) {
NETRect r;
for (int i = 1; i <= numberOfDesktops; i++) {
r.pos.x = workarea[ i ].x();
r.pos.y = workarea[ i ].y();
r.size.width = workarea[ i ].width();
r.size.height = workarea[ i ].height();
rootInfo()->setWorkArea(i, r);
}
}
for (auto it = m_allClients.constBegin();

View file

@ -151,6 +151,9 @@ void Workspace::updateStackingOrder(bool propagate_new_clients)
*/
void Workspace::stackScreenEdgesUnderOverrideRedirect()
{
if (!rootInfo()) {
return;
}
Xcb::restackWindows(QVector<xcb_window_t>() << rootInfo()->supportWindow() << ScreenEdges::self()->windows());
}
@ -160,6 +163,9 @@ void Workspace::stackScreenEdgesUnderOverrideRedirect()
*/
void Workspace::propagateClients(bool propagate_new_clients)
{
if (!rootInfo()) {
return;
}
// restack the windows according to the stacking order
// supportWindow > electric borders > clients > hidden clients
QVector<xcb_window_t> newWindowStack;

View file

@ -948,7 +948,9 @@ void Workspace::updateClientVisibilityOnDesktopChange(uint oldDesktop, uint newD
}
}
// Now propagate the change, after hiding, before showing
rootInfo()->setCurrentDesktop(VirtualDesktopManager::self()->current());
if (rootInfo()) {
rootInfo()->setCurrentDesktop(VirtualDesktopManager::self()->current());
}
if (movingClient && !movingClient->isOnDesktop(newDesktop)) {
movingClient->setDesktop(newDesktop);
@ -1246,7 +1248,9 @@ void Workspace::sendClientToScreen(AbstractClient* c, int screen)
void Workspace::sendPingToWindow(xcb_window_t window, xcb_timestamp_t timestamp)
{
rootInfo()->sendPing(window, timestamp);
if (rootInfo()) {
rootInfo()->sendPing(window, timestamp);
}
}
/**