about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorDebXWoody <stefan@debxwoody.de>2021-05-29 22:01:44 +0200
committerDebXWoody <stefan@debxwoody.de>2021-05-29 22:01:44 +0200
commit47e39a79759eddbacf8c738f8415e3e96381116e (patch)
treef1d26ab3bb4550513e3c65f845532df2ffc41185 /src/ui
parentb9af7152f91fce53ef16a228e860cad5f4db1b4c (diff)
downloadprofani-tty-47e39a79759eddbacf8c738f8415e3e96381116e.tar.gz
Attention-flag: Fix next window
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/window_list.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/ui/window_list.c b/src/ui/window_list.c
index 3a46f59e..c17ced50 100644
--- a/src/ui/window_list.c
+++ b/src/ui/window_list.c
@@ -1213,18 +1213,35 @@ wins_get_next_attention(void)
     values = g_list_sort(values, _wins_cmp_num);
     GList* curr = values;
 
-    while (curr) {
-        // copy from wins_get_next_unread - what is it?
-        if (current == GPOINTER_TO_INT(curr->data)) {
+    ProfWin* current_window = wins_get_by_num( current);
+
+    // search the current window
+    while(curr) {
+        ProfWin* window = curr->data;
+        if( current_window == window  ) {
+            current_window = window;
             curr = g_list_next(curr);
-            continue;
+            break;
         }
+        curr = g_list_next(curr);
+    }
 
-        ProfWin* window_current = wins_get_by_num( current);
+    // Start from current window
+    while ( current_window && curr) {
         ProfWin* window = curr->data;
-        if( window_current == window  ) {
-            curr = g_list_next(curr);
-            continue;
+        if (win_has_attention(window)) {
+            g_list_free(values);
+            return window;
+        }
+        curr = g_list_next(curr);
+    }
+    // Start from begin
+    curr = values;
+    while ( current_window && curr) {
+        ProfWin* window = curr->data;
+        if( current_window == window) {
+            // we are at current again
+            break;
         }
         if (win_has_attention(window)) {
             g_list_free(values);