From a325dd996621b731d6b3a63911df265186481d74 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Thu, 12 Jul 2001 13:50:19 +0000 Subject: [PATCH] make focusEnsurance() multi-screen capable (at least I hope it works this way) svn path=/trunk/kdebase/kwin/; revision=105769 --- workspace.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index d47ea91c14..15c706d816 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -4009,12 +4009,22 @@ void Workspace::focusEnsurance() int revert; XGetInputFocus( qt_xdisplay(), &focus, &revert ); if ( focus == None || focus == PointerRoot ) { - if ( !last_active_client ) - last_active_client = topClientOnDesktop(); - if ( last_active_client && last_active_client->isVisible() ) { - kwin_time = CurrentTime; - requestFocus( last_active_client ); - } + + Window root_return; + Window child = root; + int root_x, root_y, lx, ly; + uint state; + Window w; + if ( ! XQueryPointer( qt_xdisplay(), root, &root_return, &child, + &root_x, &root_y, &lx, &ly, &state ) ) + return; // cursor is on another screen, so do not play with focus + + if ( !last_active_client ) + last_active_client = topClientOnDesktop(); + if ( last_active_client && last_active_client->isVisible() ) { + kwin_time = CurrentTime; + requestFocus( last_active_client ); + } } } @@ -4030,7 +4040,7 @@ void Workspace::checkStartOnDesktop( WId w ) KStartupInfoData data; if( d->startup->checkStartup( w, data ) != KStartupInfo::Match || data.desktop() == 0 ) return; - NETWinInfo info( qt_xdisplay(), w, qt_xrootwin(), NET::WMDesktop ); + NETWinInfo info( qt_xdisplay(), w, root, NET::WMDesktop ); if( info.desktop() == 0 ) info.setDesktop( data.desktop()); }