cvsimport

* refs/heads/master:
  Allow the 'empty' group clients to be window-{h,v}tile'd.
  Map ('5') and allow mod5mask (altgr) as a modifier.
  add, then use, xvasprintf, checking for appropriate return.
  Ensure the pointer stays within client bounds after a window 'snap' (to edge).
This commit is contained in:
okan 2020-02-07 18:53:41 +00:00
commit 54d95c0610
8 changed files with 26 additions and 28 deletions

View File

@ -619,5 +619,7 @@ char *xstrdup(const char *);
int xasprintf(char **, const char *, ...)
__attribute__((__format__ (printf, 2, 3)))
__attribute__((__nonnull__ (2)));
int xvasprintf(char **, const char *, va_list)
__attribute__((__nonnull__ (2)));
#endif /* _CALMWM_H_ */

View File

@ -971,10 +971,7 @@ client_htile(struct client_ctx *cc)
struct geom area;
int i, n, mh, x, w, h;
if (!cc->gc)
return;
i = n = 0;
area = screen_area(sc,
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2, CWM_GAP);
@ -1042,10 +1039,7 @@ client_vtile(struct client_ctx *cc)
struct geom area;
int i, n, mw, y, w, h;
if (!cc->gc)
return;
i = n = 0;
area = screen_area(sc,
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2, CWM_GAP);

3
conf.c
View File

@ -197,10 +197,11 @@ static const struct {
const char ch;
int mask;
} bind_mods[] = {
{ 'S', ShiftMask },
{ 'C', ControlMask },
{ 'M', Mod1Mask },
{ '4', Mod4Mask },
{ 'S', ShiftMask },
{ '5', Mod5Mask },
};
static const struct {
const char *key;

18
cwmrc.5
View File

@ -84,6 +84,8 @@ Meta key.
Shift key.
.It Ic 4
Mod4 (windows) key.
.It Ic 5
Mod5 (AltGr) key.
.El
.Pp
The
@ -101,18 +103,10 @@ The modifier keys come first, followed by a
.Sq - ,
then the button number.
.Pp
The following modifiers are recognised:
.Pp
.Bl -tag -width Ds -offset indent -compact
.It Ic C
Control key.
.It Ic M
Meta key.
.It Ic S
Shift key.
.It Ic 4
Mod4 (windows) key.
.El
The same modifiers are recognised as for
.Ar key
in
.Nm bind-key .
.Pp
The following buttons are recognised:
.Pp

View File

@ -325,6 +325,7 @@ kbfunc_client_snap(void *ctx, struct cargs *cargs)
}
}
client_move(cc);
client_ptr_inbound(cc, 1);
}
void

View File

@ -275,15 +275,12 @@ void
screen_prop_win_draw(struct screen_ctx *sc, const char *fmt, ...)
{
va_list ap;
int i;
char *text;
XGlyphInfo extents;
va_start(ap, fmt);
i = vasprintf(&text, fmt, ap);
xvasprintf(&text, fmt, ap);
va_end(ap);
if (i < 0 || text == NULL)
err(1, "vasprintf");
XftTextExtentsUtf8(X_Dpy, sc->xftfont, (const FcChar8*)text,
strlen(text), &extents);

View File

@ -69,7 +69,7 @@ void (*xev_handlers[LASTEvent])(XEvent *) = {
};
static KeySym modkeys[] = { XK_Alt_L, XK_Alt_R, XK_Super_L, XK_Super_R,
XK_Control_L, XK_Control_R };
XK_Control_L, XK_Control_R, XK_ISO_Level3_Shift };
static void
xev_handle_maprequest(XEvent *ee)

View File

@ -91,11 +91,20 @@ xasprintf(char **ret, const char *fmt, ...)
int i;
va_start(ap, fmt);
i = vasprintf(ret, fmt, ap);
i = xvasprintf(ret, fmt, ap);
va_end(ap);
if (i < 0 || *ret == NULL)
err(1, "asprintf");
return(i);
}
int
xvasprintf(char **ret, const char *fmt, va_list ap)
{
int i;
i = vasprintf(ret, fmt, ap);
if (i == -1)
err(1, "vasprintf");
return(i);
}