summaryrefslogtreecommitdiffstats
path: root/twin/workspace.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-02-20 02:24:32 -0600
committerTimothy Pearson <[email protected]>2012-02-20 02:24:32 -0600
commitd160a6fc0101dd094195f8d0782e8aefcf94d376 (patch)
treebf7ebde63e93fb2f54b2bcaf5b0427b7f8de845f /twin/workspace.cpp
parenta515552a21960aeffbe12e24c6d64da32c646829 (diff)
downloadtdebase-d160a6fc0101dd094195f8d0782e8aefcf94d376.tar.gz
tdebase-d160a6fc0101dd094195f8d0782e8aefcf94d376.zip
Update twin with initial framework for application suspend/resume
This needs some additional work before it can be enabled
Diffstat (limited to 'twin/workspace.cpp')
-rw-r--r--twin/workspace.cpp54
1 files changed, 54 insertions, 0 deletions
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 )
{