From 7b5b7cc9e986c7c711c524e6969c0ecbdd8cf1e1 Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 30 Jan 2014 14:40:21 +0000 Subject: Remove duplicate mouse functions and instead use the kbfunc ones. No user visable changes at this point, but they'll merge at an appropriate time. --- mousefunc.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/mousefunc.c b/mousefunc.c index 73c3449..6fdf4f4 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -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) { -- cgit 1.4.1 From fdefcecfa0281a9cd63fbfc32ac9bf768c65357a Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 30 Jan 2014 15:41:11 +0000 Subject: Move cwm_status around to avoid header fu, and remove extraneous signal header from xevents.c; noticed by Christian Neukirchen. --- calmwm.h | 9 --------- kbfunc.c | 2 ++ xevents.c | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/calmwm.h b/calmwm.h index f71426d..b2ce839 100644 --- a/calmwm.h +++ b/calmwm.h @@ -327,7 +327,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, @@ -482,18 +481,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 *); diff --git a/kbfunc.c b/kbfunc.c index 705baef..813f8e6 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/xevents.c b/xevents.c index 987d4fa..89d7a63 100644 --- a/xevents.c +++ b/xevents.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include -- cgit 1.4.1 From 7928c1ad7c7e2e4420669062a25fc4b2291e5f1f Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 30 Jan 2014 15:43:53 +0000 Subject: use the same autogroupwin variable as everywhere else --- conf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/conf.c b/conf.c index e4b4dbb..d8a89c7 100644 --- a/conf.c +++ b/conf.c @@ -287,7 +287,7 @@ 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 cmd *cmd; @@ -303,11 +303,11 @@ 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) { @@ -557,14 +557,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} }, -- cgit 1.4.1 From cc1902f57cb23e0028c07e149882698124b025bd Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 30 Jan 2014 22:17:22 +0000 Subject: Switch ignoreq to winname struct since it's basically the same thing; removes limit on name matching. --- calmwm.h | 12 +++--------- conf.c | 31 +++++++++++++------------------ parse.y | 7 +------ 3 files changed, 17 insertions(+), 33 deletions(-) diff --git a/calmwm.h b/calmwm.h index b2ce839..734055b 100644 --- a/calmwm.h +++ b/calmwm.h @@ -140,6 +140,7 @@ struct winname { char *name; }; TAILQ_HEAD(winname_q, winname); +TAILQ_HEAD(ignore_q, winname); struct client_ctx { TAILQ_ENTRY(client_ctx) entry; @@ -199,13 +200,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; @@ -288,7 +282,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; @@ -515,7 +509,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 d8a89c7..0792bd7 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)); + struct winname *wn; - 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[] = { @@ -289,7 +285,7 @@ conf_clear(struct conf *c) { struct autogroupwin *aw; struct binding *kb, *mb; - struct winmatch *wm; + struct winname *wn; struct cmd *cmd; int i; @@ -310,9 +306,9 @@ conf_clear(struct conf *c) 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; } diff --git a/parse.y b/parse.y index fb8c01e..dbc1506 100644 --- a/parse.y +++ b/parse.y @@ -156,12 +156,7 @@ main : FONTNAME STRING { free($3); } | IGNORE STRING { - if (!conf_ignore(conf, $2)) { - yyerror("ignore windowname too long"); - free($2); - YYERROR; - } - free($2); + conf_ignore(conf, $2); } | BIND STRING string { if (!conf_bind_kbd(conf, $2, $3)) { -- cgit 1.4.1 From 34477b8a35ab71bf384db714ad0e7043b701be0e Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 30 Jan 2014 22:41:16 +0000 Subject: re-add lost free from previous --- parse.y | 1 + 1 file changed, 1 insertion(+) diff --git a/parse.y b/parse.y index dbc1506..7df4f98 100644 --- a/parse.y +++ b/parse.y @@ -157,6 +157,7 @@ main : FONTNAME STRING { } | IGNORE STRING { conf_ignore(conf, $2); + free($2); } | BIND STRING string { if (!conf_bind_kbd(conf, $2, $3)) { -- cgit 1.4.1