mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
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.
This commit is contained in:
commit
2d9185129b
22
client.c
22
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
10
cwmrc.5
10
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
|
||||
|
12
menu.c
12
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') {
|
||||
if (mc->changed) {
|
||||
if (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) {
|
||||
} else if (!mc->list && mc->listing) {
|
||||
TAILQ_INIT(resultq);
|
||||
mc->listing = 0;
|
||||
}
|
||||
|
11
search.c
11
search.c
@ -148,12 +148,11 @@ static void
|
||||
search_match_path_type(struct menu_q *menuq, struct menu_q *resultq,
|
||||
char *search, int flag)
|
||||
{
|
||||
struct menu *mi;
|
||||
char pattern[PATH_MAX];
|
||||
glob_t g;
|
||||
int i;
|
||||
|
||||
TAILQ_INIT(resultq);
|
||||
|
||||
(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
|
||||
|
Loading…
Reference in New Issue
Block a user