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 *, ...) int xasprintf(char **, const char *, ...)
__attribute__((__format__ (printf, 2, 3))) __attribute__((__format__ (printf, 2, 3)))
__attribute__((__nonnull__ (2))); __attribute__((__nonnull__ (2)));
int xvasprintf(char **, const char *, va_list)
__attribute__((__nonnull__ (2)));
#endif /* _CALMWM_H_ */ #endif /* _CALMWM_H_ */

View File

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

3
conf.c
View File

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

18
cwmrc.5
View File

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

View File

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

View File

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

View File

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