vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hiya, Some of you guys will have seen half of this diff before. I submitted a key binding for group insert and a fix for alt-tab exposure for gvim/xpdf. It turns out the keybinding suffers from the same issue as alt-tab on gvim/xpdf, so they require the same timer and callback function. Therefore I have merged the two diffs. - M-g for group enter/exit - Menu goes away after alt-tab release on gvim/xpdf (They are taking KeyRelease and not putting back) Thanks -- Best Regards Edd http://students.dec.bmth.ac.uk/ebarrett Index: calmwm.c ================================================== ================= RCS file: /cvs/xenocara/app/cwm/calmwm.c,v retrieving revision 1.14 diff -u -r1.14 calmwm.c --- calmwm.c 3 Apr 2008 13:58:57 -0000 1.14 +++ calmwm.c 7 Apr 2008 00:10:37 -0000 @@ -78,6 +78,16 @@ if (signal(SIGCHLD, _sigchld_cb) == SIG_ERR) err(1, "signal"); + /* SIGVTALRM removes alt+tab menu */ + struct sigaction hn; + hn.sa_handler = timer_sighandler; + hn.sa_flags = 0; + if(sigaction(SIGALRM, &hn, NULL) == -1) + { + fprintf(stderr, "Unable to set SIGALRM handler\n"); + exit(1); + } + group_init(); Starting = 1; @@ -314,4 +324,32 @@ fprintf(stderr, "usage: %s [-d display] [-c file]\n", __progname); exit(1); +} + +/* Kludge + * Some apps don't put back KeyRelease when looking + * for their hotkeys, and so messes up our alt+tab system. + * The fix is to set a timer to pretent alt was release after + * a delay. + */ +void timer_sighandler(int sig) +{ + struct client_ctx *cc = client_current(); + int stat; + XExposeEvent xe; + + xe.type = Expose; + xe.send_event = True; + xe.display = X_Dpy; + xe.window = cc->win; + xe.x = cc->geom.x; + xe.y = cc->geom.y; + xe.width = cc->geom.width; + xe.height = cc->geom.height; + xe.count = 0; + + stat = XSendEvent(X_Dpy, cc->win, True, + NoEventMask, (XEvent *) &xe); + + client_altrelease(); } Index: calmwm.h ================================================== ================= RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.26 diff -u -r1.26 calmwm.h --- calmwm.h 26 Mar 2008 15:45:42 -0000 1.26 +++ calmwm.h 7 Apr 2008 00:10:38 -0000 @@ -314,6 +314,7 @@ #define MWM_DECOR_BORDER (1 << 1) int input_keycodetrans(KeyCode, u_int, enum ctltype *, char *, int); +void timer_sighandler(int); int x_errorhandler(Display *, XErrorEvent *); void x_setup(char *display_name); Index: client.c ================================================== ================= RCS file: /cvs/xenocara/app/cwm/client.c,v retrieving revision 1.14 diff -u -r1.14 client.c --- client.c 26 Mar 2008 15:45:42 -0000 1.14 +++ client.c 7 Apr 2008 00:10:38 -0000 @@ -655,6 +655,7 @@ struct client_ctx *ccc, *list[LISTSIZE]; struct screen_ctx *sc = CCTOSC(cc); struct fontdesc *font = DefaultFont; + struct itimerval itv, otv; memset(list, 0, sizeof(list)); @@ -721,6 +722,13 @@ /* Highlight the current entry. */ XFillRectangle(X_Dpy, sc->infowin, sc->hlgc, 0, curn*oneh, w, oneh); + + /* See timer_sighandler in calmwm.c */ + itv.it_value.tv_sec = 1; + itv.it_value.tv_usec = 0; + itv.it_interval.tv_sec = 0; /* one shot */ + itv.it_interval.tv_usec = 0; /* one shot */ + setitimer(ITIMER_REAL, &itv, &otv); } struct client_ctx * @@ -767,8 +775,12 @@ return; sc = CCTOSC(cc); - XUnmapWindow(X_Dpy, sc->infowin); + cc->highlight = sc->blackpixl; + client_draw_border(cc); + XReparentWindow(X_Dpy, sc->infowin, sc->rootwin, 0, 0); + XUnmapWindow(X_Dpy, sc->infowin); + client_update(cc); } void Index: conf.c ================================================== ================= RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.23 diff -u -r1.23 conf.c --- conf.c 23 Mar 2008 15:09:21 -0000 1.23 +++ conf.c 7 Apr 2008 00:10:38 -0000 @@ -146,6 +146,7 @@ conf_bindname(c, "CS-Down", "bigptrmovedown"); conf_bindname(c, "CS-Up", "bigptrmoveup"); conf_bindname(c, "CS-Right", "bigptrmoveright"); + conf_bindname(c, "M-g", "groupenter"); /* Default term/lock */ strlcpy(c->termpath, "xterm", sizeof(c->termpath)); @@ -281,6 +282,7 @@ { "bigresizedown", kbfunc_client_resize, KBFLAG_NEEDCLIENT, (void *)(CWM_DOWN|CWM_BIGMOVE) }, { "bigresizeright", kbfunc_client_resize, KBFLAG_NEEDCLIENT, (void *)(CWM_RIGHT|CWM_BIGMOVE) }, { "bigresizeleft", kbfunc_client_resize, KBFLAG_NEEDCLIENT, (void *)(CWM_LEFT|CWM_BIGMOVE) }, + { "groupenter", group_sticky_toggle_enter, KBFLAG_NEEDCLIENT, 0 }, { NULL, NULL, 0, 0}, }; Index: cwm.1 ================================================== ================= RCS file: /cvs/xenocara/app/cwm/cwm.1,v retrieving revision 1.24 diff -u -r1.24 cwm.1 --- cwm.1 23 Mar 2008 15:09:21 -0000 1.24 +++ cwm.1 7 Apr 2008 00:10:38 -0000 @@ -110,6 +110,8 @@ dialog; allows you to switch from .Nm to another window manager without restarting the X server. +.It Ic M-g +Toggle a window's membership in the current group. .El .Pp The mouse bindings are also important, they are: Index: group.c ================================================== ================= RCS file: /cvs/xenocara/app/cwm/group.c,v retrieving revision 1.8 diff -u -r1.8 group.c --- group.c 23 Mar 2008 15:09:21 -0000 1.8 +++ group.c 7 Apr 2008 00:10:39 -0000 @@ -138,6 +138,7 @@ group_sticky_toggle_enter(struct client_ctx *cc) { struct group_ctx *gc = Group_active; + struct itimerval itv, otv; if (gc == cc->group) { _group_remove(cc); @@ -148,6 +149,14 @@ } client_draw_border(cc); + + /* See timer_sighandler in calmwm.c */ + itv.it_value.tv_sec = 1; + itv.it_value.tv_usec = 0; + itv.it_interval.tv_sec = 0; /* one shot */ + itv.it_interval.tv_usec = 0; /* one shot */ + setitimer(ITIMER_REAL, &itv, &otv); + } void Index: headers.h ================================================== ================= RCS file: /cvs/xenocara/app/cwm/headers.h,v retrieving revision 1.4 diff -u -r1.4 headers.h --- headers.h 11 Jan 2008 16:06:44 -0000 1.4 +++ headers.h 7 Apr 2008 00:10:39 -0000 @@ -38,6 +38,7 @@ #include <errno.h> #include <unistd.h> #include <ctype.h> +#include <time.h> #include <X11/cursorfont.h> #include <X11/extensions/shape.h> Index: screen.c ================================================== ================= RCS file: /cvs/xenocara/app/cwm/screen.c,v retrieving revision 1.3 diff -u -r1.3 screen.c --- screen.c 11 Jan 2008 16:06:44 -0000 1.3 +++ screen.c 7 Apr 2008 00:10:39 -0000 @@ -85,8 +85,11 @@ 1, 1, 1, sc->blackpixl, sc->whitepixl); /* XXX - marius. */ + /* Sorry, messes up my plans + * See timer_sighandler in calmwm.c if (signal(SIGALRM, _clearwindow_cb) == SIG_ERR) err(1, "signal"); + */ } void |