diff --git a/events.cpp b/events.cpp index 0ff6bc3db2..439241fd2b 100644 --- a/events.cpp +++ b/events.cpp @@ -103,7 +103,7 @@ void RootInfo::changeCurrentDesktop(int d) workspace->setCurrentDesktop( d ); } -void RootInfo::changeActiveWindow( Window w, NET::RequestSource src, Time timestamp ) +void RootInfo::changeActiveWindow( Window w, NET::RequestSource src, Time timestamp, Window active_window ) { if( Client* c = workspace->findClient( WindowMatchPredicate( w ))) { @@ -113,8 +113,14 @@ void RootInfo::changeActiveWindow( Window w, NET::RequestSource src, Time timest workspace->activateClient( c ); else // NET::FromApplication { + Client* c2; if( workspace->allowClientActivation( c, timestamp )) workspace->activateClient( c ); + // 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->activateClient( c ); else c->demandAttention(); } diff --git a/workspace.h b/workspace.h index 528d915cd3..b4142d451f 100644 --- a/workspace.h +++ b/workspace.h @@ -539,7 +539,7 @@ class RootInfo : public NETRootInfo2 virtual void changeNumberOfDesktops(int n); virtual void changeCurrentDesktop(int d); // virtual void changeActiveWindow(Window w); the extended version is used - virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp); + virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window); virtual void closeWindow(Window w); 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 );