all repos — tint2 @ f43facc27755f11dd70bb7574e2f6acb74303fcb

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Scrolling through tasks by schattenprinz

git-svn-id: http://tint2.googlecode.com/svn/trunk@275 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

f43facc27755f11dd70bb7574e2f6acb74303fcb

parent

c7346fc56b5bbf2e7a99bdfac6461980b186c8b2

5 files changed, 71 insertions(+), 1 deletions(-)

jump to
M src/config.csrc/config.c

@@ -173,6 +173,10 @@ else if (strcmp (event, "desktop_left") == 0)

*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; }
M src/taskbar/task.csrc/taskbar/task.c

@@ -361,6 +361,55 @@ }

} +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;
M src/taskbar/task.hsrc/taskbar/task.h

@@ -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);
M src/tint.csrc/tint.c

@@ -223,6 +223,20 @@ desk = tsk->desktop + 1;

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); + } } }
M src/util/common.hsrc/util/common.h

@@ -29,7 +29,7 @@ }

*/ // 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