aboutsummaryrefslogtreecommitdiff
path: root/src/taskbar.c
diff options
context:
space:
mode:
authorJohn Ankarstr\xf6m <john@ankarstrom.se>2021-05-29 13:58:38 +0200
committerJohn Ankarstr\xf6m <john@ankarstrom.se>2021-05-29 13:58:38 +0200
commit1ab9d314968f84e5b7e6530424cf08017de1f3ae (patch)
tree8dbc526b126203391bae5083a4c9fcfa0d708450 /src/taskbar.c
parentd2c39c274907aef944ab47447c3515d1552d13e2 (diff)
downloadjwm-1ab9d314968f84e5b7e6530424cf08017de1f3ae.tar.gz
Implement 'prev' and 'prevstacked' actions
Diffstat (limited to 'src/taskbar.c')
-rw-r--r--src/taskbar.c65
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;