From d160a6fc0101dd094195f8d0782e8aefcf94d376 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 20 Feb 2012 02:24:32 -0600 Subject: Update twin with initial framework for application suspend/resume This needs some additional work before it can be enabled --- twin/workspace.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'twin/workspace.cpp') diff --git a/twin/workspace.cpp b/twin/workspace.cpp index 5b9f58305..e6e18e1aa 100644 --- a/twin/workspace.cpp +++ b/twin/workspace.cpp @@ -1909,6 +1909,60 @@ void Workspace::killWindowId( Window window_to_kill ) XKillClient( qt_xdisplay(), window_to_kill ); } +void Workspace::suspendWindowId( Window window_to_suspend ) + { + if( window_to_suspend == None ) + return; + Window window = window_to_suspend; + Client* client = NULL; + for(;;) + { + client = findClient( FrameIdMatchPredicate( window )); + if( client != NULL ) // found the client + break; + Window parent, root; + Window* children; + unsigned int children_count; + XQueryTree( qt_xdisplay(), window, &root, &parent, &children, &children_count ); + if( children != NULL ) + XFree( children ); + if( window == root ) // we didn't find the client, probably an override-redirect window + break; + window = parent; // go up + } + if( client != NULL ) + client->suspendWindow(); + else + return; + } + +void Workspace::resumeWindowId( Window window_to_resume ) + { + if( window_to_resume == None ) + return; + Window window = window_to_resume; + Client* client = NULL; + for(;;) + { + client = findClient( FrameIdMatchPredicate( window )); + if( client != NULL ) // found the client + break; + Window parent, root; + Window* children; + unsigned int children_count; + XQueryTree( qt_xdisplay(), window, &root, &parent, &children, &children_count ); + if( children != NULL ) + XFree( children ); + if( window == root ) // we didn't find the client, probably an override-redirect window + break; + window = parent; // go up + } + if( client != NULL ) + client->resumeWindow(); + else + return; + } + void Workspace::sendPingToWindow( Window window, Time timestamp ) { -- cgit v1.2.1