revert the hackish overriding of Client::desktop() for session saving
The member variable is not what determines which desktop a window is on, it's more like caching the state. Therefore trying to fake a new value eventually leads to inconsistencies, e.g. having KWrite open with unsaved changes on inactive desktop results in the window ending up on all desktops after session save (both successful and cancelled). This pretty much reverts the whole7ce380497f
that introduced this and alsoa0a976885c
that tried to fix some of the problems resulting from it. The original problem of session saving of windows of inactive activities still remains, to be fixed by another commit. Differential Revision: https://phabricator.kde.org/D5613
This commit is contained in:
parent
a2d19c6b9d
commit
f4de9618f8
4 changed files with 10 additions and 45 deletions
14
client.cpp
14
client.cpp
|
@ -1319,20 +1319,6 @@ void Client::updateActivities(bool includeTransients)
|
|||
tabGroup()->updateStates(this, TabGroup::Activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the virtual desktop within the workspace() the client window
|
||||
* is located in, 0 if it isn't located on any special desktop (not mapped yet),
|
||||
* or NET::OnAllDesktops. Do not use desktop() directly, use
|
||||
* isOnDesktop() instead.
|
||||
*/
|
||||
int Client::desktop() const
|
||||
{
|
||||
if (needsSessionInteract) {
|
||||
return NET::OnAllDesktops;
|
||||
}
|
||||
return AbstractClient::desktop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of activities the client window is on.
|
||||
* if it's on all activities, the list will be empty.
|
||||
|
|
2
client.h
2
client.h
|
@ -132,8 +132,6 @@ public:
|
|||
void releaseWindow(bool on_shutdown = false);
|
||||
void destroyClient();
|
||||
|
||||
virtual int desktop() const;
|
||||
|
||||
virtual QStringList activities() const;
|
||||
void setOnActivity(const QString &activity, bool enable);
|
||||
void setOnAllActivities(bool set) override;
|
||||
|
|
33
manage.cpp
33
manage.cpp
|
@ -596,35 +596,10 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
|||
else
|
||||
allow = workspace()->allowClientActivation(this, userTime(), false);
|
||||
|
||||
if (!(isMapped || session)) {
|
||||
if (workspace()->sessionSaving()) {
|
||||
/*
|
||||
* If we get a new window during session saving, we assume it's some 'save file?' dialog
|
||||
* which the user really needs to see (to know why logout's stalled).
|
||||
*
|
||||
* Given the current session management protocol, I can't see a nicer way of doing this.
|
||||
* Someday I'd like to see a protocol that tells the windowmanager who's doing SessionInteract.
|
||||
*/
|
||||
needsSessionInteract = true;
|
||||
//show the parent too
|
||||
auto mainclients = mainClients();
|
||||
for (auto it = mainclients.constBegin();
|
||||
it != mainclients.constEnd(); ++it) {
|
||||
if (Client *mc = dynamic_cast<Client*>((*it))) {
|
||||
mc->setSessionInteract(true);
|
||||
}
|
||||
(*it)->unminimize();
|
||||
}
|
||||
} else if (allow) {
|
||||
// also force if activation is allowed
|
||||
if (!isOnCurrentDesktop() && options->focusPolicyIsReasonable()) {
|
||||
VirtualDesktopManager::self()->setCurrent(desktop());
|
||||
}
|
||||
/*if (!isOnCurrentActivity()) {
|
||||
workspace()->setCurrentActivity( activities().first() );
|
||||
} FIXME no such method*/
|
||||
}
|
||||
}
|
||||
// If session saving, force showing new windows (i.e. "save file?" dialogs etc.)
|
||||
// also force if activation is allowed
|
||||
if( !isOnCurrentDesktop() && !isMapped && !session && ( allow || workspace()->sessionSaving() ))
|
||||
VirtualDesktopManager::self()->setCurrent( desktop());
|
||||
|
||||
if (isOnCurrentDesktop() && !isMapped && !allow && (!session || session->stackingOrder < 0))
|
||||
workspace()->restackClientUnderActive(this);
|
||||
|
|
|
@ -272,6 +272,12 @@ public:
|
|||
virtual bool isLockScreen() const;
|
||||
virtual bool isInputMethod() const;
|
||||
|
||||
/**
|
||||
* Returns the virtual desktop within the workspace() the client window
|
||||
* is located in, 0 if it isn't located on any special desktop (not mapped yet),
|
||||
* or NET::OnAllDesktops. Do not use desktop() directly, use
|
||||
* isOnDesktop() instead.
|
||||
*/
|
||||
virtual int desktop() const = 0;
|
||||
virtual QStringList activities() const = 0;
|
||||
bool isOnDesktop(int d) const;
|
||||
|
|
Loading…
Reference in a new issue