BarWindow/Event: Make barwindows linked to improve render with expose event

This commit is contained in:
Martin Duquesnoy 2011-07-29 11:53:22 +02:00
parent 4e2459318c
commit 9c3130a17c
6 changed files with 37 additions and 25 deletions

View File

@ -100,6 +100,9 @@ barwin_create(Window parent,
FLAGAPPLY(bw->flags, stipple, StippleFlag);
bw->stipple_color = -1;
/* Attach */
SLIST_INSERT_HEAD(&bwhead, bw, next);
return bw;
}
@ -144,6 +147,7 @@ barwin_color_set(BarWindow *bw, uint bg, char *fg)
void
barwin_delete(BarWindow *bw)
{
SLIST_REMOVE(&bwhead, bw, BarWindow, next);
XSelectInput(dpy, bw->win, NoEventMask);
XDestroyWindow(dpy, bw->win);
XFreePixmap(dpy, bw->dr);

View File

@ -402,21 +402,15 @@ expose(XEvent *e)
{
XExposeEvent *ev = &e->xexpose;
Client *c;
int i, sc;
BarWindow *bw;
/* InfoBar member */
for(sc = 0; sc < screen_count(); ++sc)
{
if(ev->window == infobar[sc].bar->win)
barwin_refresh(infobar[sc].bar);
if(ev->window == infobar[sc].layout_button->win)
barwin_refresh(infobar[sc].layout_button);
if(conf.bars.selbar && ev->window == infobar[sc].selbar->win)
barwin_refresh(infobar[sc].selbar);
for(i = 1; i < conf.ntag[sc] + 1; ++i)
if(ev->window == infobar[sc].tags[i]->win)
barwin_refresh(infobar[sc].tags[i]);
}
/* BarWindows */
SLIST_FOREACH(bw, &bwhead, next)
if(ev->window == bw->win)
{
barwin_refresh(bw);
break;
}
/* Client frame */
if((c = client_gb_titlebar(ev->window)))

View File

@ -201,6 +201,11 @@ init_root(void)
void
init(void)
{
/* Init lists heads */
SLIST_INIT(&bwhead);
SLIST_INIT(&clients);
SLIST_INIT(&trayicons);
/* First init */
ewmh_init_hints();
init_conf();
@ -216,10 +221,6 @@ init(void)
ewmh_update_current_tag_prop();
grabkeys();
/* Init lists heads */
SLIST_INIT(&clients);
SLIST_INIT(&trayicons);
return;
}

View File

@ -184,7 +184,7 @@ typedef struct
* BarWindow Structure
* (titlebar, infobar..)
*/
typedef struct
typedef struct BarWindow
{
Window win;
Drawable dr;
@ -201,11 +201,11 @@ typedef struct
uint stipple_color;
Geo geo;
uint flags;
SLIST_ENTRY(BarWindow) next;
} BarWindow;
/* Client Structure. */
typedef struct Client Client;
struct Client
typedef struct Client
{
/* Client title */
char *title;
@ -246,7 +246,7 @@ struct Client
uint flags;
/* Simply-linked list */
SLIST_ENTRY(Client) next;
};
} Client;
/* Keybind Structure */
typedef struct

View File

@ -80,6 +80,7 @@ void
quit(void)
{
Client *c;
BarWindow *bw;
size_t i, len;
/* Set the silent error handler */
@ -112,6 +113,13 @@ quit(void)
XFreeGC(dpy, gc_stipple);
infobar_destroy();
/* BarWindows */
while(!SLIST_EMPTY(&bwhead))
{
bw = SLIST_FIRST(&bwhead);
SLIST_REMOVE_HEAD(&bwhead, next);
}
free(sgeo);
free(spgeo);
free(infobar);

View File

@ -436,7 +436,7 @@ void uicb_reload(uicb_t);
/* Variables */
/* Principal */
/* Main */
Display *dpy;
GC gc, gc_stipple;
int selscreen;
@ -472,20 +472,25 @@ struct clndx {
Client *client;
} clist_index[MAXCLIST];
/* Important Client */
/* Client */
SLIST_HEAD(, Client) clients;
Client *sel;
/* Other */
/* Event */
int nevent;
void (**event_handle)(XEvent*);
extern const func_name_list_t func_list[];
extern const func_name_list_t layout_list[];
uint numlockmask;
/* Systray */
SLIST_HEAD(, Systray) trayicons;
Window traywin;
int tray_width;
/* BarWindow */
SLIST_HEAD(, BarWindow) bwhead;
#endif /* WMFS_H */