mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
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:
commit
54d95c0610
2
calmwm.h
2
calmwm.h
@ -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_ */
|
||||||
|
6
client.c
6
client.c
@ -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
3
conf.c
@ -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
18
cwmrc.5
@ -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
|
||||||
|
1
kbfunc.c
1
kbfunc.c
@ -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
|
||||||
|
5
screen.c
5
screen.c
@ -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);
|
||||||
|
@ -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)
|
||||||
|
17
xmalloc.c
17
xmalloc.c
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user