From 96cc95943ac13679e224ff0b3ef38ea53bfa62ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 27 Feb 2004 13:35:09 +0000 Subject: [PATCH] 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 --- activation.cpp | 26 +++++++++++++++++++++----- client.cpp | 5 +++++ client.h | 8 -------- group.h | 1 + manage.cpp | 2 +- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/activation.cpp b/activation.cpp index 3a7637372e..49167b77f4 100644 --- a/activation.cpp +++ b/activation.cpp @@ -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 diff --git a/client.cpp b/client.cpp index d460b1fd33..01f9ba1247 100644 --- a/client.cpp +++ b/client.cpp @@ -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 ); diff --git a/client.h b/client.h index 0eef84fbf3..ed53d027bc 100644 --- a/client.h +++ b/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; diff --git a/group.h b/group.h index efc3042370..6801621650 100644 --- a/group.h +++ b/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(); diff --git a/manage.cpp b/manage.cpp index 84f8796981..a46da73b45 100644 --- a/manage.cpp +++ b/manage.cpp @@ -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();