From 1ab9d314968f84e5b7e6530424cf08017de1f3ae Mon Sep 17 00:00:00 2001 From: "John Ankarstr\\xf6m" Date: Sat, 29 May 2021 13:58:38 +0200 Subject: Implement 'prev' and 'prevstacked' actions --- src/taskbar.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'src/taskbar.c') diff --git a/src/taskbar.c b/src/taskbar.c index f8ab13c..c553652 100644 --- a/src/taskbar.c +++ b/src/taskbar.c @@ -699,6 +699,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) { -- cgit v1.2.3