Restrict when to expose a ShellClient to PlasmaWindowManagement

Summary:
For some windows we don't want to create a PlasmaWindow. Not all
ShellClients are something the outside world should see. This change
introduces the first restrictions:
* KWin internal windows are hidden
* transients not accepting focus are hidden

The latter case doesn't work though if the Surface is mapped prior
to creating the shell surface. In such a situation it's racy as KWin
handles the create surface request before we get the setTransient
request. This is difficult to handle as we do want to react quickly.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1759
icc-effect-5.14.5
Martin Gräßlin 2016-06-03 13:37:24 +02:00
parent 6cae5f7ab9
commit 5d396add12
3 changed files with 21 additions and 5 deletions

View File

@ -279,7 +279,6 @@ void PlasmaWindowTest::testInternalWindowNoPlasmaWindow()
win.setGeometry(0, 0, 100, 100);
win.show();
QEXPECT_FAIL("", "Internal windows still exposed", Continue);
QVERIFY(!plasmaWindowCreatedSpy.wait());
}
@ -311,7 +310,6 @@ void PlasmaWindowTest::testPopupWindowNoPlasmaWindow()
popupSurface->commit();
// this should not create a plasma window
QEXPECT_FAIL("", "Popup windows are still exposed", Continue);
QVERIFY(!plasmaWindowCreatedSpy.wait());
// now the same with an already mapped surface when we create the shell surface
@ -323,7 +321,7 @@ void PlasmaWindowTest::testPopupWindowNoPlasmaWindow()
popup2ShellSurface->setTransient(popupSurface.data(), QPoint(0, 0), ShellSurface::TransientFlag::NoFocus);
// this should not create a plasma window
QEXPECT_FAIL("", "Popup windows are still exposed", Continue);
QEXPECT_FAIL("", "The call to setTransient comes to late the window is already mapped then", Continue);
QVERIFY(!plasmaWindowCreatedSpy.wait());
}

View File

@ -72,7 +72,9 @@ void ShellClient::init()
Q_ASSERT(s);
if (s->buffer()) {
setReadyForPainting();
setupWindowManagementInterface();
if (shouldExposeToWindowManagement()) {
setupWindowManagementInterface();
}
m_unmapped = false;
m_clientSize = s->buffer()->size();
} else {
@ -331,7 +333,9 @@ void ShellClient::markAsMapped()
m_unmapped = false;
setReadyForPainting();
setupWindowManagementInterface();
if (shouldExposeToWindowManagement()) {
setupWindowManagementInterface();
}
}
void ShellClient::createDecoration(const QRect &oldGeom)
@ -1009,4 +1013,17 @@ void ShellClient::installServerSideDecoration(KWayland::Server::ServerSideDecora
);
}
bool ShellClient::shouldExposeToWindowManagement()
{
if (isInternal()) {
return false;
}
if (m_shellSurface) {
if (m_shellSurface->isTransient() && !m_shellSurface->acceptsKeyboardFocus()) {
return false;
}
}
return true;
}
}

View File

@ -149,6 +149,7 @@ private:
void updateIcon();
void markAsMapped();
void setTransient();
bool shouldExposeToWindowManagement();
static void deleteClient(ShellClient *c);
KWayland::Server::ShellSurfaceInterface *m_shellSurface;