--- fspanel.c.orig Tue Oct 23 15:32:39 2001 +++ fspanel.c Tue Oct 23 15:31:48 2001 @@ -23,10 +23,11 @@ #include "fspanel.h" /* you can edit these */ #define MAX_TASK_WIDTH 145 +#define PAGER_BOX_WIDTH 24 #define ICONWIDTH 16 #define ICONHEIGHT 16 #define WINHEIGHT 24 #define WINWIDTH (scr_width) #define FONT_NAME "-*-lucida*-m*-r-*-*-12-*-*" @@ -45,10 +46,11 @@ int scr_screen; int scr_depth; int scr_width; int scr_height; int text_y; +int pager_width; /*int time_width;*/ unsigned short cols[] = { 0xd75c, 0xd75c, 0xd75c, /* 0. light gray */ 0xbefb, 0xbaea, 0xbefb, /* 1. mid gray */ @@ -577,40 +579,68 @@ draw_dot (win, x, y); } } void -draw_up_triangle (taskbar *tb) +gui_draw_pager (taskbar * tb) { - fill_rect (tb, left_arrow_x + 2, (WINHEIGHT - 4) / 2 + 1, 3, 3); - draw_line (tb, left_arrow_x, (WINHEIGHT - 4) / 2 + 3, left_arrow_x + 3, (WINHEIGHT - 4) / 2); - draw_line (tb, left_arrow_x + 3, (WINHEIGHT - 4) / 2, left_arrow_x + 6, (WINHEIGHT - 4) / 2 + 3); - draw_line (tb, left_arrow_x + 1, (WINHEIGHT - 4) / 2 + 3, left_arrow_x + 5, (WINHEIGHT - 4) / 2 + 3); -} + int i, loc, text_x; + unsigned long *data; + char label[2]; + data = get_prop_data (root_win, atom__WIN_WORKSPACE_COUNT, XA_CARDINAL, 0); + if (data) + { + register unsigned long max_desks = *data; + XFree(data); + pager_width = PAGER_BOX_WIDTH * max_desks; + for (i=0; i < max_desks; i++) + { + loc = 8 + (i * PAGER_BOX_WIDTH); + label[0] = i + '1'; + text_x = loc + (PAGER_BOX_WIDTH / 2) - (XTextWidth(xfs,label,1)/2); -void -draw_down_triangle (taskbar *tb) + if (i == tb->my_desktop) { - draw_line (tb, right_arrow_x, (WINHEIGHT - 4) / 2, right_arrow_x + 3, (WINHEIGHT - 4) / 2 + 3); - draw_line (tb, right_arrow_x, (WINHEIGHT - 4) / 2, right_arrow_x + 4, (WINHEIGHT - 4) / 2 + 2); - draw_line (tb, right_arrow_x, (WINHEIGHT - 4) / 2, right_arrow_x + 5, (WINHEIGHT - 4) / 2 + 1); - draw_line (tb, right_arrow_x, (WINHEIGHT - 4) / 2, right_arrow_x + 6, (WINHEIGHT - 4) / 2); + set_foreground(1); + fill_rect (tb, loc + 3, 2, PAGER_BOX_WIDTH - 5, WINHEIGHT - 3 ); + set_foreground (4); + draw_line (tb, loc + 2, 1, loc + 2, WINHEIGHT - 2 ); + draw_line (tb, loc + 3, 1, loc + PAGER_BOX_WIDTH - 2, 1 ); + set_foreground (3); + draw_line (tb, loc + 3, WINHEIGHT - 2 , loc + PAGER_BOX_WIDTH - 2, WINHEIGHT - 2 ); + draw_line (tb, loc + PAGER_BOX_WIDTH - 2, WINHEIGHT - 3, loc + PAGER_BOX_WIDTH - 2, 2 ); + set_foreground(5); + XDrawString(dd, tb->win, fore_gc, text_x, text_y, label, 1); + } + else + { + set_foreground(0); + fill_rect (tb, loc + 2, 1, PAGER_BOX_WIDTH - 3, WINHEIGHT - 2 ); + set_foreground(5); + XDrawString(dd, tb->win, fore_gc, text_x, text_y, label, 1); + } + gui_draw_vline(tb, loc + PAGER_BOX_WIDTH); + } + } + else + { + pager_width = 0; + } } void gui_draw_taskbar (taskbar * tb) { task *tk; int x, width, taskw; int under = 0; set_foreground (5); /* black */ - draw_up_triangle (tb); - draw_down_triangle (tb); + gui_draw_pager(tb); - width = WINWIDTH - 80 - time_width - (TEXTPAD * 4); - x = 80; + width = WINWIDTH - pager_width - 8 - time_width - (TEXTPAD * 4); + x = pager_width + 12; if (tb->num_tasks == 0) goto clear; taskw = width / tb->num_tasks; @@ -639,11 +669,11 @@ } gui_draw_clock (tb); gui_draw_vline (tb, 8); - gui_draw_vline (tb, 74); + gui_draw_vline (tb, pager_width + 12); draw_grill (tb->win, 2); draw_grill (tb->win, WINWIDTH - 6); } @@ -791,23 +821,14 @@ void handle_press (taskbar * tb, int x, int y) { task *tk; - if (y > 3 && y < WINHEIGHT - 3) - { - if (x >= right_arrow_x && x < right_arrow_x + 9) - { - switch_desk (tb, +1); - return; - } - - if (x >= left_arrow_x && x < left_arrow_x + 9) + /* clicked on pager */ + if (x > 8 && x < pager_width + 8) { - switch_desk (tb, -1); - return; - } + switch_desk (tb, ((x-8) /PAGER_BOX_WIDTH) - tb->my_desktop); } /* clicked left grill */ if (x < 6) {