summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2014-01-30 22:41:16 +0000
committerokan <okan>2014-01-30 22:41:16 +0000
commit24f9bfb3ec14268c924ff7094dcede0bc70c5cd2 (patch)
treeec4f74d0061436746caa26db0fc547c632dbea82
parent1fd3fc49974bdc0c7703b53d9eaea29529e80643 (diff)
parent34477b8a35ab71bf384db714ad0e7043b701be0e (diff)
downloadcwm-24f9bfb3ec14268c924ff7094dcede0bc70c5cd2.tar.gz
cwm-24f9bfb3ec14268c924ff7094dcede0bc70c5cd2.tar.xz
cwm-24f9bfb3ec14268c924ff7094dcede0bc70c5cd2.zip
cvsimport
-rw-r--r--calmwm.h21
-rw-r--r--conf.c53
-rw-r--r--kbfunc.c2
-rw-r--r--mousefunc.c25
-rw-r--r--parse.y6
-rw-r--r--xevents.c1
6 files changed, 30 insertions, 78 deletions
diff --git a/calmwm.h b/calmwm.h
index 03979e6..41d672e 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -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);
diff --git a/conf.c b/conf.c
index d01bbc9..a2e0742 100644
--- a/conf.c
+++ b/conf.c
@@ -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[] = {
@@ -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} },
diff --git a/kbfunc.c b/kbfunc.c
index 3daac44..513c81c 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -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)
 {
diff --git a/mousefunc.c b/mousefunc.c
index 64907d0..19668be 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -179,31 +179,6 @@ mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
 }
 
 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)
 {
 	group_menu(cc->sc);
diff --git a/parse.y b/parse.y
index 7255a1a..d8fb0b5 100644
--- a/parse.y
+++ b/parse.y
@@ -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		{
diff --git a/xevents.c b/xevents.c
index 1887395..17dea12 100644
--- a/xevents.c
+++ b/xevents.c
@@ -29,7 +29,6 @@
 
 #include <err.h>
 #include <errno.h>
-#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>