diff options
Diffstat (limited to 'src/taskbar.c')
-rw-r--r-- | src/taskbar.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/taskbar.c b/src/taskbar.c index f8ab13c..c553652 100644 --- a/src/taskbar.c +++ b/src/taskbar.c @@ -701,6 +701,71 @@ void FocusNextStackedCircular() { /*************************************************************************** ***************************************************************************/ +void FocusPreviousStackedCircular() { + + ClientNode *ac; + ClientNode *np; + int x; + + ac = GetActiveClient(); + np = NULL; + + /* Check for a valid client below this client in the same layer. */ + if(ac) { + for(np = ac->prev; np; np = np->prev) { + if(ShouldFocusItem(np)) { + break; + } + } + } + + /* Check for a valid client in upper layers. */ + if(ac && !np) { + for(x = ac->state.layer + 1; x <= LAYER_TOP; x++) { + for(np = nodes[x]; np; np = np->next) { + if(!np->next) { + break; + } + } + for(; np; np = np->prev) { + if(ShouldFocusItem(np)) { + break; + } + } + if(np) { + break; + } + } + } + + + /* Revert to the bottom-most valid client. */ + if(!np) { + for(x = LAYER_BOTTOM; x <= LAYER_TOP; x++) { + for(np = nodes[x]; np; np = np->next) { + if(!np->next) { + break; + } + } + for(; np; np = np->prev) { + if(ShouldFocusItem(np)) { + break; + } + } + if(np) { + break; + } + } + } + + if(np) { + FocusClient(np); + } +} + + +/*************************************************************************** + ***************************************************************************/ Node *GetNode(TaskBarType *bar, int x) { Node *tp; |