Remove saving and loading (and client matching by) WM_COMMAND.

This legacy session management scheme using the WM_COMMAND property
seems to be called XSM. It is very, very legacy because it was
superseded by XSMP in 1993(!).

By inspecting ~/.config/session/kwin_[...] I could see that Firefox
still sets WM_COMMAND, but nothing else in a regular session with
some applications.
As one of the last applications to switch to XSMP session management,
I guess Firefox keeps doing that because it still needs to work on,
say, Solaris, anyway, so why not set WM_COMMAND on Linux as well.
The WM_COMMAND set by Firefox looks like "wmCommand8=firefox\s" in
the kwin session file. It doesn't actually contain a session
identifier. But then, Firefox only has one session per user anyway.

This goes together with commit 5f0ca1305db4a925 in plasma-workspace /
ksmserver to remove legacy session management support.

I've talked about my plan to do this on IRC with Martin so hopefully
it's okay to just do this now.
This commit is contained in:
Andreas Hartmetz 2016-01-09 03:33:55 +01:00
parent 3e255e6969
commit 2eac7634cc
5 changed files with 5 additions and 33 deletions

View file

@ -169,7 +169,7 @@ void Activities::reallyStop(const QString &id)
const Client* c = (*it); const Client* c = (*it);
const QByteArray sessionId = c->sessionId(); const QByteArray sessionId = c->sessionId();
if (sessionId.isEmpty()) { if (sessionId.isEmpty()) {
continue; //TODO support old wm_command apps too? continue;
} }
//qDebug() << sessionId; //qDebug() << sessionId;

21
sm.cpp
View file

@ -109,12 +109,8 @@ void Workspace::storeSession(KConfig* config, SMSavePhase phase)
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) { for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
Client* c = (*it); Client* c = (*it);
QByteArray sessionId = c->sessionId(); QByteArray sessionId = c->sessionId();
QByteArray wmCommand = c->wmCommand();
if (sessionId.isEmpty()) if (sessionId.isEmpty())
// remember also applications that are not XSMP capable continue;
// and use the obsolete WM_COMMAND / WM_SAVE_YOURSELF
if (wmCommand.isEmpty())
continue;
count++; count++;
if (c->isActive()) if (c->isActive())
active_client = count; active_client = count;
@ -144,7 +140,6 @@ void Workspace::storeClient(KConfigGroup &cg, int num, Client *c)
QString n = QString::number(num); QString n = QString::number(num);
cg.writeEntry(QLatin1String("sessionId") + n, c->sessionId().constData()); cg.writeEntry(QLatin1String("sessionId") + n, c->sessionId().constData());
cg.writeEntry(QLatin1String("windowRole") + n, c->windowRole().constData()); cg.writeEntry(QLatin1String("windowRole") + n, c->windowRole().constData());
cg.writeEntry(QLatin1String("wmCommand") + n, c->wmCommand().constData());
cg.writeEntry(QLatin1String("resourceName") + n, c->resourceName().constData()); cg.writeEntry(QLatin1String("resourceName") + n, c->resourceName().constData());
cg.writeEntry(QLatin1String("resourceClass") + n, c->resourceClass().constData()); cg.writeEntry(QLatin1String("resourceClass") + n, c->resourceClass().constData());
cg.writeEntry(QLatin1String("geometry") + n, QRect(c->calculateGravitation(true), c->clientSize())); // FRAME cg.writeEntry(QLatin1String("geometry") + n, QRect(c->calculateGravitation(true), c->clientSize())); // FRAME
@ -185,12 +180,8 @@ void Workspace::storeSubSession(const QString &name, QSet<QByteArray> sessionIds
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) { for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
Client* c = (*it); Client* c = (*it);
QByteArray sessionId = c->sessionId(); QByteArray sessionId = c->sessionId();
QByteArray wmCommand = c->wmCommand();
if (sessionId.isEmpty()) if (sessionId.isEmpty())
// remember also applications that are not XSMP capable continue;
// and use the obsolete WM_COMMAND / WM_SAVE_YOURSELF
if (wmCommand.isEmpty())
continue;
if (!sessionIds.contains(sessionId)) if (!sessionIds.contains(sessionId))
continue; continue;
@ -230,7 +221,6 @@ void Workspace::addSessionInfo(KConfigGroup &cg)
session.append(info); session.append(info);
info->sessionId = cg.readEntry(QLatin1String("sessionId") + n, QString()).toLatin1(); info->sessionId = cg.readEntry(QLatin1String("sessionId") + n, QString()).toLatin1();
info->windowRole = cg.readEntry(QLatin1String("windowRole") + n, QString()).toLatin1(); info->windowRole = cg.readEntry(QLatin1String("windowRole") + n, QString()).toLatin1();
info->wmCommand = cg.readEntry(QLatin1String("wmCommand") + n, QString()).toLatin1();
info->resourceName = cg.readEntry(QLatin1String("resourceName") + n, QString()).toLatin1(); info->resourceName = cg.readEntry(QLatin1String("resourceName") + n, QString()).toLatin1();
info->resourceClass = cg.readEntry(QLatin1String("resourceClass") + n, QString()).toLower().toLatin1(); info->resourceClass = cg.readEntry(QLatin1String("resourceClass") + n, QString()).toLower().toLatin1();
info->geometry = cg.readEntry(QLatin1String("geometry") + n, QRect()); info->geometry = cg.readEntry(QLatin1String("geometry") + n, QRect());
@ -279,7 +269,6 @@ SessionInfo* Workspace::takeSessionInfo(Client* c)
SessionInfo *realInfo = 0; SessionInfo *realInfo = 0;
QByteArray sessionId = c->sessionId(); QByteArray sessionId = c->sessionId();
QByteArray windowRole = c->windowRole(); QByteArray windowRole = c->windowRole();
QByteArray wmCommand = c->wmCommand();
QByteArray resourceName = c->resourceName(); QByteArray resourceName = c->resourceName();
QByteArray resourceClass = c->resourceClass(); QByteArray resourceClass = c->resourceClass();
@ -313,10 +302,8 @@ SessionInfo* Workspace::takeSessionInfo(Client* c)
if (info->resourceName == resourceName if (info->resourceName == resourceName
&& info->resourceClass == resourceClass && info->resourceClass == resourceClass
&& sessionInfoWindowTypeMatch(c, info)) { && sessionInfoWindowTypeMatch(c, info)) {
if (wmCommand.isEmpty() || info->wmCommand == wmCommand) { realInfo = info;
realInfo = info; session.removeAll(info);
session.removeAll(info);
}
} }
} }
} }

1
sm.h
View file

@ -41,7 +41,6 @@ class Client;
struct SessionInfo { struct SessionInfo {
QByteArray sessionId; QByteArray sessionId;
QByteArray windowRole; QByteArray windowRole;
QByteArray wmCommand;
QByteArray wmClientMachine; QByteArray wmClientMachine;
QByteArray resourceName; QByteArray resourceName;
QByteArray resourceClass; QByteArray resourceClass;

View file

@ -177,19 +177,6 @@ QByteArray Toplevel::sessionId() const
return result; return result;
} }
/*!
Returns command property for this client,
taken either from its window or from the leader window.
*/
QByteArray Toplevel::wmCommand()
{
QByteArray result = Xcb::StringProperty(window(), XCB_ATOM_WM_COMMAND);
if (result.isEmpty() && wmClientLeaderWin && wmClientLeaderWin != window())
result = Xcb::StringProperty(wmClientLeaderWin, XCB_ATOM_WM_COMMAND);
result.replace(0, ' ');
return result;
}
void Toplevel::getWmClientMachine() void Toplevel::getWmClientMachine()
{ {
m_clientMachine->resolve(window(), wmClientLeader()); m_clientMachine->resolve(window(), wmClientLeader());

View file

@ -274,7 +274,6 @@ public:
QByteArray sessionId() const; QByteArray sessionId() const;
QByteArray resourceName() const; QByteArray resourceName() const;
QByteArray resourceClass() const; QByteArray resourceClass() const;
QByteArray wmCommand();
QByteArray wmClientMachine(bool use_localhost) const; QByteArray wmClientMachine(bool use_localhost) const;
const ClientMachine *clientMachine() const; const ClientMachine *clientMachine() const;
Window wmClientLeader() const; Window wmClientLeader() const;