mirror of
https://github.com/0intro/wmii
synced 2024-11-22 22:02:30 +03:00
fixed annoying bug in wmikeys after introduction of container
This commit is contained in:
parent
38f1663df9
commit
5b66795946
12
cmd/wmibar.c
12
cmd/wmibar.c
@ -45,7 +45,6 @@ static int displayed = 0;
|
|||||||
static char *sockfile = 0;
|
static char *sockfile = 0;
|
||||||
static File *file[B_LAST];
|
static File *file[B_LAST];
|
||||||
static Container items = {0};
|
static Container items = {0};
|
||||||
static unsigned int id = 0;
|
|
||||||
static Pixmap pmap;
|
static Pixmap pmap;
|
||||||
static XFontStruct *font;
|
static XFontStruct *font;
|
||||||
|
|
||||||
@ -125,12 +124,12 @@ static void _destroy(void *obj, char *arg)
|
|||||||
static void reset(void *obj, char *arg)
|
static void reset(void *obj, char *arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
size_t size = cext_sizeof(&items);
|
||||||
char buf[512];
|
char buf[512];
|
||||||
for (i = 0; i < id; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
snprintf(buf, sizeof(buf), "/%d", i + 1);
|
snprintf(buf, sizeof(buf), "/%d", i + 1);
|
||||||
ixps->remove(ixps, buf);
|
ixps->remove(ixps, buf);
|
||||||
}
|
}
|
||||||
id = 0;
|
|
||||||
draw_bar(0, 0);
|
draw_bar(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +200,7 @@ static void draw()
|
|||||||
if (!size)
|
if (!size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
expandable = _strtonum(file[B_EXPANDABLE]->content, 0, id);
|
expandable = _strtonum(file[B_EXPANDABLE]->content, 0, size);
|
||||||
snprintf(buf, sizeof(buf), "/%d", expandable);
|
snprintf(buf, sizeof(buf), "/%d", expandable);
|
||||||
if (!ixp_walk(ixps, buf))
|
if (!ixp_walk(ixps, buf))
|
||||||
expandable = 0;
|
expandable = 0;
|
||||||
@ -417,14 +416,13 @@ static void handle_before_read(IXPServer * s, File * f)
|
|||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
if (f == file[B_GEOMETRY]) {
|
if (f == file[B_GEOMETRY]) {
|
||||||
snprintf(buf, sizeof(buf), "%d,%d,%d,%d", brect.x, brect.y,
|
snprintf(buf, sizeof(buf), "%d,%d,%d,%d", brect.x, brect.y, brect.width, brect.height);
|
||||||
brect.width, brect.height);
|
|
||||||
if (f->content)
|
if (f->content)
|
||||||
free(f->content);
|
free(f->content);
|
||||||
f->content = strdup(buf);
|
f->content = strdup(buf);
|
||||||
f->size = strlen(buf);
|
f->size = strlen(buf);
|
||||||
} else if (f == file[B_NEW]) {
|
} else if (f == file[B_NEW]) {
|
||||||
snprintf(buf, sizeof(buf), "%d", ++id);
|
snprintf(buf, sizeof(buf), "%d", cext_sizeof(&items));
|
||||||
if (f->content)
|
if (f->content)
|
||||||
free(f->content);
|
free(f->content);
|
||||||
f->content = strdup(buf);
|
f->content = strdup(buf);
|
||||||
|
@ -187,17 +187,14 @@ static void emulate_key_press(unsigned long mod, KeyCode key)
|
|||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void handle_shortcut_chain(Window w, Shortcut * processed, char *prefix, int grab)
|
||||||
handle_shortcut_chain(Window w, Shortcut * processed, char *prefix,
|
|
||||||
int grab)
|
|
||||||
{
|
{
|
||||||
unsigned long mod;
|
unsigned long mod;
|
||||||
KeyCode key;
|
KeyCode key;
|
||||||
Shortcut *s = processed->next;
|
Shortcut *s = processed->next;
|
||||||
|
|
||||||
if (grab) {
|
if (grab) {
|
||||||
XGrabKeyboard(dpy, w, True, GrabModeAsync,
|
XGrabKeyboard(dpy, w, True, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
GrabModeAsync, CurrentTime);
|
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
}
|
}
|
||||||
draw_shortcut_box(prefix);
|
draw_shortcut_box(prefix);
|
||||||
@ -237,7 +234,7 @@ static void handle_shortcut_gkb(Window w, unsigned long mod, KeyCode key)
|
|||||||
comp.mod = mod;
|
comp.mod = mod;
|
||||||
comp.key = key;
|
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) {
|
if (s && s->cmdfile && s->cmdfile->content) {
|
||||||
spawn(dpy, s->cmdfile->content);
|
spawn(dpy, s->cmdfile->content);
|
||||||
return;
|
return;
|
||||||
@ -254,7 +251,7 @@ static void handle_shortcut(Window w, unsigned long mod, KeyCode key)
|
|||||||
comp.mod = mod;
|
comp.mod = mod;
|
||||||
comp.key = key;
|
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) {
|
if (s && s->cmdfile && s->cmdfile->content) {
|
||||||
spawn(dpy, s->cmdfile->content);
|
spawn(dpy, s->cmdfile->content);
|
||||||
return;
|
return;
|
||||||
|
@ -182,8 +182,7 @@ static void update_offsets()
|
|||||||
|
|
||||||
|
|
||||||
w = cmdw + 2 * seek;
|
w = cmdw + 2 * seek;
|
||||||
for (i = offset[OFF_CURR] - 1; i >= 0; i--) {
|
for (i = offset[OFF_CURR] - 1; (i >= 0) && (item = cext_list_get_item(&items, i)); i--) {
|
||||||
item = cext_list_get_item(&items, i);
|
|
||||||
w += XTextWidth(font, item->content, strlen(item->content)) + mrect.height;
|
w += XTextWidth(font, item->content, strlen(item->content)) + mrect.height;
|
||||||
if (w > mrect.width)
|
if (w > mrect.width)
|
||||||
break;
|
break;
|
||||||
|
2
rc/wmirc
2
rc/wmirc
@ -90,7 +90,7 @@ wmir write /bar/$clab/bgcolor $SEL_BG_COLOR
|
|||||||
wmir write /bar/$clab/bordercolor $SEL_BG_COLOR
|
wmir write /bar/$clab/bordercolor $SEL_BG_COLOR
|
||||||
barsucks $clab
|
barsucks $clab
|
||||||
|
|
||||||
wmir write /bar/expandable 2
|
wmir write /bar/expandable 1
|
||||||
wmir write /bar/geometry 0,south,east,$BAR_HEIGHT
|
wmir write /bar/geometry 0,south,east,$BAR_HEIGHT
|
||||||
wmir write /bar/ctl 'display 1'
|
wmir write /bar/ctl 'display 1'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user