Support for timestamp in the window restack request.

svn path=/trunk/kdebase/kwin/; revision=304187
This commit is contained in:
Luboš Luňák 2004-04-16 09:43:53 +00:00
parent c311b39bd3
commit 1f628f4a5b
5 changed files with 26 additions and 37 deletions

View file

@ -489,7 +489,7 @@ bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in
// a window to be fully raised upon its own request (XRaiseWindow), // a window to be fully raised upon its own request (XRaiseWindow),
// if refused, it will be raised only on top of windows belonging // if refused, it will be raised only on top of windows belonging
// to the same application // to the same application
bool Workspace::allowFullClientRaising( const Client* c ) bool Workspace::allowFullClientRaising( const Client* c, Time time )
{ {
if( session_saving if( session_saving
&& options->focusStealingPreventionLevel <= 2 ) // <= normal && options->focusStealingPreventionLevel <= 2 ) // <= normal
@ -516,15 +516,10 @@ bool Workspace::allowFullClientRaising( const Client* c )
} }
if( options->focusStealingPreventionLevel == 3 ) // high if( options->focusStealingPreventionLevel == 3 ) // high
return false; return false;
if( !c->hasUserTimeSupport()) Time user_time = ac->userTime();
{ kdDebug( 1212 ) << "Raising, compared:" << time << ":" << user_time
kdDebug( 1212 ) << "Raising: No support" << endl; << ":" << ( timestampCompare( time, user_time ) >= 0 ) << endl;
if( options->focusStealingPreventionLevel == 1 ) // low return timestampCompare( time, user_time ) >= 0; // time >= user_time
return true;
}
// options->focusStealingPreventionLevel == 2 // normal
kdDebug( 1212 ) << "Raising: Refusing" << endl;
return false;
} }
// called from Client after FocusIn that wasn't initiated by KWin and the client // called from Client after FocusIn that wasn't initiated by KWin and the client

View file

@ -245,7 +245,7 @@ class Client : public QObject, public KDecorationDefines
void NETMoveResize( int x_root, int y_root, NET::Direction direction ); void NETMoveResize( int x_root, int y_root, NET::Direction direction );
void NETMoveResizeWindow( int flags, int x, int y, int width, int height ); void NETMoveResizeWindow( int flags, int x, int y, int width, int height );
void restackWindow( Window above, int detail, NET::RequestSource source, bool send_event = false ); void restackWindow( Window above, int detail, NET::RequestSource source, Time timestamp, bool send_event = false );
void gotPing( Time timestamp ); void gotPing( Time timestamp );

View file

@ -89,7 +89,7 @@ void WinInfo::changeState( unsigned long state, unsigned long mask )
// **************************************** // ****************************************
RootInfo::RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr[], int pr_num, int scr ) RootInfo::RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr[], int pr_num, int scr )
: NETRootInfo2( dpy, w, name, pr, pr_num, scr ) : NETRootInfo3( dpy, w, name, pr, pr_num, scr )
{ {
workspace = ws; workspace = ws;
} }
@ -161,10 +161,10 @@ void RootInfo::gotPing( Window w, Time timestamp )
c->gotPing( timestamp ); c->gotPing( timestamp );
} }
void RootInfo::restackWindow( Window w, Window above, int detail ) void RootInfo::restackWindow( Window w, RequestSource source, Window above, int detail, Time timestamp )
{ {
if( Client* c = workspace->findClient( WindowMatchPredicate( w ))) if( Client* c = workspace->findClient( WindowMatchPredicate( w )))
c->restackWindow( above, detail, NET::FromTool, true ); c->restackWindow( above, detail, source, timestamp, true );
} }
// **************************************** // ****************************************
@ -791,7 +791,7 @@ void Client::configureRequestEvent( XConfigureRequestEvent* e )
configureRequest( e->value_mask, e->x, e->y, e->width, e->height ); configureRequest( e->value_mask, e->x, e->y, e->width, e->height );
if ( e->value_mask & CWStackMode ) if ( e->value_mask & CWStackMode )
restackWindow( e->above, e->detail, NET::FromApplication ); restackWindow( e->above, e->detail, NET::FromApplication, userTime(), false );
// TODO sending a synthetic configure notify always is fine, even in cases where // TODO sending a synthetic configure notify always is fine, even in cases where
// the ICCCM doesn't require this - it can be though of as 'the WM decided to move // the ICCCM doesn't require this - it can be though of as 'the WM decided to move

View file

@ -367,9 +367,9 @@ void Workspace::raiseClientWithinApplication( Client* c )
} }
} }
void Workspace::raiseClientRequest( Client* c ) void Workspace::raiseClientRequest( Client* c, NET::RequestSource src, Time timestamp )
{ {
if( allowFullClientRaising( c )) if( src == NET::FromTool || allowFullClientRaising( c, timestamp ))
raiseClient( c ); raiseClient( c );
else else
{ {
@ -378,16 +378,16 @@ void Workspace::raiseClientRequest( Client* c )
} }
} }
void Workspace::lowerClientRequest( Client* c ) void Workspace::lowerClientRequest( Client* c, NET::RequestSource src, Time /*timestamp*/ )
{ {
// If the client has support for all this focus stealing prevention stuff, // If the client has support for all this focus stealing prevention stuff,
// do only lowering within the application, as that's the more logical // do only lowering within the application, as that's the more logical
// variant of lowering when application requests it. // variant of lowering when application requests it.
// No demanding of attention here of course. // No demanding of attention here of course.
if( c->hasUserTimeSupport()) if( src == NET::FromTool || !c->hasUserTimeSupport())
lowerClientWithinApplication( c );
else
lowerClient( c ); lowerClient( c );
else
lowerClientWithinApplication( c );
} }
void Workspace::restackClientUnderActive( Client* c ) void Workspace::restackClientUnderActive( Client* c )
@ -605,23 +605,17 @@ bool Workspace::keepTransientAbove( const Client* mainwindow, const Client* tran
// Client // Client
//******************************* //*******************************
void Client::restackWindow( Window /*above TODO */, int detail, NET::RequestSource source, bool send_event ) void Client::restackWindow( Window /*above TODO */, int detail, NET::RequestSource src, Time timestamp, bool send_event )
{ {
switch ( detail ) switch ( detail )
{ {
case Above: case Above:
case TopIf: case TopIf:
if( source == NET::FromTool ) workspace()->raiseClientRequest( this, src, timestamp );
workspace()->raiseClient( this );
else
workspace()->raiseClientRequest( this );
break; break;
case Below: case Below:
case BottomIf: case BottomIf:
if( source == NET::FromTool ) workspace()->lowerClientRequest( this, src, timestamp );
workspace()->lowerClient( this );
else
workspace()->lowerClientRequest( this );
break; break;
case Opposite: case Opposite:
default: default:

View file

@ -134,8 +134,8 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
QPoint adjustClientPosition( Client* c, QPoint pos ); QPoint adjustClientPosition( Client* c, QPoint pos );
void raiseClient( Client* c ); void raiseClient( Client* c );
void lowerClient( Client* c ); void lowerClient( Client* c );
void raiseClientRequest( Client* c ); void raiseClientRequest( Client* c, NET::RequestSource src, Time timestamp );
void lowerClientRequest( Client* c ); void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp );
void restackClientUnderActive( Client* ); void restackClientUnderActive( Client* );
void updateClientLayer( Client* c ); void updateClientLayer( Client* c );
void raiseOrLowerClient( Client * ); void raiseOrLowerClient( Client * );
@ -346,7 +346,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
ClientList constrainedStackingOrder(); ClientList constrainedStackingOrder();
void raiseClientWithinApplication( Client* c ); void raiseClientWithinApplication( Client* c );
void lowerClientWithinApplication( Client* c ); void lowerClientWithinApplication( Client* c );
bool allowFullClientRaising( const Client* c ); bool allowFullClientRaising( const Client* c, Time timestamp );
bool keepTransientAbove( const Client* mainwindow, const Client* transient ); bool keepTransientAbove( const Client* mainwindow, const Client* transient );
void blockStackingUpdates( bool block ); void blockStackingUpdates( bool block );
void updateCurrentTopMenu(); void updateCurrentTopMenu();
@ -539,7 +539,7 @@ class StackingUpdatesBlocker
}; };
// NET WM Protocol handler class // NET WM Protocol handler class
class RootInfo : public NETRootInfo2 class RootInfo : public NETRootInfo3
{ {
private: private:
typedef KWinInternal::Client Client; // because of NET::Client typedef KWinInternal::Client Client; // because of NET::Client
@ -554,7 +554,7 @@ class RootInfo : public NETRootInfo2
virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction); virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height ); virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height );
virtual void gotPing(Window w, Time timestamp); virtual void gotPing(Window w, Time timestamp);
virtual void restackWindow(Window w, Window above, int detail); virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp);
private: private:
Workspace* workspace; Workspace* workspace;
}; };