Skip to content

Commit

Permalink
cvsimport
Browse files Browse the repository at this point in the history
  • Loading branch information
okan committed Jan 30, 2014
2 parents 1fd3fc4 + 34477b8 commit 24f9bfb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 78 deletions.
21 changes: 3 additions & 18 deletions calmwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 *);
Expand Down Expand Up @@ -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);
Expand Down
53 changes: 24 additions & 29 deletions conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

wm = xcalloc(1, sizeof(*wm));

if (strlcpy(wm->title, val, sizeof(wm->title)) >= sizeof(wm->title))
return (0);
struct winname *wn;

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[] = {
Expand Down Expand Up @@ -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;

Expand All @@ -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) {
Expand All @@ -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;
}
Expand Down Expand Up @@ -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} },
Expand Down
2 changes: 2 additions & 0 deletions kbfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
25 changes: 0 additions & 25 deletions mousefunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 1 addition & 5 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion xevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#include <err.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down

0 comments on commit 24f9bfb

Please sign in to comment.