diff options
author | okan | 2008-05-19 12:56:58 +0000 |
---|---|---|
committer | okan | 2008-05-19 12:56:58 +0000 |
commit | 281da1fba3c4cf7c09351c088ec4f5793f9ce96e (patch) | |
tree | d82b052fc3c83570cb7162ef2886af15ddb5e0aa | |
parent | ca95bca81231c8c082947924b2af0498d914ce96 (diff) | |
download | cwm-281da1fba3c4cf7c09351c088ec4f5793f9ce96e.tar.gz |
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@
-rw-r--r-- | calmwm.h | 3 | ||||
-rw-r--r-- | client.c | 3 | ||||
-rw-r--r-- | conf.c | 4 | ||||
-rw-r--r-- | cwm.1 | 6 | ||||
-rw-r--r-- | kbfunc.c | 12 | ||||
-rw-r--r-- | xevents.c | 8 |
6 files changed, 29 insertions, 7 deletions
@@ -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 *); @@ -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); } @@ -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 }, @@ -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 @@ -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); @@ -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); } |