From 7f5690bbe67e00982f132fe7976056bc059338cf Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 7 Jun 2007 00:40:28 +0000 Subject: [PATCH] some fixes to skip_taskbar stuff, and reindent case labels to same label as switch --- rspanel.c | 122 +++++++++++++++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 57 deletions(-) diff --git a/rspanel.c b/rspanel.c index de1e80a..6c80221 100644 --- a/rspanel.c +++ b/rspanel.c @@ -652,6 +652,11 @@ static void pager_draw(void) #endif +static inline int dont_show_task(task *tk) +{ + return !tk->focused && tk->hidden; +} + static void gui_draw_taskbar(void) { task *tk; @@ -675,7 +680,7 @@ static void gui_draw_taskbar(void) /* find the number of visible tasks */ for (tk = tb.task_list; tk; tk = tk->next) { - if (!tk->focused && tk->hidden) + if (dont_show_task(tk)) continue; num_tasks++; } @@ -688,7 +693,7 @@ static void gui_draw_taskbar(void) taskw = MAX_TASK_WIDTH; for (tk = tb.task_list; tk; tk = tk->next) { - if (!tk->focused && tk->hidden) + if (dont_show_task(tk)) continue; tk->pos_x = x; tk->width = taskw - 1; @@ -839,67 +844,69 @@ static void handle_press(int x, int y, int button, Time time) while (tk) { /* clicked on a task button */ /* XXX Make this configureable */ - if (x > tk->pos_x && x < tk->pos_x + tk->width) { + if (!dont_show_task(tk) + && (x > tk->pos_x && x < tk->pos_x + tk->width)) + { switch (button) { - case 1: - netwm_action(tk->win, _NET_ACTIVE_WINDOW, time, 0); - break; - case 2: - if (tk->iconified) - netwm_action(tk->win, _NET_WM_STATE_HIDDEN, time, REMOVE); - else - netwm_action(tk->win, _NET_WM_STATE_HIDDEN, time, ADD); - break; - case 3: - netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Opposite); - break; - case 4: - if (is_shaded(tk->win)) - netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Below); - else - netwm_action(tk->win, _NET_WM_STATE_SHADED, time, ADD); - break; - case 5: - if (is_shaded(tk->win)) - netwm_action(tk->win, _NET_WM_STATE_SHADED, time, REMOVE); - else - netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Above); - break; - case 9: - if (tk->iconified) - netwm_action(tk->win, _NET_WM_STATE_HIDDEN, time, REMOVE); - else - netwm_action(tk->win, _OB_FOCUS, 0, 0); - break; - case 6: - netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Below); - break; - case 7: - netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Above); - break; + case 1: + netwm_action(tk->win, _NET_ACTIVE_WINDOW, time, 0); + break; + case 2: + if (tk->iconified) + netwm_action(tk->win, _NET_WM_STATE_HIDDEN, time, REMOVE); + else + netwm_action(tk->win, _NET_WM_STATE_HIDDEN, time, ADD); + break; + case 3: + netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Opposite); + break; + case 4: + if (is_shaded(tk->win)) + netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Below); + else + netwm_action(tk->win, _NET_WM_STATE_SHADED, time, ADD); + break; + case 5: + if (is_shaded(tk->win)) + netwm_action(tk->win, _NET_WM_STATE_SHADED, time, REMOVE); + else + netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Above); + break; + case 9: + if (tk->iconified) + netwm_action(tk->win, _NET_WM_STATE_HIDDEN, time, REMOVE); + else + netwm_action(tk->win, _OB_FOCUS, 0, 0); + break; + case 6: + netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Below); + break; + case 7: + netwm_action(tk->win, _NET_RESTACK_WINDOW, time, Above); + break; } return; } tk = tk->next; } /* clicked on the background */ switch (button) { - case 1: - netwm_action(tb.win, _NET_RESTACK_WINDOW, time, Above); - break; - case 2: - netwm_action(tb.win, _NET_RESTACK_WINDOW, time, Below); - break; - case 3: - netwm_action(tb.win, _NET_RESTACK_WINDOW, time, Opposite); - break; - case 4: - tb.hidden = 1; - move_taskbar(); - break; - case 5: - tb.hidden = 0; - move_taskbar(); - break; + case 1: + netwm_action(tb.win, _NET_RESTACK_WINDOW, time, Above); + break; + case 2: + netwm_action(tb.win, _NET_RESTACK_WINDOW, time, Below); + break; + case 3: + netwm_action(tb.win, _NET_RESTACK_WINDOW, time, Opposite); + break; + case 4: + tb.hidden = 1; + move_taskbar(); + break; + case 5: + tb.hidden = 0; + move_taskbar(); + break; } } } @@ -990,7 +997,8 @@ static void handle_propertynotify(Window win, Atom at) /* iconified state changed? */ if (is_iconified(tk->win) != tk->iconified) { tk->iconified = !tk->iconified; - gui_draw_task(tk, TRUE); + if (!tk->hidden) + gui_draw_task(tk, TRUE); } /* shaded state changed? */ if (is_shaded(tk->win) != tk->shaded) { -- 2.39.2