diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2008-05-19 12:56:59 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2008-05-19 12:56:59 +0000 |
commit | 77606d11417d3e2910ac693bfe907ac2b11ef6da (patch) | |
tree | 43dab985f577348ba01eda09e40a5b7da25c3c7a /app | |
parent | 216170d9e51a58931478fa1676fce835734e3154 (diff) |
finally implement keyboard binding for group toggling
idea for the
"slightly-less-abhorrent-hack-but-a-hack-nonetheless-TM" from oga@
grab and ungrab the keyboard to get around some silly X apps that like
stealing events
ok oga@
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.h | 3 | ||||
-rw-r--r-- | app/cwm/client.c | 3 | ||||
-rw-r--r-- | app/cwm/conf.c | 4 | ||||
-rw-r--r-- | app/cwm/cwm.1 | 6 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 12 | ||||
-rw-r--r-- | app/cwm/xevents.c | 8 |
6 files changed, 29 insertions, 7 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 20b0aceb0..9c656806f 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.h,v 1.41 2008/05/18 19:43:50 oga Exp $ + * $Id: calmwm.h,v 1.42 2008/05/19 12:56:58 okan Exp $ */ #ifndef _CALMWM_H_ @@ -434,6 +434,7 @@ void kbfunc_client_group(struct client_ctx *, void *); void kbfunc_client_nextgroup(struct client_ctx *, void *); void kbfunc_client_prevgroup(struct client_ctx *, void *); void kbfunc_client_nogroup(struct client_ctx *, void *); +void kbfunc_client_grouptoggle(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 *); diff --git a/app/cwm/client.c b/app/cwm/client.c index a67e78722..b869ab52f 100644 --- a/app/cwm/client.c +++ b/app/cwm/client.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: client.c,v 1.23 2008/05/18 20:00:16 okan Exp $ + * $Id: client.c,v 1.24 2008/05/19 12:56:58 okan Exp $ */ #include "headers.h" @@ -438,6 +438,7 @@ client_unhide(struct client_ctx *cc) XMapWindow(X_Dpy, cc->win); XMapRaised(X_Dpy, cc->pwin); + cc->highlight = 0; cc->flags &= ~CLIENT_HIDDEN; xu_setstate(cc, NormalState); } diff --git a/app/cwm/conf.c b/app/cwm/conf.c index b5272625d..7197449dc 100644 --- a/app/cwm/conf.c +++ b/app/cwm/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: conf.c,v 1.31 2008/05/18 19:47:19 oga Exp $ + * $Id: conf.c,v 1.32 2008/05/19 12:56:58 okan Exp $ */ #include "headers.h" @@ -117,6 +117,7 @@ conf_init(struct conf *c) conf_bindname(c, "CM-9", "group9"); conf_bindname(c, "M-Right", "nextgroup"); conf_bindname(c, "M-Left", "prevgroup"); + conf_bindname(c, "CM-g", "grouptoggle"); conf_bindname(c, "CM-f", "maximize"); conf_bindname(c, "CM-equal", "vmaximize"); conf_bindname(c, "CMS-q", "quit"); @@ -224,6 +225,7 @@ struct { { "nogroup", kbfunc_client_nogroup, 0, 0 }, { "nextgroup", kbfunc_client_nextgroup, 0, 0 }, { "prevgroup", kbfunc_client_prevgroup, 0, 0 }, + { "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, 0}, { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 }, { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 }, { "quit", kbfunc_quit_wm, 0, 0 }, diff --git a/app/cwm/cwm.1 b/app/cwm/cwm.1 index 29daa45b4..6eaad75e9 100644 --- a/app/cwm/cwm.1 +++ b/app/cwm/cwm.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cwm.1,v 1.27 2008/04/15 18:33:13 okan Exp $ +.\" $OpenBSD: cwm.1,v 1.28 2008/05/19 12:56:58 okan Exp $ .\" .\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org> .\" @@ -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: April 15 2008 $ +.Dd $Mdocdate: May 19 2008 $ .Dt CWM 1 .Os .Sh NAME @@ -83,6 +83,8 @@ Delete current window. Select group n, where n is 1-9. .It Ic C-M-0 Select all groups. +.It Ic C-M-g +Toggle a window's membership in the current group. .It Ic M-Right Switch to next group. .It Ic M-Left diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index be94be366..ef5d0da09 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: kbfunc.c,v 1.22 2008/04/16 13:47:29 oga Exp $ + * $Id: kbfunc.c,v 1.23 2008/05/19 12:56:58 okan Exp $ */ #include <paths.h> @@ -430,6 +430,16 @@ kbfunc_client_nogroup(struct client_ctx *cc, void *arg) } void +kbfunc_client_grouptoggle(struct client_ctx *cc, void *arg) +{ + /* XXX for stupid X apps like xpdf and gvim */ + XGrabKeyboard(X_Dpy, cc->pwin, True, + GrabModeAsync, GrabModeAsync, CurrentTime); + + group_sticky_toggle_enter(cc); +} + +void kbfunc_client_maximize(struct client_ctx *cc, void *arg) { client_maximize(cc); diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c index 9b44f6a32..c0e53d0fe 100644 --- a/app/cwm/xevents.c +++ b/app/cwm/xevents.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: xevents.c,v 1.14 2008/05/18 20:06:36 okan Exp $ + * $Id: xevents.c,v 1.15 2008/05/19 12:56:58 okan Exp $ */ /* @@ -408,6 +408,7 @@ xev_handle_keyrelease(struct xevent *xev, XEvent *ee) { XKeyEvent *e = &ee->xkey; struct screen_ctx *sc = screen_fromroot(e->root); + struct client_ctx *cc = client_current(); int keysym; keysym = XKeycodeToKeysym(X_Dpy, e->keycode, 0); @@ -422,6 +423,11 @@ xev_handle_keyrelease(struct xevent *xev, XEvent *ee) */ client_mtf(NULL); + if (cc != NULL) { + group_sticky_toggle_exit(cc); + XUngrabKeyboard(X_Dpy, CurrentTime); + } + out: xev_register(xev); } |