infobar: New infobar with new BarWindow; Add shadow, better rendering, improve system...

This commit is contained in:
Martin Duquesnoy 2008-11-13 08:03:56 +01:00
parent 7c77a4b5ae
commit 22431c203c
11 changed files with 164 additions and 191 deletions

View File

@ -37,14 +37,15 @@
* \param x X position * \param x X position
* \param y Y position * \param y Y position
* \param w BarWindow Width * \param w BarWindow Width
* \param h BarWindow Height * \param h BarWindow HeightXS
* \param bord Bord width
* \param color BarWindow color * \param color BarWindow color
* \param entermask Bool for know if the EnterMask mask is needed * \param entermask Bool for know if the EnterMask mask is needed
* \return The new BarWindow pointer * \return The new BarWindow pointer
*/ */
BarWindow* BarWindow*
bar_create(Window parent, int x, int y, uint w, uint h, int bord, uint color, Bool entermask) bar_create(Window parent,
int x, int y, uint w, uint h,
uint color, Bool entermask)
{ {
XSetWindowAttributes at; XSetWindowAttributes at;
BarWindow *bw; BarWindow *bw;
@ -61,17 +62,25 @@ bar_create(Window parent, int x, int y, uint w, uint h, int bord, uint color, Bo
at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
ButtonPressMask | ExposureMask | StructureNotifyMask; ButtonPressMask | ExposureMask | StructureNotifyMask;
bw->win = XCreateWindow(dpy, parent, x, y, w, h, bord, DefaultDepth(dpy, screen), /* Create window */
bw->win = XCreateWindow(dpy, parent, x, y, w, h, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &at); CWOverrideRedirect | CWBackPixmap | CWEventMask, &at);
bw->dr = XCreatePixmap(dpy, parent, w, h, DefaultDepth(dpy, screen)); bw->dr = XCreatePixmap(dpy, parent, w, h, DefaultDepth(dpy, screen));
/* His border */
CWIN(bw->border.left, bw->win, 0, 0, SHADH, h, 0, CWBackPixel, color_enlight(color), &at);
CWIN(bw->border.top, bw->win, 0, 0, w, SHADH, 0, CWBackPixel, color_enlight(color), &at);
CWIN(bw->border.bottom, bw->win, 0, h - SHADH, w, SHADH, 0, CWBackPixel, SHADC, &at);
CWIN(bw->border.right, bw->win, w - SHADH, 0, SHADH, h, 0, CWBackPixel, SHADC, &at);
bw->geo.x = x; bw->geo.x = x;
bw->geo.y = y; bw->geo.y = y;
bw->geo.width = w; bw->geo.width = w;
bw->geo.height = h; bw->geo.height = h;
bw->bord = bord;
bw->color = color; bw->color = color;
bw->border.light = color_enlight(color);
bw->border.dark = SHADC;
return bw; return bw;
} }
@ -83,6 +92,7 @@ void
bar_delete(BarWindow *bw) bar_delete(BarWindow *bw)
{ {
XSelectInput(dpy, bw->win, NoEventMask); XSelectInput(dpy, bw->win, NoEventMask);
XDestroySubwindows(dpy, bw->win);
XDestroyWindow(dpy, bw->win); XDestroyWindow(dpy, bw->win);
XFreePixmap(dpy, bw->dr); XFreePixmap(dpy, bw->dr);
free(bw); free(bw);
@ -98,9 +108,10 @@ bar_map(BarWindow *bw)
{ {
CHECK(!bw->mapped); CHECK(!bw->mapped);
XMapRaised(dpy, bw->win); XMapWindow(dpy, bw->win);
bw->mapped = True; XMapSubwindows(dpy, bw->win);
bw->mapped = True;
return; return;
} }
@ -113,7 +124,9 @@ bar_unmap(BarWindow *bw)
{ {
CHECK(bw->mapped); CHECK(bw->mapped);
XUnmapSubwindows(dpy, bw->win);
XUnmapWindow(dpy, bw->win); XUnmapWindow(dpy, bw->win);
bw->mapped = False; bw->mapped = False;
return; return;
@ -146,27 +159,43 @@ bar_resize(BarWindow *bw, uint w, uint h)
bw->geo.width = w; bw->geo.width = w;
bw->geo.height = h; bw->geo.height = h;
XFreePixmap(dpy, bw->dr); XFreePixmap(dpy, bw->dr);
bw->dr = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
/* Frame */
bw->dr = XCreatePixmap(dpy, root, w - SHADH, h - SHADH, DefaultDepth(dpy, screen));
XResizeWindow(dpy, bw->win, w, h); XResizeWindow(dpy, bw->win, w, h);
/* Border */
XResizeWindow(dpy, bw->border.left, SHADH, h);
XResizeWindow(dpy, bw->border.top, w, SHADH);
XResizeWindow(dpy, bw->border.bottom, w, SHADH);
XMoveResizeWindow(dpy, bw->border.right, w - SHADH, 0, SHADH, h);
return; return;
} }
/** Refresh the BarWindowColor /** Refresh the BarWindow Color
* \param bw BarWindow pointer * \param bw BarWindow pointer
*/ */
void void
bar_refresh_color(BarWindow *bw) bar_refresh_color(BarWindow *bw)
{ {
draw_rectangle(bw->dr, 0, 0, bw->geo.width, bw->geo.height, bw->color); draw_rectangle(bw->dr, 0, 0, bw->geo.width, bw->geo.height, bw->color);
if(bw->bord)
XSetWindowBorder(dpy, bw->win, bw->color); XSetWindowBackground(dpy, bw->border.left , bw->border.light);
XSetWindowBackground(dpy, bw->border.top , bw->border.light);
XSetWindowBackground(dpy, bw->border.bottom , bw->border.dark);
XSetWindowBackground(dpy, bw->border.right , bw->border.dark);
XClearWindow(dpy, bw->border.left);
XClearWindow(dpy, bw->border.top);
XClearWindow(dpy, bw->border.bottom);
XClearWindow(dpy, bw->border.right);
return; return;
} }
/** Refresh a BarWindow /** Refresh the BarWindow
* \param bw BarWindow pointer * \param bw BarWindow pointer
*/ */
void void

View File

@ -223,7 +223,7 @@ client_focus(Client *c)
{ {
Client *c; Client *c;
for(c = clients; c && c->titlebar != w; c = c->next); for(c = clients; c && c->titlebar->win != w; c = c->next);
return c; return c;
} }
@ -313,6 +313,7 @@ client_map(Client *c)
XMapWindow(dpy, c->frame); XMapWindow(dpy, c->frame);
XMapSubwindows(dpy, c->frame); XMapSubwindows(dpy, c->frame);
bar_map(c->titlebar);
return; return;
} }
@ -563,6 +564,7 @@ client_unmanage(Client *c)
setwinstate(c->win, WithdrawnState); setwinstate(c->win, WithdrawnState);
XDestroySubwindows(dpy, c->frame); XDestroySubwindows(dpy, c->frame);
XDestroyWindow(dpy, c->frame); XDestroyWindow(dpy, c->frame);
bar_delete(c->titlebar);
XFree(c->title); XFree(c->title);
efree(c); efree(c);
XSync(dpy, False); XSync(dpy, False);
@ -581,6 +583,7 @@ client_unmap(Client *c)
XUnmapWindow(dpy, c->frame); XUnmapWindow(dpy, c->frame);
XUnmapSubwindows(dpy, c->frame); XUnmapSubwindows(dpy, c->frame);
bar_unmap(c->titlebar);
return; return;
} }

View File

@ -491,6 +491,7 @@ init_conf(void)
fprintf(stderr, "WMFS Configuration: Warning! " fprintf(stderr, "WMFS Configuration: Warning! "
"tag \"%s\" is already defined\n", conf.tag[j].name); "tag \"%s\" is already defined\n", conf.tag[j].name);
seltag = 1; seltag = 1;
prevtag = 0;
for(i = 0; i < conf.ntag; ++i) for(i = 0; i < conf.ntag; ++i)
tags[i + 1] = conf.tag[i]; tags[i + 1] = conf.tag[i];

View File

@ -37,12 +37,11 @@
* \param x X position * \param x X position
* \param y Y position * \param y Y position
* \param fg Foreground text color * \param fg Foreground text color
* \param bg Background text color
* \param pad Text padding * \param pad Text padding
* \param str String that will be draw * \param str String that will be draw
*/ */
void void
draw_text(Drawable d, int x, int y, char* fg, uint bg, int pad, char *str) draw_text(Drawable d, int x, int y, char* fg, int pad, char *str)
{ {
XftColor xftcolor; XftColor xftcolor;
XftDraw *xftd; XftDraw *xftd;
@ -50,10 +49,6 @@ draw_text(Drawable d, int x, int y, char* fg, uint bg, int pad, char *str)
/* Transform X Drawable -> Xft Drawable */ /* Transform X Drawable -> Xft Drawable */
xftd = XftDrawCreate(dpy, d, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen)); xftd = XftDrawCreate(dpy, d, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
/* Color the text font */
draw_rectangle(d, x - pad/2, 0, textw(str) + pad, infobar->geo.height, bg);
/* Alloc text color */ /* Alloc text color */
XftColorAllocName(dpy, DefaultVisual(dpy, screen), XftColorAllocName(dpy, DefaultVisual(dpy, screen),
DefaultColormap(dpy, screen), fg, &xftcolor); DefaultColormap(dpy, screen), fg, &xftcolor);

View File

@ -67,55 +67,32 @@ buttonpress(XButtonEvent *ev)
if(conf.root.mouse[i].func) if(conf.root.mouse[i].func)
conf.root.mouse[i].func(conf.root.mouse[i].cmd); conf.root.mouse[i].func(conf.root.mouse[i].cmd);
/* Bar */ /* Tag */
for(i = 1; i < conf.ntag + 1; ++i)
{ {
if(ev->window == infobar->bar->win) ITOA(s, i);
if(ev->window == infobar->tags[i]->win)
{ {
/* Tag*/ if(ev->button == Button1)
for(i = 0; i < conf.ntag + 1; ++i) uicb_tag(s);
{ if(ev->button == Button3)
if(ev->x > taglen[i-1] - 3 uicb_tagtransfert(s);
&& ev->x < (taglen[i] - 3)) if(ev->button == Button4)
{ uicb_tag("+1");
ITOA(s, i); if (ev->button == Button5)
if(ev->button == Button1) uicb_tag("-1");
uicb_tag(s);
if(ev->button == Button3)
uicb_tagtransfert(s);
}
}
if(ev->x < taglen[conf.ntag])
{
if(ev->button == Button4)
uicb_tag("+1");
if (ev->button == Button5)
uicb_tag("-1");
}
} }
/* Layout */ }
{
if(ev->window == infobar->layout_switch->win)
{
if(ev->button == Button1
|| ev->button == Button4)
layoutswitch(True);
if(ev->button == Button3 /* Layout button */
|| ev->button == Button5) if(ev->window == infobar->layout_button->win)
layoutswitch(False); {
} if(ev->button == Button1
|| ev->button == Button4)
if(ev->window == infobar->layout_type_switch->win) layoutswitch(True);
{ if(ev->button == Button3
if(ev->button == Button1 || ev->button == Button5)
|| ev->button == Button4) layoutswitch(False);
layout_tile_switch(True);
if(ev->button == Button3
|| ev->button == Button5)
layout_tile_switch(False);
}
}
} }
return; return;
@ -220,11 +197,19 @@ void
expose(XExposeEvent *ev) expose(XExposeEvent *ev)
{ {
Client *c; Client *c;
int i;
if(ev->count == 0 if(ev->count == 0
&& (ev->window == infobar->bar->win)) && (ev->window == infobar->bar->win))
infobar_draw(); infobar_draw();
for(i = 1; i < conf.ntag + 1; ++i)
if(ev->window == infobar->tags[i]->win)
infobar_draw_taglist();
if(ev->window == infobar->layout_button->win)
infobar_draw_layout();
if((c = client_gb_titlebar(ev->window))) if((c = client_gb_titlebar(ev->window)))
frame_update(c); frame_update(c);

View File

@ -67,15 +67,8 @@ frame_create(Client *c)
/* Create titlebar window */ /* Create titlebar window */
if(TBARH) if(TBARH)
{ c->titlebar = bar_create(c->frame, 0, 0, c->frame_geo.width, TBARH + BORDH, c->colors.frame, True);
CWIN(c->titlebar, c->frame, 0, 0,
c->frame_geo.width,
(TBARH + SHADH/2) + BORDH,
1, CWEventMask|CWBackPixel,
c->colors.frame, &at);
XSetWindowBorder(dpy, c->titlebar, SHADC);
}
/* Titlebar buttons */
at.event_mask &= ~(EnterWindowMask | LeaveWindowMask); /* <- Delete useless mask */ at.event_mask &= ~(EnterWindowMask | LeaveWindowMask); /* <- Delete useless mask */
/* Create resize area */ /* Create resize area */
@ -124,7 +117,7 @@ frame_moveresize(Client *c, XRectangle geo)
/* Titlebar */ /* Titlebar */
if(TBARH) if(TBARH)
XResizeWindow(dpy, c->titlebar, c->frame_geo.width, (TBARH - SHADH*2) + BORDH); bar_resize(c->titlebar, c->frame_geo.width, TBARH + BORDH);
/* Resize area */ /* Resize area */
XMoveWindow(dpy, c->resize, c->frame_geo.width - RESHW, c->frame_geo.height - RESHW); XMoveWindow(dpy, c->resize, c->frame_geo.width - RESHW, c->frame_geo.height - RESHW);
@ -139,7 +132,7 @@ frame_moveresize(Client *c, XRectangle geo)
} }
/** Update the client frame; Set the new color /** Update the client frame; Set the new color
* and the title ---> refresh all * and the title --> refresh
* \param c Client pointer * \param c Client pointer
*/ */
void void
@ -147,10 +140,10 @@ frame_update(Client *c)
{ {
if(TBARH) if(TBARH)
{ {
XSetWindowBackground(dpy, c->titlebar, c->colors.frame); c->titlebar->color = c->colors.frame;
XSetWindowBorder(dpy, c->titlebar, SHADC); bar_refresh_color(c->titlebar);
XClearWindow(dpy, c->titlebar);
} }
XSetWindowBackground(dpy, c->frame, c->colors.frame); XSetWindowBackground(dpy, c->frame, c->colors.frame);
XSetWindowBackground(dpy, c->resize, c->colors.resizecorner); XSetWindowBackground(dpy, c->resize, c->colors.resizecorner);
XSetWindowBackground(dpy, c->left, color_enlight(c->colors.frame)); XSetWindowBackground(dpy, c->left, color_enlight(c->colors.frame));
@ -166,10 +159,14 @@ frame_update(Client *c)
XClearWindow(dpy, c->bottom); XClearWindow(dpy, c->bottom);
if((TBARH + BORDH + 1) > font->height) if((TBARH + BORDH + 1) > font->height)
draw_text(c->titlebar, {
draw_text(c->titlebar->dr,
(c->frame_geo.width / 2) - (textw(c->title) / 2), (c->frame_geo.width / 2) - (textw(c->title) / 2),
(font->height - (font->descent)) + (((TBARH + BORDH) - font->height) / 2), (font->height - (font->descent)) + (((TBARH + BORDH) - font->height) / 2),
conf.titlebar.fg, c->colors.frame, 0, c->title); conf.titlebar.fg, 0, c->title);
bar_refresh(c->titlebar);
}
return; return;
} }

View File

@ -37,25 +37,37 @@
void void
infobar_init(void) infobar_init(void)
{ {
infobar = emalloc(1, sizeof(InfoBar)); int i, j = 0;
infobar = emalloc(1, sizeof(InfoBar));
infobar->geo.height = font->height * 1.5; infobar->geo.height = font->height * 1.5;
infobar->geo.y = (conf.bartop) ? 0 : MAXH - infobar->geo.height; infobar->geo.y = (conf.bartop) ? 0 : MAXH - infobar->geo.height;
/* Create infobar barwindow */ /* Create infobar barwindow */
infobar->bar = bar_create(root, 0, infobar->geo.y, MAXW, infobar->geo.height, 0, conf.colors.bar, False); infobar->bar = bar_create(root, 0, infobar->geo.y, MAXW, infobar->geo.height, conf.colors.bar, False);
/* Create tags window */
for(i = 1; i < conf.ntag + 1; ++i)
{
infobar->tags[i] = bar_create(infobar->bar->win, j, 0, textw(tags[i].name) + PAD,
infobar->geo.height, conf.colors.bar, False);
j += textw(tags[i].name) + PAD;
XMapSubwindows(dpy, infobar->tags[i]->win);
}
/* Create layout switch & layout type switch barwindow */ /* Create layout switch & layout type switch barwindow */
infobar->layout_switch = bar_create(infobar->bar->win, 0, 0, infobar->layout_button = bar_create(infobar->bar->win, j + PAD / 2, 0,
1, infobar->geo.height - 1, 0, textw(tags[seltag].layout.symbol) + PAD,
conf.colors.layout_bg, False); infobar->geo.height, conf.colors.layout_bg, False);
infobar->layout_type_switch = bar_create(infobar->bar->win, 0, 0,
1, infobar->geo.height,
0, conf.colors.layout_bg, False);
/* Map all */ /* Map all */
bar_map(infobar->bar); bar_map(infobar->bar);
bar_map(infobar->layout_switch); bar_refresh_color(infobar->bar);
bar_refresh(infobar->bar);
XMapSubwindows(dpy, infobar->layout_button->win);
strcpy(infobar->statustext, "WMFS-" WMFS_VERSION); strcpy(infobar->statustext, "WMFS-" WMFS_VERSION);
infobar_draw(); infobar_draw();
@ -67,96 +79,32 @@ infobar_init(void)
void void
infobar_draw(void) infobar_draw(void)
{ {
char buf[256];
/* Refresh bar color */
bar_refresh_color(infobar->bar);
/* Draw taglist */
infobar_draw_taglist(); infobar_draw_taglist();
/* Draw layout symbol */
infobar_draw_layout(); infobar_draw_layout();
bar_refresh_color(infobar->bar);
/* Draw mwfact && nmaster info */
sprintf(buf, "mwfact: %.2f - nmaster: %d",
tags[seltag].mwfact,
tags[seltag].nmaster);
draw_text(infobar->bar->dr, infobar->lastsep + PAD/1.5, font->height, conf.colors.text, conf.colors.bar, 0, buf);
draw_rectangle(infobar->bar->dr, textw(buf) + infobar->lastsep + PAD,
0, conf.tagbordwidth, infobar->geo.height, conf.colors.tagbord);
/* Draw status text */ /* Draw status text */
draw_text(infobar->bar->dr, draw_text(infobar->bar->dr,
MAXW - textw(infobar->statustext), MAXW - textw(infobar->statustext),
font->height, font->height,
conf.colors.text, conf.colors.text, 0, infobar->statustext);
conf.colors.bar, 0, infobar->statustext);
/* Bar border */
if(conf.tagbordwidth)
{
draw_rectangle(infobar->bar->dr, 0, ((conf.bartop) ? infobar->geo.height - 1: 0),
MAXW, 1, conf.colors.tagbord);
draw_rectangle(infobar->bar->dr, MAXW - textw(infobar->statustext) - 5,
0, conf.tagbordwidth, infobar->geo.height, conf.colors.tagbord);
}
/* Refresh the bar */
bar_refresh(infobar->bar); bar_refresh(infobar->bar);
return; return;
} }
/** Draw the layout button in the InfoBar /** Draw the layout button in the InfoBar
*/ */
void void
infobar_draw_layout(void) infobar_draw_layout(void)
{ {
int px, py, width; bar_resize(infobar->layout_button, textw(tags[seltag].layout.symbol) + PAD, infobar->geo.height);
char symbol[256]; bar_refresh_color(infobar->layout_button);
draw_text(infobar->layout_button->dr, PAD / 2, font->height,
/* Set symbol & position */ conf.colors.layout_fg, 0, tags[seltag].layout.symbol);
px = width = taglen[conf.ntag]; bar_refresh(infobar->layout_button);
if(tags[seltag].layout.func == freelayout
|| tags[seltag].layout.func == maxlayout)
strcpy(symbol, tags[seltag].layout.symbol);
else
strcpy(symbol, conf.tile_symbol);
/* Draw layout name/symbol */
bar_refresh_color(infobar->layout_switch);
bar_move(infobar->layout_switch, px, 0);
bar_resize(infobar->layout_switch, textw(symbol) + PAD, infobar->geo.height);
draw_text(infobar->layout_switch->dr, PAD/2, font->height,
conf.colors.layout_fg,
conf.colors.layout_bg,
PAD, symbol);
width += textw(symbol) + PAD;
bar_refresh(infobar->layout_switch);
if(tags[seltag].layout.func != freelayout
&& tags[seltag].layout.func != maxlayout)
{
bar_map(infobar->layout_type_switch);
bar_refresh_color(infobar->layout_type_switch);
bar_move(infobar->layout_type_switch, px + infobar->layout_switch->geo.width + PAD/2, py);
bar_resize(infobar->layout_type_switch, textw(tags[seltag].layout.symbol) + PAD, infobar->geo.height);
draw_text(infobar->layout_type_switch->dr, PAD/2, font->height,
conf.colors.layout_fg,
conf.colors.layout_bg,
PAD, tags[seltag].layout.symbol);
width += textw(tags[seltag].layout.symbol) + PAD * 1.5;
bar_refresh(infobar->layout_type_switch);
}
else
bar_unmap(infobar->layout_type_switch);
/* Draw right separation */
infobar->lastsep = width + PAD / 2;
draw_rectangle(infobar->bar->dr, infobar->lastsep, 0,
conf.tagbordwidth, infobar->geo.height, conf.colors.tagbord);
return; return;
} }
@ -167,31 +115,37 @@ void
infobar_draw_taglist(void) infobar_draw_taglist(void)
{ {
int i; int i;
char buf[conf.ntag][256];
char p[4];
taglen[0] = PAD/2;
for(i = 0; i < conf.ntag; ++i) for(i = 1; i < conf.ntag + 1; ++i)
{ {
/* Make the tags string */ infobar->tags[i]->color = ((i == seltag) ? conf.colors.tagselbg : conf.colors.bar);
ITOA(p, client_pertag(i+1)); bar_refresh_color(infobar->tags[i]);
sprintf(buf[i], "%s<%s>", tags[i+1].name, (client_pertag(i+1)) ? p : ""); draw_text(infobar->tags[i]->dr, PAD / 2, font->height,
/* Draw the string */ ((i == seltag) ? conf.colors.tagselfg : conf.colors.text),
draw_text(infobar->bar->dr, taglen[i], font->height, 0, tags[i].name);
((i+1 == seltag) ? conf.colors.tagselfg : conf.colors.text), bar_refresh(infobar->tags[i]);
((i+1 == seltag) ? conf.colors.tagselbg : conf.colors.bar), PAD, buf[i]);
/* Draw the tag separation */
draw_rectangle(infobar->bar->dr, taglen[i] + textw(buf[i]) + PAD/2,
0, conf.tagbordwidth, infobar->geo.height, conf.colors.tagbord);
/* Edit taglen[i+1] for the next time */
taglen[i+1] = taglen[i] + textw(buf[i]) + PAD + conf.tagbordwidth;
} }
return; return;
} }
void
infobar_destroy(void)
{
int i;
bar_delete(infobar->bar);
for(i = 1; i < conf.ntag + 1; ++i)
{
XFreePixmap(dpy, infobar->tags[i]->dr);
XDestroySubwindows(dpy, infobar->tags[i]->win);
}
XDestroySubwindows(dpy, infobar->layout_button->win);
return;
}
/** Toggle the infobar position /** Toggle the infobar position
* \param cmd uicb_t type unused * \param cmd uicb_t type unused
*/ */

View File

@ -59,11 +59,18 @@ typedef enum { CloseButton = 0, MaxButton = 1, FreeButton = 2, LastButton } Butt
*/ */
typedef struct typedef struct
{ {
/* Frame window */
Window win; Window win;
Drawable dr; Drawable dr;
XRectangle geo; struct
{
/* Border Window */
Window left, right, top, bottom;
/* Border color */
uint dark, light;
} border;
uint color; uint color;
int bord; XRectangle geo;
Bool mapped; Bool mapped;
} BarWindow; } BarWindow;
@ -86,7 +93,8 @@ struct Client
int minax, maxax, minay, maxay; int minax, maxax, minay, maxay;
/* Client composant */ /* Client composant */
Window win; Window win;
Window frame, resize, titlebar; BarWindow *titlebar;
Window frame, resize;
Window right, left, top, bottom; Window right, left, top, bottom;
struct struct
{ {
@ -122,10 +130,9 @@ typedef struct
typedef struct typedef struct
{ {
BarWindow *bar; BarWindow *bar;
BarWindow *layout_switch; BarWindow *layout_button;
BarWindow *layout_type_switch; BarWindow *tags[MAXTAG];
XRectangle geo; XRectangle geo;
int lastsep;
char statustext[1024]; char statustext[1024];
} InfoBar; } InfoBar;

View File

@ -48,6 +48,7 @@ uicb_tag(uicb_t cmd)
if(tmp + seltag < 1 if(tmp + seltag < 1
|| tmp + seltag > conf.ntag) || tmp + seltag > conf.ntag)
return; return;
prevtag = seltag;
seltag += tmp; seltag += tmp;
} }
else else
@ -55,6 +56,7 @@ uicb_tag(uicb_t cmd)
if(tmp == seltag if(tmp == seltag
|| tmp > conf.ntag) || tmp > conf.ntag)
return; return;
prevtag = seltag;
seltag = tmp; seltag = tmp;
} }
arrange(); arrange();

View File

@ -72,9 +72,7 @@ quit(void)
XFreeCursor(dpy, cursor[CurNormal]); XFreeCursor(dpy, cursor[CurNormal]);
XFreeCursor(dpy, cursor[CurMove]); XFreeCursor(dpy, cursor[CurMove]);
XFreeCursor(dpy, cursor[CurResize]); XFreeCursor(dpy, cursor[CurResize]);
bar_delete(infobar->bar); infobar_destroy();
bar_delete(infobar->layout_switch);
bar_delete(infobar->layout_type_switch);
efree(infobar); efree(infobar);
efree(keys); efree(keys);
efree(conf.titlebar.mouse); efree(conf.titlebar.mouse);

View File

@ -84,10 +84,10 @@
#define CHECK(x) if(!x) return #define CHECK(x) if(!x) return
#define ITOA(p ,n) sprintf(p, "%d", n) #define ITOA(p ,n) sprintf(p, "%d", n)
#define deb(p) fprintf(stderr, "debug: %d\n", p) #define deb(p) fprintf(stderr, "debug: %d\n", p)
#define PAD 8 #define PAD 14
/* bar.c */ /* bar.c */
BarWindow *bar_create(Window parent, int x, int y, uint w, uint h, int bord, uint color, Bool entermask); BarWindow *bar_create(Window parent, int x, int y, uint w, uint h, uint color, Bool entermask);
void bar_delete(BarWindow *bw); void bar_delete(BarWindow *bw);
void bar_map(BarWindow *bw); void bar_map(BarWindow *bw);
void bar_unmap(BarWindow *bw); void bar_unmap(BarWindow *bw);
@ -97,7 +97,7 @@ void bar_refresh_color(BarWindow *bw);
void bar_refresh(BarWindow *bw); void bar_refresh(BarWindow *bw);
/* draw.c */ /* draw.c */
void draw_text(Drawable d, int x, int y, char* fg, uint bg, int pad, char *str); void draw_text(Drawable d, int x, int y, char* fg, int pad, char *str);
void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color); void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color);
ushort textw(const char *text); ushort textw(const char *text);
@ -106,6 +106,7 @@ void infobar_init(void);
void infobar_draw(void); void infobar_draw(void);
void infobar_draw_layout(void); void infobar_draw_layout(void);
void infobar_draw_taglist(void); void infobar_draw_taglist(void);
void infobar_destroy(void);
void uicb_infobar_togglepos(uicb_t cmd); void uicb_infobar_togglepos(uicb_t cmd);
/* client.c */ /* client.c */
@ -249,6 +250,7 @@ InfoBar *infobar;
Tag tags[MAXTAG]; Tag tags[MAXTAG];
int taglen[MAXTAG]; int taglen[MAXTAG];
int seltag; int seltag;
int prevtag;
/* Important Client */ /* Important Client */
Client *clients; Client *clients;