From aa8f2d6607ec5ee998876e2b589d4dd028132ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 2 Mar 2004 16:43:29 +0000 Subject: [PATCH] Fix some focus stealing prevention problems when timestamp is not explicitly specified. svn path=/trunk/kdebase/kwin/; revision=293135 --- activation.cpp | 2 ++ events.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/activation.cpp b/activation.cpp index 49167b77f4..70fe5e9db9 100644 --- a/activation.cpp +++ b/activation.cpp @@ -419,6 +419,8 @@ bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in // 3 - high - new window gets focus only if it belongs to the active application, // or when no window is currently active // 4 - extreme - no window gets focus without user intervention + if( time == -1U ) + time = c->userTime(); if( session_saving && options->focusStealingPreventionLevel <= 3 ) // <= normal { diff --git a/events.cpp b/events.cpp index 4245487bc2..ec4af720e9 100644 --- a/events.cpp +++ b/events.cpp @@ -108,6 +108,8 @@ void RootInfo::changeActiveWindow( Window w, NET::RequestSource src, Time timest { if( Client* c = workspace->findClient( WindowMatchPredicate( w ))) { + if( timestamp == CurrentTime ) + timestamp = c->userTime(); if( src == NET::FromUnknown ) src = NET::FromTool; // KWIN_FOCUS, use qt_x_time as timestamp? if( src == NET::FromTool ) @@ -120,7 +122,8 @@ void RootInfo::changeActiveWindow( Window w, NET::RequestSource src, Time timest // if activation of the requestor's window would be allowed, allow activation too else if( active_window != None && ( c2 = workspace->findClient( WindowMatchPredicate( active_window ))) != NULL - && workspace->allowClientActivation( c2, timestamp )) + && workspace->allowClientActivation( c2, + timestampCompare( timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()))) workspace->activateClient( c ); else c->demandAttention();