diff --git a/client.c b/client.c index 6f27b27..ae522e3 100644 --- a/client.c +++ b/client.c @@ -645,7 +645,7 @@ match: void client_cycle(struct screen_ctx *sc, int flags) { - struct client_ctx *newcc, *oldcc; + struct client_ctx *newcc, *oldcc, *prevcc; int again = 1; /* For X apps that ignore events. */ @@ -655,6 +655,7 @@ client_cycle(struct screen_ctx *sc, int flags) if (TAILQ_EMPTY(&sc->clientq)) return; + prevcc = TAILQ_FIRST(&sc->clientq); oldcc = client_current(); if (oldcc == NULL) oldcc = (flags & CWM_CYCLE_REVERSE) ? @@ -686,6 +687,7 @@ client_cycle(struct screen_ctx *sc, int flags) /* reset when cycling mod is released. XXX I hate this hack */ sc->cycling = 1; client_ptrsave(oldcc); + client_raise(prevcc); client_raise(newcc); if (!client_inbound(newcc, newcc->ptr.x, newcc->ptr.y)) { newcc->ptr.x = newcc->geom.w / 2; @@ -956,7 +958,7 @@ client_htile(struct client_ctx *cc) struct group_ctx *gc = cc->gc; struct screen_ctx *sc = cc->sc; struct geom area; - int i, n, mh, x, h, w; + int i, n, mh, x, w, h; if (!gc) return; @@ -983,6 +985,7 @@ client_htile(struct client_ctx *cc) cc->geom.x = area.x; cc->geom.y = area.y; cc->geom.w = area.w - (cc->bwidth * 2); + cc->geom.h = (area.h - (cc->bwidth * 2)) / 2; client_resize(cc, 1); client_ptrwarp(cc); @@ -995,16 +998,16 @@ client_htile(struct client_ctx *cc) ci->flags & CLIENT_IGNORE || (ci == cc)) continue; ci->bwidth = Conf.bwidth; - ci->geom.y = area.y + mh; ci->geom.x = x; - ci->geom.h = h - (ci->bwidth * 2); + ci->geom.y = area.y + mh; ci->geom.w = w - (ci->bwidth * 2); + ci->geom.h = h - (ci->bwidth * 2); if (i + 1 == n) ci->geom.w = area.x + area.w - ci->geom.x - (ci->bwidth * 2); x += w; - client_resize(ci, 1); i++; + client_resize(ci, 1); } } @@ -1015,7 +1018,7 @@ client_vtile(struct client_ctx *cc) struct group_ctx *gc = cc->gc; struct screen_ctx *sc = cc->sc; struct geom area; - int i, n, mw, y, h, w; + int i, n, mw, y, w, h; if (!gc) return; @@ -1041,6 +1044,7 @@ client_vtile(struct client_ctx *cc) cc->flags &= ~CLIENT_VMAXIMIZED; cc->geom.x = area.x; cc->geom.y = area.y; + cc->geom.w = (area.w - (cc->bwidth * 2)) / 2; cc->geom.h = area.h - (cc->bwidth * 2); client_resize(cc, 1); client_ptrwarp(cc); @@ -1054,16 +1058,16 @@ client_vtile(struct client_ctx *cc) ci->flags & CLIENT_IGNORE || (ci == cc)) continue; ci->bwidth = Conf.bwidth; - ci->geom.y = y; ci->geom.x = area.x + mw; - ci->geom.h = h - (ci->bwidth * 2); + ci->geom.y = y; ci->geom.w = w - (ci->bwidth * 2); + ci->geom.h = h - (ci->bwidth * 2); if (i + 1 == n) ci->geom.h = area.y + area.h - ci->geom.y - (ci->bwidth * 2); y += h; - client_resize(ci, 1); i++; + client_resize(ci, 1); } } diff --git a/cwmrc.5 b/cwmrc.5 index d46dc7f..389083e 100644 --- a/cwmrc.5 +++ b/cwmrc.5 @@ -324,11 +324,13 @@ Vertically maximize current window (gap + border honored). .It window-hmaximize Horizontally maximize current window (gap + border honored). .It window-htile -Current window is placed at the top of the screen and maximized -horizontally, other windows in its group share remaining screen space. +Current window is placed at the top of the screen, maximized +horizontally and resized to half of the vertical screen space. Other +windows in its group share remaining screen space. .It window-vtile -Current window is placed on the left of the screen and maximized -vertically, other windows in its group share remaining screen space. +Current window is placed on the left of the screen, maximized vertically +and resized to half of the horizontal screen space. Other windows in its +group share remaining screen space. .It window-move Move current window. .It window-resize diff --git a/menu.c b/menu.c index af13cbf..d3db032 100644 --- a/menu.c +++ b/menu.c @@ -52,7 +52,6 @@ struct menu_ctx { int list; int listing; int changed; - int noresult; int prev; int entry; int num; @@ -313,15 +312,10 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, (void)strlcat(mc->searchstr, chr, sizeof(mc->searchstr)); } - mc->noresult = 0; - if (mc->changed && mc->searchstr[0] != '\0') { - (*mc->match)(menuq, resultq, mc->searchstr); - /* If menuq is empty, never show we've failed */ - mc->noresult = TAILQ_EMPTY(resultq) && !TAILQ_EMPTY(menuq); - } else if (mc->changed) - TAILQ_INIT(resultq); - - if (!mc->list && mc->listing && !mc->changed) { + if (mc->changed) { + if (mc->searchstr[0] != '\0') + (*mc->match)(menuq, resultq, mc->searchstr); + } else if (!mc->list && mc->listing) { TAILQ_INIT(resultq); mc->listing = 0; } diff --git a/search.c b/search.c index e50884a..63ebdbd 100644 --- a/search.c +++ b/search.c @@ -148,11 +148,10 @@ static void search_match_path_type(struct menu_q *menuq, struct menu_q *resultq, char *search, int flag) { - char pattern[PATH_MAX]; - glob_t g; - int i; - - TAILQ_INIT(resultq); + struct menu *mi; + char pattern[PATH_MAX]; + glob_t g; + int i; (void)strlcpy(pattern, search, sizeof(pattern)); (void)strlcat(pattern, "*", sizeof(pattern)); @@ -162,7 +161,9 @@ search_match_path_type(struct menu_q *menuq, struct menu_q *resultq, for (i = 0; i < g.gl_pathc; i++) { if ((flag & PATH_EXEC) && access(g.gl_pathv[i], X_OK)) continue; - menuq_add(resultq, NULL, "%s", g.gl_pathv[i]); + mi = xcalloc(1, sizeof(*mi)); + (void)strlcpy(mi->text, g.gl_pathv[i], sizeof(mi->text)); + TAILQ_INSERT_TAIL(resultq, mi, resultentry); } globfree(&g); } @@ -170,7 +171,9 @@ search_match_path_type(struct menu_q *menuq, struct menu_q *resultq, void search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search) { - return(search_match_path_type(menuq, resultq, search, PATH_ANY)); + TAILQ_INIT(resultq); + + search_match_path_type(menuq, resultq, search, PATH_ANY); } void