From 0f182230426e86175a00b6e9328cc8d9bf0b876e Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 7 Apr 2008 23:47:09 +0000 Subject: Add quit function, bind it per default to CM-q and change exec_wm binding to CM-w. Inital diff from Gleydson Soares Feedback from oga@ and okan@ ok oga@ --- calmwm.h | 1 + conf.c | 4 +++- cwm.1 | 6 ++++-- kbfunc.c | 8 ++++++++ xevents.c | 3 ++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/calmwm.h b/calmwm.h index a784798..8bb48f4 100644 --- a/calmwm.h +++ b/calmwm.h @@ -451,6 +451,7 @@ void kbfunc_client_prevgroup(struct client_ctx *, void *); void kbfunc_client_nogroup(struct client_ctx *, void *); void kbfunc_client_maximize(struct client_ctx *, void *); void kbfunc_client_vmaximize(struct client_ctx *, void *); +void kbfunc_quit_wm(struct client_ctx *, void *); void kbfunc_client_move(struct client_ctx *, void *); void kbfunc_client_resize(struct client_ctx *, void *); void kbfunc_menu_search(struct client_ctx *, void *); diff --git a/conf.c b/conf.c index 7193d82..85239bd 100644 --- a/conf.c +++ b/conf.c @@ -94,7 +94,7 @@ conf_init(struct conf *c) conf_bindname(c, "CM-Return", "terminal"); conf_bindname(c, "CM-Delete", "lock"); conf_bindname(c, "M-question", "exec"); - conf_bindname(c, "CM-q", "exec_wm"); + conf_bindname(c, "CM-w", "exec_wm"); conf_bindname(c, "M-period", "ssh"); conf_bindname(c, "M-Return", "hide"); conf_bindname(c, "M-Down", "lower"); @@ -119,6 +119,7 @@ conf_init(struct conf *c) conf_bindname(c, "M-Left", "prevgroup"); conf_bindname(c, "CM-f", "maximize"); conf_bindname(c, "CM-equal", "vmaximize"); + conf_bindname(c, "CM-q", "quit"); conf_bindname(c, "M-h", "moveleft"); conf_bindname(c, "M-j", "movedown"); @@ -260,6 +261,7 @@ struct { { "prevgroup", kbfunc_client_prevgroup, 0, 0 }, { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 }, { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 }, + { "quit", kbfunc_quit_wm, 0, 0 }, { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM }, { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM }, { "ssh", kbfunc_ssh, 0, 0 }, diff --git a/cwm.1 b/cwm.1 index 91509cb..49d12f0 100644 --- a/cwm.1 +++ b/cwm.1 @@ -15,7 +15,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .\" The following requests are required for all man pages. -.Dd $Mdocdate$ +.Dd $Mdocdate: March 23 2008 $ .Dt CWM 1 .Os .Sh NAME @@ -61,6 +61,8 @@ their functionality is described in more detail later. Spawn a new terminal. .It Ic C-M-Delete Lock the screen. +.It Ic C-M-q +Quit cwm. .It Ic M-Enter Hide current window. .It Ic M-Down @@ -104,7 +106,7 @@ This parses to provide host auto-completion. .Xr ssh 1 will be executed via the configured terminal emulator. -.It Ic C-M-q +.It Ic C-M-w Spawn .Dq Exec WindowManager dialog; allows you to switch from diff --git a/kbfunc.c b/kbfunc.c index 781a06a..36d543e 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -27,6 +27,8 @@ #define HASH_MARKER "|1|" #define MOVE_AMOUNT 1 +extern int _xev_quit; + void kbfunc_client_lower(struct client_ctx *cc, void *arg) { @@ -488,3 +490,9 @@ kbfunc_client_vmaximize(struct client_ctx *cc, void *arg) { client_vertmaximize(cc); } + +void +kbfunc_quit_wm(struct client_ctx *cc, void *arg) +{ + _xev_quit = 1; +} diff --git a/xevents.c b/xevents.c index a0f3538..b0d1c89 100644 --- a/xevents.c +++ b/xevents.c @@ -451,6 +451,7 @@ out: static struct xevent_q _xevq, _xevq_putaway; static short _xev_q_lock = 0; +int _xev_quit = 0; void xev_init(void) @@ -524,7 +525,7 @@ xev_loop(void) XEvent e; struct xevent *xev, *nextxev; - for (;;) { + while (_xev_quit == 0) { #ifdef DIAGNOSTIC if (TAILQ_EMPTY(&_xevq)) errx(1, "X event queue empty"); -- cgit 1.4.1