fix showing of window on inactive activities during session save

This is what 7ce380497f tried to do (and got reverted by my previous commit).
The approach is basically the same, just temporarily fake that the window
is on all activities, thus it will be temporarily shown for the session
interact, but this time there seem to be no broken side-effects (and if there
are, they'll be at least limited to activities and not break virtual desktops).
Also, 'needsSessionInteract' was a misnomer - it certainly wasn't set for all
windows that needed session interaction. Just call it what it really is.

Differential Revision: https://phabricator.kde.org/D5614
icc-effect-5.14.5
Luboš Luňák 2017-04-27 12:18:41 +02:00
parent f4de9618f8
commit 750843061c
4 changed files with 20 additions and 10 deletions

View File

@ -120,7 +120,7 @@ Client::Client()
, shade_geometry_change(false)
, sm_stacking_order(-1)
, activitiesDefined(false)
, needsSessionInteract(false)
, sessionActivityOverride(false)
, needsXWindowMove(false)
, m_decoInputExtent()
, m_focusOutTimer(nullptr)
@ -1326,7 +1326,7 @@ void Client::updateActivities(bool includeTransients)
*/
QStringList Client::activities() const
{
if (needsSessionInteract) {
if (sessionActivityOverride) {
return QStringList();
}
return activityList;
@ -1959,9 +1959,10 @@ void Client::checkActivities()
#endif
}
void Client::setSessionInteract(bool needed)
void Client::setSessionActivityOverride(bool needed)
{
needsSessionInteract = needed;
sessionActivityOverride = needed;
updateActivities(false);
}
QRect Client::decorationRect() const

View File

@ -314,8 +314,8 @@ public:
void readColorScheme(Xcb::StringProperty &property);
void updateColorScheme();
//sets whether the client should be treated as a SessionInteract window
void setSessionInteract(bool needed);
//sets whether the client should be faked as being on all activities (and be shown during session save)
void setSessionActivityOverride(bool needed);
virtual bool isClient() const;
template <typename T>
@ -590,7 +590,7 @@ private:
void checkActivities();
bool activitiesDefined; //whether the x property was actually set
bool needsSessionInteract;
bool sessionActivityOverride;
bool needsXWindowMove;
Xcb::Window m_decoInputExtent;

View File

@ -601,6 +601,16 @@ bool Client::manage(xcb_window_t w, bool isMapped)
if( !isOnCurrentDesktop() && !isMapped && !session && ( allow || workspace()->sessionSaving() ))
VirtualDesktopManager::self()->setCurrent( desktop());
// If the window is on an inactive activity during session saving, temporarily force it to show.
if( !isMapped && !session && workspace()->sessionSaving() && !isOnCurrentActivity()) {
setSessionActivityOverride( true );
foreach( AbstractClient* c, mainClients()) {
if (Client *mc = dynamic_cast<Client*>(c)) {
mc->setSessionActivityOverride(true);
}
}
}
if (isOnCurrentDesktop() && !isMapped && !allow && (!session || session->stackingOrder < 0))
workspace()->restackClientUnderActive(this);

5
sm.cpp
View File

@ -140,7 +140,7 @@ void Workspace::storeSession(KConfig* config, SMSavePhase phase)
void Workspace::storeClient(KConfigGroup &cg, int num, Client *c)
{
c->setSessionInteract(false); //make sure we get the real values
c->setSessionActivityOverride(false); //make sure we get the real values
QString n = QString::number(num);
cg.writeEntry(QLatin1String("sessionId") + n, c->sessionId().constData());
cg.writeEntry(QLatin1String("windowRole") + n, c->windowRole().constData());
@ -519,9 +519,8 @@ void SessionSaveDoneHelper::processData()
void Workspace::sessionSaveDone()
{
session_saving = false;
//remove sessionInteract flag from all clients
foreach (Client * c, clients) {
c->setSessionInteract(false);
c->setSessionActivityOverride(false);
}
}