wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 5b6679594633a31f0abb189ad0eab8327bded9a1
parent 38f1663df99f658da5b58b3f5ac28114aa63ade2
Author: garbeam <garbeam@localhost.localdomain>
Date:   Thu,  8 Dec 2005 19:14:20 +0200

fixed annoying bug in wmikeys after introduction of container


Diffstat:
cmd/wmibar.c | 12+++++-------
cmd/wmikeys.c | 11++++-------
cmd/wmimenu.c | 3+--
rc/wmirc | 2+-
4 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/cmd/wmibar.c b/cmd/wmibar.c @@ -45,7 +45,6 @@ static int displayed = 0; static char *sockfile = 0; static File *file[B_LAST]; static Container items = {0}; -static unsigned int id = 0; static Pixmap pmap; static XFontStruct *font; @@ -125,12 +124,12 @@ static void _destroy(void *obj, char *arg) static void reset(void *obj, char *arg) { int i; + size_t size = cext_sizeof(&items); char buf[512]; - for (i = 0; i < id; i++) { + for (i = 0; i < size; i++) { snprintf(buf, sizeof(buf), "/%d", i + 1); ixps->remove(ixps, buf); } - id = 0; draw_bar(0, 0); } @@ -201,7 +200,7 @@ static void draw() if (!size) return; - expandable = _strtonum(file[B_EXPANDABLE]->content, 0, id); + expandable = _strtonum(file[B_EXPANDABLE]->content, 0, size); snprintf(buf, sizeof(buf), "/%d", expandable); if (!ixp_walk(ixps, buf)) expandable = 0; @@ -417,14 +416,13 @@ static void handle_before_read(IXPServer * s, File * f) { char buf[64]; if (f == file[B_GEOMETRY]) { - snprintf(buf, sizeof(buf), "%d,%d,%d,%d", brect.x, brect.y, - brect.width, brect.height); + snprintf(buf, sizeof(buf), "%d,%d,%d,%d", brect.x, brect.y, brect.width, brect.height); if (f->content) free(f->content); f->content = strdup(buf); f->size = strlen(buf); } else if (f == file[B_NEW]) { - snprintf(buf, sizeof(buf), "%d", ++id); + snprintf(buf, sizeof(buf), "%d", cext_sizeof(&items)); if (f->content) free(f->content); f->content = strdup(buf); diff --git a/cmd/wmikeys.c b/cmd/wmikeys.c @@ -187,17 +187,14 @@ static void emulate_key_press(unsigned long mod, KeyCode key) XSync(dpy, False); } -static void -handle_shortcut_chain(Window w, Shortcut * processed, char *prefix, - int grab) +static void handle_shortcut_chain(Window w, Shortcut * processed, char *prefix, int grab) { unsigned long mod; KeyCode key; Shortcut *s = processed->next; if (grab) { - XGrabKeyboard(dpy, w, True, GrabModeAsync, - GrabModeAsync, CurrentTime); + XGrabKeyboard(dpy, w, True, GrabModeAsync, GrabModeAsync, CurrentTime); XMapRaised(dpy, win); } draw_shortcut_box(prefix); @@ -237,7 +234,7 @@ static void handle_shortcut_gkb(Window w, unsigned long mod, KeyCode key) comp.mod = mod; comp.key = key; - s = cext_find_item(&shortcuts, &s, comp_shortcut); + s = cext_find_item(&shortcuts, &comp, comp_shortcut); if (s && s->cmdfile && s->cmdfile->content) { spawn(dpy, s->cmdfile->content); return; @@ -254,7 +251,7 @@ static void handle_shortcut(Window w, unsigned long mod, KeyCode key) comp.mod = mod; comp.key = key; - s = cext_find_item(&shortcuts, &s, comp_shortcut); + s = cext_find_item(&shortcuts, &comp, comp_shortcut); if (s && s->cmdfile && s->cmdfile->content) { spawn(dpy, s->cmdfile->content); return; diff --git a/cmd/wmimenu.c b/cmd/wmimenu.c @@ -182,8 +182,7 @@ static void update_offsets() w = cmdw + 2 * seek; - for (i = offset[OFF_CURR] - 1; i >= 0; i--) { - item = cext_list_get_item(&items, i); + for (i = offset[OFF_CURR] - 1; (i >= 0) && (item = cext_list_get_item(&items, i)); i--) { w += XTextWidth(font, item->content, strlen(item->content)) + mrect.height; if (w > mrect.width) break; diff --git a/rc/wmirc b/rc/wmirc @@ -90,7 +90,7 @@ wmir write /bar/$clab/bgcolor $SEL_BG_COLOR wmir write /bar/$clab/bordercolor $SEL_BG_COLOR barsucks $clab -wmir write /bar/expandable 2 +wmir write /bar/expandable 1 wmir write /bar/geometry 0,south,east,$BAR_HEIGHT wmir write /bar/ctl 'display 1'