mirror of https://github.com/0intro/wmii
fixed issues in wmiimenu
This commit is contained in:
parent
2aeda38ba5
commit
7c7e43b6bf
|
@ -291,7 +291,7 @@ void gravitate(Client * c, unsigned int tabh, unsigned int bw, int invert)
|
|||
void attach_client(Client * c)
|
||||
{
|
||||
Area *a = 0;
|
||||
Page *p = pages;
|
||||
Page *p = selpage;
|
||||
|
||||
fprintf(stderr, "%s", "before alloc_page\n");
|
||||
if (!p)
|
||||
|
|
|
@ -51,6 +51,7 @@ Page *alloc_page()
|
|||
fprintf(stderr, "%s", "after attaching page\n");
|
||||
def[WM_SEL_PAGE]->content = new->file[P_PREFIX]->content;
|
||||
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
|
||||
npages++;
|
||||
return new;
|
||||
}
|
||||
|
||||
|
@ -81,6 +82,7 @@ void destroy_page(Page *p)
|
|||
free(p);
|
||||
if (!selpage)
|
||||
selpage = pages;
|
||||
npages--;
|
||||
|
||||
if (selpage)
|
||||
focus_page(selpage);
|
||||
|
@ -166,7 +168,7 @@ static void toggle_area(void *obj, char *arg)
|
|||
Page *pageat(unsigned int idx)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
Page *p = pages;
|
||||
for (; p && i != idx; p = p->next);
|
||||
Page *p;
|
||||
for (p = pages; p && i != idx; p = p->next);
|
||||
return p;
|
||||
}
|
||||
|
|
10
cmd/wm/wm.c
10
cmd/wm/wm.c
|
@ -184,9 +184,10 @@ static void draw_pager()
|
|||
else
|
||||
d.rect.y = ir * (rect.height - th) / (rows - 1);
|
||||
d.rect.height = th;
|
||||
draw_pager_page(p, &d);
|
||||
if (!p->next)
|
||||
return;
|
||||
draw_pager_page(p, &d);
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,10 +214,11 @@ static Page *xy_to_pager_page(int x, int y)
|
|||
else
|
||||
r.y = ir * (rect.height - th) / (rows - 1);
|
||||
r.height = th;
|
||||
if (!p->next)
|
||||
return nil;
|
||||
if (blitz_ispointinrect(x, y, &r))
|
||||
return p;
|
||||
if (!p->next)
|
||||
return nil;
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
|
@ -427,7 +429,7 @@ static void new_page(void *obj, char *arg)
|
|||
Page *p = selpage;
|
||||
if (p)
|
||||
hide_page(p);
|
||||
alloc_page();
|
||||
selpage = alloc_page();
|
||||
}
|
||||
|
||||
Client *win_to_client(Window w)
|
||||
|
|
|
@ -194,7 +194,7 @@ static void update_offsets()
|
|||
return;
|
||||
|
||||
/* calc next offset */
|
||||
for (i = offset[OFF_CURR]; i && i->next; i = i->next) {
|
||||
for (i = offset[OFF_CURR]; i; i = i->next) {
|
||||
w += XTextWidth(font, i->file->content, strlen(i->file->content)) + mrect.height;
|
||||
if (w > mrect.width)
|
||||
break;
|
||||
|
@ -207,8 +207,7 @@ static void update_offsets()
|
|||
if (w > mrect.width)
|
||||
break;
|
||||
}
|
||||
if (i)
|
||||
offset[OFF_PREV] = i->next;
|
||||
offset[OFF_PREV] = i;
|
||||
}
|
||||
|
||||
static size_t update_items(char *pattern)
|
||||
|
@ -314,7 +313,7 @@ static void draw_menu()
|
|||
if (sel) {
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, files[M_NORM_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, files[M_NORM_TEXT_COLOR]->content);
|
||||
d.data = offset[OFF_CURR] ? "<" : nil;
|
||||
d.data = offset[OFF_PREV] ? "<" : nil;
|
||||
d.rect.x = offx;
|
||||
d.rect.width = seek;
|
||||
offx += d.rect.width;
|
||||
|
@ -342,7 +341,7 @@ static void draw_menu()
|
|||
|
||||
d.bg = blitz_loadcolor(dpy, screen_num, files[M_NORM_BG_COLOR]->content);
|
||||
d.fg = blitz_loadcolor(dpy, screen_num, files[M_NORM_TEXT_COLOR]->content);
|
||||
d.data = i ? ">" : nil;
|
||||
d.data = offset[OFF_NEXT] ? ">" : nil;
|
||||
d.rect.x = mrect.width - seek;
|
||||
d.rect.width = seek;
|
||||
blitz_drawlabelnoborder(dpy, &d);
|
||||
|
@ -473,7 +472,7 @@ static void handle_kpress(XKeyEvent * e)
|
|||
if (sel == offset[OFF_CURR]->prev) {
|
||||
offset[OFF_CURR] = offset[OFF_PREV];
|
||||
update_offsets();
|
||||
} else if (sel == offset[OFF_NEXT]->next) {
|
||||
} else if (sel == offset[OFF_NEXT]) {
|
||||
offset[OFF_CURR] = offset[OFF_NEXT];
|
||||
update_offsets();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue