mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
* refs/heads/master: cycling fix: when no client is active, warp pointer to last active; from Walter Alejandro Iglesias. whitespace Fix spelling of some unused MWM hints; from Sean C. Farley. Add group-last command that shows only the previously active group; ok okan Allow bare numbers for key and mouse bindings; taken from similar support in other parse.y's; from Leon Fischer <lfischer@airmail.cc>. sync parse.y changes from base; ok naddy@ Do not attempt to grab keys without a keycode; this incidentally allows XF86 keys support.
This commit is contained in:
commit
7af3a7b8b6
49
calmwm.h
49
calmwm.h
@ -235,6 +235,7 @@ struct screen_ctx {
|
|||||||
struct region_q regionq;
|
struct region_q regionq;
|
||||||
struct group_q groupq;
|
struct group_q groupq;
|
||||||
struct group_ctx *group_active;
|
struct group_ctx *group_active;
|
||||||
|
struct group_ctx *group_last;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
struct {
|
struct {
|
||||||
@ -329,30 +330,39 @@ struct conf {
|
|||||||
|
|
||||||
/* MWM hints */
|
/* MWM hints */
|
||||||
struct mwm_hints {
|
struct mwm_hints {
|
||||||
#define MWM_HINTS_ELEMENTS 3L
|
#define MWM_HINTS_ELEMENTS 5L
|
||||||
#define MWM_FLAGS_STATUS (1<<3)
|
|
||||||
|
|
||||||
#define MWM_FLAGS_FUNCTIONS (1<<0)
|
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||||
#define MWM_FLAGS_DECORATIONS (1<<1)
|
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||||
#define MWM_FLAGS_INPUT_MODE (1<<2)
|
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
||||||
|
#define MWM_HINTS_STATUS (1L << 3)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
#define MWM_FUNCS_ALL (1<<0)
|
#define MWM_FUNC_ALL (1L << 0)
|
||||||
#define MWM_FUNCS_RESIZE (1<<1)
|
#define MWM_FUNC_RESIZE (1L << 1)
|
||||||
#define MWM_FUNCS_MOVE (1<<2)
|
#define MWM_FUNC_MOVE (1L << 2)
|
||||||
#define MWM_FUNCS_MINIMIZE (1<<3)
|
#define MWM_FUNC_MINIMIZE (1L << 3)
|
||||||
#define MWM_FUNCS_MAXIMIZE (1<<4)
|
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
||||||
#define MWM_FUNCS_CLOSE (1<<5)
|
#define MWM_FUNC_CLOSE (1L << 5)
|
||||||
unsigned long functions;
|
unsigned long functions;
|
||||||
|
|
||||||
#define MWM_DECOR_ALL (1<<0)
|
#define MWM_DECOR_ALL (1L << 0)
|
||||||
#define MWM_DECOR_BORDER (1<<1)
|
#define MWM_DECOR_BORDER (1L << 1)
|
||||||
#define MWM_DECOR_RESIZE_HANDLE (1<<2)
|
#define MWM_DECOR_RESIZEH (1L << 2)
|
||||||
#define MWM_DECOR_TITLEBAR (1<<3)
|
#define MWM_DECOR_TITLE (1L << 3)
|
||||||
#define MWM_DECOR_MENU (1<<4)
|
#define MWM_DECOR_MENU (1L << 4)
|
||||||
#define MWM_DECOR_MINIMIZE (1<<5)
|
#define MWM_DECOR_MINIMIZE (1L << 5)
|
||||||
#define MWM_DECOR_MAXIMIZE (1<<6)
|
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
||||||
unsigned long decorations;
|
unsigned long decorations;
|
||||||
|
|
||||||
|
#define MWM_INPUT_MODELESS 0
|
||||||
|
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
|
||||||
|
#define MWM_INPUT_SYSTEM_MODAL 2
|
||||||
|
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
|
||||||
|
long inputMode;
|
||||||
|
|
||||||
|
#define MWM_TEAROFF_WINDOW (1L << 0)
|
||||||
|
unsigned long status;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum cwmh {
|
enum cwmh {
|
||||||
@ -524,6 +534,7 @@ void kbfunc_client_toggle_group(void *, struct cargs *);
|
|||||||
void kbfunc_client_movetogroup(void *, struct cargs *);
|
void kbfunc_client_movetogroup(void *, struct cargs *);
|
||||||
void kbfunc_group_toggle(void *, struct cargs *);
|
void kbfunc_group_toggle(void *, struct cargs *);
|
||||||
void kbfunc_group_only(void *, struct cargs *);
|
void kbfunc_group_only(void *, struct cargs *);
|
||||||
|
void kbfunc_group_last(void *, struct cargs *);
|
||||||
void kbfunc_group_close(void *, struct cargs *);
|
void kbfunc_group_close(void *, struct cargs *);
|
||||||
void kbfunc_group_cycle(void *, struct cargs *);
|
void kbfunc_group_cycle(void *, struct cargs *);
|
||||||
void kbfunc_group_toggle_all(void *, struct cargs *);
|
void kbfunc_group_toggle_all(void *, struct cargs *);
|
||||||
@ -597,7 +608,7 @@ int xu_ewmh_get_net_wm_desktop(struct client_ctx *, long *);
|
|||||||
void xu_ewmh_set_net_wm_desktop(struct client_ctx *);
|
void xu_ewmh_set_net_wm_desktop(struct client_ctx *);
|
||||||
Atom *xu_ewmh_get_net_wm_state(struct client_ctx *, int *);
|
Atom *xu_ewmh_get_net_wm_state(struct client_ctx *, int *);
|
||||||
void xu_ewmh_handle_net_wm_state_msg(struct client_ctx *,
|
void xu_ewmh_handle_net_wm_state_msg(struct client_ctx *,
|
||||||
int, Atom , Atom);
|
int, Atom, Atom);
|
||||||
void xu_ewmh_set_net_wm_state(struct client_ctx *);
|
void xu_ewmh_set_net_wm_state(struct client_ctx *);
|
||||||
void xu_ewmh_restore_net_wm_state(struct client_ctx *);
|
void xu_ewmh_restore_net_wm_state(struct client_ctx *);
|
||||||
|
|
||||||
|
12
client.c
12
client.c
@ -849,13 +849,15 @@ client_mwm_hints(struct client_ctx *cc)
|
|||||||
|
|
||||||
if (xu_get_prop(cc->win, cwmh[_MOTIF_WM_HINTS],
|
if (xu_get_prop(cc->win, cwmh[_MOTIF_WM_HINTS],
|
||||||
cwmh[_MOTIF_WM_HINTS], MWM_HINTS_ELEMENTS,
|
cwmh[_MOTIF_WM_HINTS], MWM_HINTS_ELEMENTS,
|
||||||
(unsigned char **)&mwmh) == MWM_HINTS_ELEMENTS) {
|
(unsigned char **)&mwmh) <= 0)
|
||||||
if (mwmh->flags & MWM_FLAGS_DECORATIONS &&
|
return;
|
||||||
!(mwmh->decorations & MWM_DECOR_ALL) &&
|
|
||||||
!(mwmh->decorations & MWM_DECOR_BORDER))
|
if ((mwmh->flags & MWM_HINTS_DECORATIONS) &&
|
||||||
|
!(mwmh->decorations & MWM_DECOR_ALL)) {
|
||||||
|
if (!(mwmh->decorations & MWM_DECOR_BORDER))
|
||||||
cc->bwidth = 0;
|
cc->bwidth = 0;
|
||||||
XFree(mwmh);
|
|
||||||
}
|
}
|
||||||
|
XFree(mwmh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
3
conf.c
3
conf.c
@ -139,6 +139,7 @@ static const struct {
|
|||||||
|
|
||||||
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
|
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
|
||||||
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
|
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
|
||||||
|
{ FUNC_SC(group-last, group_last, 0) },
|
||||||
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
|
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
|
||||||
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
|
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
|
||||||
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
|
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
|
||||||
@ -669,6 +670,8 @@ conf_grab_kbd(Window win)
|
|||||||
|
|
||||||
TAILQ_FOREACH(kb, &Conf.keybindq, entry) {
|
TAILQ_FOREACH(kb, &Conf.keybindq, entry) {
|
||||||
kc = XKeysymToKeycode(X_Dpy, kb->press.keysym);
|
kc = XKeysymToKeycode(X_Dpy, kb->press.keysym);
|
||||||
|
if (kc == 0)
|
||||||
|
continue;
|
||||||
if ((XkbKeycodeToKeysym(X_Dpy, kc, 0, 0) != kb->press.keysym) &&
|
if ((XkbKeycodeToKeysym(X_Dpy, kc, 0, 0) != kb->press.keysym) &&
|
||||||
(XkbKeycodeToKeysym(X_Dpy, kc, 0, 1) == kb->press.keysym))
|
(XkbKeycodeToKeysym(X_Dpy, kc, 0, 1) == kb->press.keysym))
|
||||||
kb->modmask |= ShiftMask;
|
kb->modmask |= ShiftMask;
|
||||||
|
2
cwmrc.5
2
cwmrc.5
@ -273,6 +273,8 @@ menu.
|
|||||||
Toggle visibility of group n, where n is 1-9.
|
Toggle visibility of group n, where n is 1-9.
|
||||||
.It group-only-[n]
|
.It group-only-[n]
|
||||||
Show only group n, where n is 1-9, hiding other groups.
|
Show only group n, where n is 1-9, hiding other groups.
|
||||||
|
.It group-last
|
||||||
|
Show only the previously active group.
|
||||||
.It group-close-[n]
|
.It group-close-[n]
|
||||||
Close all windows in group n, where n is 1-9.
|
Close all windows in group n, where n is 1-9.
|
||||||
.It group-toggle-all
|
.It group-toggle-all
|
||||||
|
3
group.c
3
group.c
@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int idx)
|
|||||||
{
|
{
|
||||||
struct group_ctx *gc;
|
struct group_ctx *gc;
|
||||||
|
|
||||||
|
if (sc->group_last != sc->group_active)
|
||||||
|
sc->group_last = sc->group_active;
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
if (gc->num == idx)
|
if (gc->num == idx)
|
||||||
group_show(gc);
|
group_show(gc);
|
||||||
|
19
kbfunc.c
19
kbfunc.c
@ -453,7 +453,16 @@ kbfunc_client_cycle(void *ctx, struct cargs *cargs)
|
|||||||
newcc->ptr.x = newcc->geom.w / 2;
|
newcc->ptr.x = newcc->geom.w / 2;
|
||||||
newcc->ptr.y = newcc->geom.h / 2;
|
newcc->ptr.y = newcc->geom.h / 2;
|
||||||
}
|
}
|
||||||
client_ptr_warp(newcc);
|
|
||||||
|
/* When no client is active, warp pointer to last active. */
|
||||||
|
if (oldcc->flags & (CLIENT_ACTIVE))
|
||||||
|
client_ptr_warp(newcc);
|
||||||
|
else if (oldcc->flags & (CLIENT_SKIP_CYCLE))
|
||||||
|
client_ptr_warp(newcc);
|
||||||
|
else {
|
||||||
|
client_raise(oldcc);
|
||||||
|
client_ptr_warp(oldcc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -481,6 +490,14 @@ kbfunc_group_only(void *ctx, struct cargs *cargs)
|
|||||||
group_only(ctx, cargs->flag);
|
group_only(ctx, cargs->flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
kbfunc_group_last(void *ctx, struct cargs *cargs)
|
||||||
|
{
|
||||||
|
struct screen_ctx *sc = ctx;
|
||||||
|
|
||||||
|
group_only(ctx, sc->group_last->num);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kbfunc_group_toggle(void *ctx, struct cargs *cargs)
|
kbfunc_group_toggle(void *ctx, struct cargs *cargs)
|
||||||
{
|
{
|
||||||
|
41
parse.y
41
parse.y
@ -83,7 +83,7 @@ typedef struct {
|
|||||||
%token <v.string> STRING
|
%token <v.string> STRING
|
||||||
%token <v.number> NUMBER
|
%token <v.number> NUMBER
|
||||||
%type <v.number> yesno
|
%type <v.number> yesno
|
||||||
%type <v.string> string
|
%type <v.string> string numberstring
|
||||||
%%
|
%%
|
||||||
|
|
||||||
grammar : /* empty */
|
grammar : /* empty */
|
||||||
@ -106,6 +106,17 @@ string : string STRING {
|
|||||||
| STRING
|
| STRING
|
||||||
;
|
;
|
||||||
|
|
||||||
|
numberstring : NUMBER {
|
||||||
|
char *s;
|
||||||
|
if (asprintf(&s, "%lld", $1) == -1) {
|
||||||
|
yyerror("string: asprintf");
|
||||||
|
YYERROR;
|
||||||
|
}
|
||||||
|
$$ = s;
|
||||||
|
}
|
||||||
|
| STRING
|
||||||
|
;
|
||||||
|
|
||||||
yesno : YES { $$ = 1; }
|
yesno : YES { $$ = 1; }
|
||||||
| NO { $$ = 0; }
|
| NO { $$ = 0; }
|
||||||
;
|
;
|
||||||
@ -211,7 +222,7 @@ main : FONTNAME STRING {
|
|||||||
conf->gap.left = $4;
|
conf->gap.left = $4;
|
||||||
conf->gap.right = $5;
|
conf->gap.right = $5;
|
||||||
}
|
}
|
||||||
| BINDKEY STRING string {
|
| BINDKEY numberstring string {
|
||||||
if (!conf_bind_key(conf, $2, $3)) {
|
if (!conf_bind_key(conf, $2, $3)) {
|
||||||
yyerror("invalid bind-key: %s %s", $2, $3);
|
yyerror("invalid bind-key: %s %s", $2, $3);
|
||||||
free($2);
|
free($2);
|
||||||
@ -221,7 +232,7 @@ main : FONTNAME STRING {
|
|||||||
free($2);
|
free($2);
|
||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| UNBINDKEY STRING {
|
| UNBINDKEY numberstring {
|
||||||
if (!conf_bind_key(conf, $2, NULL)) {
|
if (!conf_bind_key(conf, $2, NULL)) {
|
||||||
yyerror("invalid unbind-key: %s", $2);
|
yyerror("invalid unbind-key: %s", $2);
|
||||||
free($2);
|
free($2);
|
||||||
@ -229,7 +240,7 @@ main : FONTNAME STRING {
|
|||||||
}
|
}
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| BINDMOUSE STRING string {
|
| BINDMOUSE numberstring string {
|
||||||
if (!conf_bind_mouse(conf, $2, $3)) {
|
if (!conf_bind_mouse(conf, $2, $3)) {
|
||||||
yyerror("invalid bind-mouse: %s %s", $2, $3);
|
yyerror("invalid bind-mouse: %s %s", $2, $3);
|
||||||
free($2);
|
free($2);
|
||||||
@ -239,7 +250,7 @@ main : FONTNAME STRING {
|
|||||||
free($2);
|
free($2);
|
||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| UNBINDMOUSE STRING {
|
| UNBINDMOUSE numberstring {
|
||||||
if (!conf_bind_mouse(conf, $2, NULL)) {
|
if (!conf_bind_mouse(conf, $2, NULL)) {
|
||||||
yyerror("invalid unbind-mouse: %s", $2);
|
yyerror("invalid unbind-mouse: %s", $2);
|
||||||
free($2);
|
free($2);
|
||||||
@ -376,7 +387,7 @@ lgetc(int quotec)
|
|||||||
if (parsebuf) {
|
if (parsebuf) {
|
||||||
/* Read character from the parsebuffer instead of input. */
|
/* Read character from the parsebuffer instead of input. */
|
||||||
if (parseindex >= 0) {
|
if (parseindex >= 0) {
|
||||||
c = parsebuf[parseindex++];
|
c = (unsigned char)parsebuf[parseindex++];
|
||||||
if (c != '\0')
|
if (c != '\0')
|
||||||
return (c);
|
return (c);
|
||||||
parsebuf = NULL;
|
parsebuf = NULL;
|
||||||
@ -385,7 +396,7 @@ lgetc(int quotec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pushback_index)
|
if (pushback_index)
|
||||||
return (pushback_buffer[--pushback_index]);
|
return ((unsigned char)pushback_buffer[--pushback_index]);
|
||||||
|
|
||||||
if (quotec) {
|
if (quotec) {
|
||||||
if ((c = getc(file->stream)) == EOF) {
|
if ((c = getc(file->stream)) == EOF) {
|
||||||
@ -426,10 +437,10 @@ lungetc(int c)
|
|||||||
if (parseindex >= 0)
|
if (parseindex >= 0)
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
if (pushback_index < MAXPUSHBACK-1)
|
if (pushback_index + 1 >= MAXPUSHBACK)
|
||||||
return (pushback_buffer[pushback_index++] = c);
|
|
||||||
else
|
|
||||||
return (EOF);
|
return (EOF);
|
||||||
|
pushback_buffer[pushback_index++] = c;
|
||||||
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -442,7 +453,7 @@ findeol(void)
|
|||||||
/* skip to either EOF or the first real EOL */
|
/* skip to either EOF or the first real EOL */
|
||||||
while (1) {
|
while (1) {
|
||||||
if (pushback_index)
|
if (pushback_index)
|
||||||
c = pushback_buffer[--pushback_index];
|
c = (unsigned char)pushback_buffer[--pushback_index];
|
||||||
else
|
else
|
||||||
c = lgetc(0);
|
c = lgetc(0);
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
@ -516,7 +527,7 @@ yylex(void)
|
|||||||
if (c == '-' || isdigit(c)) {
|
if (c == '-' || isdigit(c)) {
|
||||||
do {
|
do {
|
||||||
*p++ = c;
|
*p++ = c;
|
||||||
if ((unsigned)(p-buf) >= sizeof(buf)) {
|
if ((size_t)(p-buf) >= sizeof(buf)) {
|
||||||
yyerror("string too long");
|
yyerror("string too long");
|
||||||
return (findeol());
|
return (findeol());
|
||||||
}
|
}
|
||||||
@ -539,8 +550,8 @@ yylex(void)
|
|||||||
} else {
|
} else {
|
||||||
nodigits:
|
nodigits:
|
||||||
while (p > buf + 1)
|
while (p > buf + 1)
|
||||||
lungetc(*--p);
|
lungetc((unsigned char)*--p);
|
||||||
c = *--p;
|
c = (unsigned char)*--p;
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
@ -555,7 +566,7 @@ nodigits:
|
|||||||
if (isalnum(c) || c == ':' || c == '_' || c == '*' || c == '/') {
|
if (isalnum(c) || c == ':' || c == '_' || c == '*' || c == '/') {
|
||||||
do {
|
do {
|
||||||
*p++ = c;
|
*p++ = c;
|
||||||
if ((unsigned)(p-buf) >= sizeof(buf)) {
|
if ((size_t)(p-buf) >= sizeof(buf)) {
|
||||||
yyerror("string too long");
|
yyerror("string too long");
|
||||||
return (findeol());
|
return (findeol());
|
||||||
}
|
}
|
||||||
|
1
screen.c
1
screen.c
@ -60,6 +60,7 @@ screen_init(int which)
|
|||||||
xu_ewmh_net_supported_wm_check(sc);
|
xu_ewmh_net_supported_wm_check(sc);
|
||||||
|
|
||||||
conf_group(sc);
|
conf_group(sc);
|
||||||
|
sc->group_last = sc->group_active;
|
||||||
screen_update_geometry(sc);
|
screen_update_geometry(sc);
|
||||||
|
|
||||||
xu_ewmh_net_desktop_names(sc);
|
xu_ewmh_net_desktop_names(sc);
|
||||||
|
Loading…
Reference in New Issue
Block a user