[platforms/x11] Support output removal in nested setup

Summary:
When closing a nested window kwin_wayland only terminates if the closed
window is the last output window. In a simulated multi-screen setup
closing a window results in the output being removed.

Test Plan: Closed windows, verified with xrandr

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2234
This commit is contained in:
Martin Gräßlin 2016-07-20 13:33:54 +02:00
parent e88a709f03
commit a902ba8ea3

View file

@ -303,8 +303,26 @@ void X11WindowedBackend::handleClientMessage(xcb_client_message_event_t *event)
}
if (event->type == m_protocols && m_protocols != XCB_ATOM_NONE) {
if (event->data.data32[0] == m_deleteWindowProtocol && m_deleteWindowProtocol != XCB_ATOM_NONE) {
qCDebug(KWIN_X11WINDOWED) << "Backend window is going to be closed, shutting down.";
QCoreApplication::quit();
if (m_windows.count() == 1) {
qCDebug(KWIN_X11WINDOWED) << "Backend window is going to be closed, shutting down.";
QCoreApplication::quit();
} else {
// remove the window
qCDebug(KWIN_X11WINDOWED) << "Removing one output window.";
auto o = *it;
it = m_windows.erase(it);
xcb_unmap_window(m_connection, o.window);
xcb_destroy_window(m_connection, o.window);
delete o.winInfo;
// update the sizes
int x = o.internalPosition.x();
for (; it != m_windows.end(); ++it) {
(*it).internalPosition.setX(x);
x += (*it).size.width();
}
QMetaObject::invokeMethod(screens(), "updateCount");
}
}
}
}