diff options
author | okan <okan> | 2017-04-25 13:40:33 +0000 |
---|---|---|
committer | okan <okan> | 2017-04-25 13:40:33 +0000 |
commit | 2d9185129bbf40029ae35cbdc9667e1c777593fe (patch) | |
tree | 4f89c96f6bbf84c6f140f2aac24ddafb63023a15 | |
parent | ab8da6180277713fd99be23ceb341f5ce3a75522 (diff) | |
parent | 15b9a8fe27a72e58f1fb488ebf14c3fcae4b98a9 (diff) | |
download | cwm-2d9185129bbf40029ae35cbdc9667e1c777593fe.tar.gz cwm-2d9185129bbf40029ae35cbdc9667e1c777593fe.tar.xz cwm-2d9185129bbf40029ae35cbdc9667e1c777593fe.zip |
cvsimport
* refs/heads/master: The r1.36 menuq_add() conversion did this one wrong; fix by reverting to the original code which adds to resultentry list, as opposed to the wrong one in menuq_add(). Fixes crash noticed by at least Rickard Gustafsson. Remove 'noresult' (and simplify) as it does nothing and makes the logic around it needless. History doesn't show what this might have been used for in future iterations. search_match_path() isn't supposed to return anything. Move queue init to caller so it's only called once in a few cases. sort Raise the previously focused window, instead of the previous window in the cycle list; seems to match behaviour of other wm's; from Walter Alejandro Iglesias. For {h,v}tile, instead of keeping the master client's {h,v} geometry, expand it to %50 of the area, then fill in the remaining space with the other clients in the same group; from Gerrit Meyerheim.
-rw-r--r-- | client.c | 22 | ||||
-rw-r--r-- | cwmrc.5 | 10 | ||||
-rw-r--r-- | menu.c | 14 | ||||
-rw-r--r-- | search.c | 17 |
4 files changed, 33 insertions, 30 deletions
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 |