cvsimport

This commit is contained in:
okan 2014-01-30 22:41:16 +00:00
commit 24f9bfb3ec
6 changed files with 30 additions and 78 deletions

View File

@ -152,6 +152,7 @@ struct winname {
char *name;
};
TAILQ_HEAD(winname_q, winname);
TAILQ_HEAD(ignore_q, winname);
struct client_ctx {
TAILQ_ENTRY(client_ctx) entry;
@ -211,13 +212,6 @@ struct client_ctx {
TAILQ_HEAD(client_ctx_q, client_ctx);
TAILQ_HEAD(cycle_entry_q, client_ctx);
struct winmatch {
TAILQ_ENTRY(winmatch) entry;
#define WIN_MAXTITLELEN 256
char title[WIN_MAXTITLELEN];
};
TAILQ_HEAD(winmatch_q, winmatch);
struct group_ctx {
TAILQ_ENTRY(group_ctx) entry;
struct client_ctx_q clients;
@ -300,7 +294,7 @@ struct conf {
struct keybinding_q keybindingq;
struct mousebinding_q mousebindingq;
struct autogroupwin_q autogroupq;
struct winmatch_q ignoreq;
struct ignore_q ignoreq;
struct cmd_q cmdq;
#define CONF_STICKY_GROUPS 0x0001
int flags;
@ -339,7 +333,6 @@ extern struct client_ctx_q Clientq;
extern struct conf Conf;
extern const char *homedir;
extern int HasRandr, Randr_ev;
extern volatile sig_atomic_t cwm_status;
enum {
WM_STATE,
@ -494,18 +487,10 @@ void kbfunc_ssh(struct client_ctx *, union arg *);
void kbfunc_term(struct client_ctx *, union arg *);
void kbfunc_tile(struct client_ctx *, union arg *);
void mousefunc_client_cyclegroup(struct client_ctx *,
union arg *);
void mousefunc_client_grouptoggle(struct client_ctx *,
union arg *);
void mousefunc_client_hide(struct client_ctx *,
union arg *);
void mousefunc_client_lower(struct client_ctx *,
union arg *);
void mousefunc_client_move(struct client_ctx *,
union arg *);
void mousefunc_client_raise(struct client_ctx *,
union arg *);
void mousefunc_client_resize(struct client_ctx *,
union arg *);
void mousefunc_menu_cmd(struct client_ctx *, union arg *);
@ -536,7 +521,7 @@ void conf_cursor(struct conf *);
void conf_grab_kbd(Window);
void conf_grab_mouse(Window);
void conf_init(struct conf *);
int conf_ignore(struct conf *, const char *);
void conf_ignore(struct conf *, const char *);
void conf_screen(struct screen_ctx *);
void xev_process(void);

53
conf.c
View File

@ -99,18 +99,14 @@ conf_autogroup(struct conf *c, int no, const char *val)
TAILQ_INSERT_TAIL(&c->autogroupq, aw, entry);
}
int
conf_ignore(struct conf *c, const char *val)
void
conf_ignore(struct conf *c, const char *name)
{
struct winmatch *wm;
struct winname *wn;
wm = xcalloc(1, sizeof(*wm));
if (strlcpy(wm->title, val, sizeof(wm->title)) >= sizeof(wm->title))
return (0);
TAILQ_INSERT_TAIL(&c->ignoreq, wm, entry);
return (1);
wn = xcalloc(1, sizeof(*wn));
wn->name = xstrdup(name);
TAILQ_INSERT_TAIL(&c->ignoreq, wn, entry);
}
static const char *color_binds[] = {
@ -287,9 +283,9 @@ conf_init(struct conf *c)
void
conf_clear(struct conf *c)
{
struct autogroupwin *ag;
struct autogroupwin *aw;
struct binding *kb, *mb;
struct winmatch *wm;
struct winname *wn;
struct cmd *cmd;
int i;
@ -303,16 +299,16 @@ conf_clear(struct conf *c)
free(kb);
}
while ((ag = TAILQ_FIRST(&c->autogroupq)) != NULL) {
TAILQ_REMOVE(&c->autogroupq, ag, entry);
free(ag->class);
free(ag->name);
free(ag);
while ((aw = TAILQ_FIRST(&c->autogroupq)) != NULL) {
TAILQ_REMOVE(&c->autogroupq, aw, entry);
free(aw->class);
free(aw->name);
free(aw);
}
while ((wm = TAILQ_FIRST(&c->ignoreq)) != NULL) {
TAILQ_REMOVE(&c->ignoreq, wm, entry);
free(wm);
while ((wn = TAILQ_FIRST(&c->ignoreq)) != NULL) {
TAILQ_REMOVE(&c->ignoreq, wn, entry);
free(wn);
}
while ((mb = TAILQ_FIRST(&c->mousebindingq)) != NULL) {
@ -329,12 +325,11 @@ conf_clear(struct conf *c)
void
conf_client(struct client_ctx *cc)
{
struct winmatch *wm;
char *wname = cc->name;
struct winname *wn;
int ignore = 0;
TAILQ_FOREACH(wm, &Conf.ignoreq, entry) {
if (strncasecmp(wm->title, wname, strlen(wm->title)) == 0) {
TAILQ_FOREACH(wn, &Conf.ignoreq, entry) {
if (strncasecmp(wn->name, cc->name, strlen(wn->name)) == 0) {
ignore = 1;
break;
}
@ -557,14 +552,14 @@ static const struct {
int flags;
union arg argument;
} name_to_mousefunc[] = {
{ "window_lower", kbfunc_client_lower, CWM_WIN, {0} },
{ "window_raise", kbfunc_client_raise, CWM_WIN, {0} },
{ "window_hide", kbfunc_client_hide, CWM_WIN, {0} },
{ "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLE} },
{ "rcyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_RCYCLE} },
{ "window_move", mousefunc_client_move, CWM_WIN, {0} },
{ "window_resize", mousefunc_client_resize, CWM_WIN, {0} },
{ "window_grouptoggle", mousefunc_client_grouptoggle, CWM_WIN, {0} },
{ "window_lower", mousefunc_client_lower, CWM_WIN, {0} },
{ "window_raise", mousefunc_client_raise, CWM_WIN, {0} },
{ "window_hide", mousefunc_client_hide, CWM_WIN, {0} },
{ "cyclegroup", mousefunc_client_cyclegroup, 0, {.i = CWM_CYCLE} },
{ "rcyclegroup", mousefunc_client_cyclegroup, 0, {.i = CWM_RCYCLE} },
{ "menu_group", mousefunc_menu_group, 0, {0} },
{ "menu_unhide", mousefunc_menu_unhide, 0, {0} },
{ "menu_cmd", mousefunc_menu_cmd, 0, {0} },

View File

@ -35,6 +35,8 @@
#define HASH_MARKER "|1|"
extern sig_atomic_t cwm_status;
void
kbfunc_client_lower(struct client_ctx *cc, union arg *arg)
{

View File

@ -178,31 +178,6 @@ mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
group_sticky_toggle_enter(cc);
}
void
mousefunc_client_lower(struct client_ctx *cc, union arg *arg)
{
client_ptrsave(cc);
client_lower(cc);
}
void
mousefunc_client_raise(struct client_ctx *cc, union arg *arg)
{
client_raise(cc);
}
void
mousefunc_client_hide(struct client_ctx *cc, union arg *arg)
{
client_hide(cc);
}
void
mousefunc_client_cyclegroup(struct client_ctx *cc, union arg *arg)
{
group_cycle(cc->sc, arg->i);
}
void
mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
{

View File

@ -158,11 +158,7 @@ main : FONTNAME STRING {
free($3);
}
| IGNORE STRING {
if (!conf_ignore(conf, $2)) {
yyerror("ignore windowname too long");
free($2);
YYERROR;
}
conf_ignore(conf, $2);
free($2);
}
| BIND STRING string {

View File

@ -29,7 +29,6 @@
#include <err.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>