]> Dogcows Code - chaz/tint2/commitdiff
Scrolling through tasks by schattenprinz
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Wed, 18 Nov 2009 05:13:38 +0000 (05:13 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Wed, 18 Nov 2009 05:13:38 +0000 (05:13 +0000)
src/config.c
src/taskbar/task.c
src/taskbar/task.h
src/tint.c
src/util/common.h

index 1e8340452e0be7879f4039f4752743ff0b2d5acd..d93d2c3d4166115c237fe9fadb8ec2d0bf5771f2 100644 (file)
@@ -173,6 +173,10 @@ void get_action (char *event, int *action)
                *action = DESKTOP_LEFT;
        else if (strcmp (event, "desktop_right") == 0)
                *action = DESKTOP_RIGHT;
+       else if (strcmp (event, "next_task") == 0)
+               *action = NEXT_TASK;
+       else if (strcmp (event, "prev_task") == 0)
+               *action = PREV_TASK;
 }
 
 
index 0d69e1536d8e52ed623a1c59f2a122ce7ac5113a..317cd8fd952ad9202ce08140c7f2796727a03eb2 100644 (file)
@@ -361,6 +361,55 @@ void draw_task (void *obj, cairo_t *c, int active)
 }
 
 
+Task *next_task(Task *tsk)
+{
+       GSList *l0;
+       int i, j;
+       Task *tsk1;
+
+       for (i=0 ; i < nb_panel ; i++) {
+               for (j=0 ; j < panel1[i].nb_desktop ; j++) {
+                       for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
+                               tsk1 = l0->data;
+                               if (tsk1 == tsk) {
+                                       if (l0->next == NULL) l0 = panel1[i].taskbar[j].area.list;
+                                       else l0 = l0->next;
+                                       return l0->data;
+                               }
+                       }
+               }
+       }
+
+       return NULL;
+}
+
+Task *prev_task(Task *tsk)
+{
+       GSList *l0;
+       int i, j;
+       Task *tsk1, *tsk2;
+
+       for (i=0 ; i < nb_panel ; i++) {
+               for (j=0 ; j < panel1[i].nb_desktop ; j++) {
+                       tsk2 = NULL;
+                       for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
+                               tsk1 = l0->data;
+                               if (tsk1 == tsk) {
+                                       if (l0 == panel1[i].taskbar[j].area.list) {
+                                               l0 = g_slist_last ( l0 );
+                                               tsk2 = l0->data;
+                                       }
+                                       return tsk2;
+                               }
+                               tsk2 = tsk1;
+                       }
+               }
+       }
+
+       return NULL;
+}
+
+
 void active_task()
 {
        GSList *l0;
index 994870e40a2e0c56051e617fcb0dbb6efb4d02db..6bb9ef3c22e25501b8f86fc15bcbb33d415da3ea 100644 (file)
@@ -70,6 +70,9 @@ void get_icon (Task *tsk);
 void get_title(Task *tsk);
 void active_task();
 
+Task *next_task (Task *tsk);
+Task *prev_task (Task *tsk);
+
 void add_urgent(Task *tsk);
 void del_urgent(Task *tsk);
 int is_urgent(Task *tsk);
index 05d50f67c14e085d3c4ec6117c8ab29b77045d07..1380d657dce79f36431581024c3f0d15ab321ef1 100644 (file)
@@ -223,6 +223,20 @@ void window_action (Task *tsk, int action)
                        windows_set_desktop(tsk->win, desk);
                        if (desk == server.desktop)
                                set_active(tsk->win);
+                       break;
+               case NEXT_TASK:
+                       if (task_active) {
+                               Task *tsk1;
+                               tsk1 = next_task(task_active);
+                               set_active(tsk1->win);
+                       }
+                       break;
+               case PREV_TASK:
+                       if (task_active) {
+                               Task *tsk1;
+                               tsk1 = prev_task(task_active);
+                               set_active(tsk1->win);
+                       }
        }
 }
 
index 105b73e32ad2e209aa1ac7313ece1c7168c4746a..c7eca860384af182767563d7990fecae52572057 100644 (file)
@@ -29,7 +29,7 @@ FXint fxmalloc(void** ptr,unsigned long size){
 */
 
 // mouse actions
-enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY, MAXIMIZE_RESTORE, MAXIMIZE, RESTORE, DESKTOP_LEFT, DESKTOP_RIGHT };
+enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY, MAXIMIZE_RESTORE, MAXIMIZE, RESTORE, DESKTOP_LEFT, DESKTOP_RIGHT, NEXT_TASK, PREV_TASK };
 
 #define ALLDESKTOP  0xFFFFFFFF
 
This page took 0.029004 seconds and 4 git commands to generate.