Fix #72074 - when trying to close a window, update user timestamp
on the whole group, so that the possible 'close?' dialog has a recent timestamp even if the window about to be closed wasn't active. svn path=/trunk/kdebase/kwin/; revision=291859
This commit is contained in:
parent
6905d4530a
commit
96cc95943a
5 changed files with 28 additions and 14 deletions
|
@ -580,7 +580,7 @@ void Workspace::unfakeActivity( Client* c )
|
|||
externally, etc.).
|
||||
*/
|
||||
void Client::updateUserTime( Time time )
|
||||
{
|
||||
{ // copied in Group::updateUserTime
|
||||
if( time == CurrentTime )
|
||||
time = qt_x_time;
|
||||
if( time != -1U
|
||||
|
@ -637,10 +637,6 @@ Time Client::readUserTimeMapTimestamp( const KStartupInfoData* asn_data,
|
|||
|| ( asn_data->timestamp() != -1U
|
||||
&& timestampCompare( asn_data->timestamp(), time ) > 0 )))
|
||||
time = asn_data->timestamp();
|
||||
if( time == -1U
|
||||
|| ( group()->userTime() != -1U
|
||||
&& timestampCompare( time, group()->userTime()) > 0 ))
|
||||
time = group()->userTime();
|
||||
kdDebug( 1212 ) << "User timestamp, ASN:" << time << endl;
|
||||
if( time == -1U )
|
||||
{ // The window doesn't have any timestamp.
|
||||
|
@ -693,6 +689,16 @@ Time Client::readUserTimeMapTimestamp( const KStartupInfoData* asn_data,
|
|||
return time;
|
||||
}
|
||||
|
||||
Time Client::userTime() const
|
||||
{
|
||||
Time time = user_time;
|
||||
assert( group() != NULL );
|
||||
if( time == -1U
|
||||
|| ( group()->userTime() != -1U
|
||||
&& timestampCompare( group()->userTime(), time ) > 0 ))
|
||||
time = group()->userTime();
|
||||
return time;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the client's active state to \a act.
|
||||
|
@ -777,4 +783,14 @@ void Group::startupIdChanged()
|
|||
user_time = asn_data.timestamp();
|
||||
}
|
||||
|
||||
void Group::updateUserTime( Time time )
|
||||
{ // copy of Client::updateUserTime
|
||||
if( time == CurrentTime )
|
||||
time = qt_x_time;
|
||||
if( time != -1U
|
||||
&& ( user_time == CurrentTime
|
||||
|| timestampCompare( time, user_time ) > 0 )) // time > user_time
|
||||
user_time = time;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -903,6 +903,11 @@ void Client::closeWindow()
|
|||
{
|
||||
if( !isCloseable())
|
||||
return;
|
||||
// Update user time, needed for whole group, because the window may create a confirming dialog,
|
||||
// and this window's user time wouldn't apply to it
|
||||
// This is needed even for apps without support for user timestamp (e.g. nedit), so updating
|
||||
// user timestamp in apps on WM_DELETE_WINDOW is not an option (and I'm not sure if it would be right)
|
||||
group()->updateUserTime();
|
||||
if ( Pdeletewindow )
|
||||
{
|
||||
Notify::raise( Notify::Close );
|
||||
|
|
8
client.h
8
client.h
|
@ -735,14 +735,6 @@ inline bool Client::isManaged() const
|
|||
return mapping_state != WithdrawnState;
|
||||
}
|
||||
|
||||
inline
|
||||
Time Client::userTime() const
|
||||
{
|
||||
assert( user_time != CurrentTime );
|
||||
assert( user_time != -1U );
|
||||
return user_time;
|
||||
}
|
||||
|
||||
inline QCString Client::windowRole() const
|
||||
{
|
||||
return window_role;
|
||||
|
|
1
group.h
1
group.h
|
@ -39,6 +39,7 @@ class Group
|
|||
void lostLeader();
|
||||
Workspace* workspace();
|
||||
bool groupEvent( XEvent* e );
|
||||
void updateUserTime( Time time = CurrentTime );
|
||||
Time userTime() const;
|
||||
private:
|
||||
void getIcons();
|
||||
|
|
|
@ -427,7 +427,7 @@ bool Client::manage( Window w, bool isMapped )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( workspace()->allowClientActivation( this, user_time, false, session && session->active ))
|
||||
if( workspace()->allowClientActivation( this, userTime(), false, session && session->active ))
|
||||
{
|
||||
workspace()->raiseClient( this );
|
||||
rawShow();
|
||||
|
|
Loading…
Reference in a new issue