Here is a patch to allow rudimentary support for chained
keygrabbing. It allows you to specify one global prefix which must
preceed any other keybinding. For example:

KeyToGrab(m), WithModifier(Control), WithAction(Prefix)
KeyToGrab(a), WithModifier(Control), WithAction(ExecCommand),DoThis(aterm)

would allow you to hit Ctrl-m and then Ctrl-a to start aterm.

Proper chaining will not be complete untill some of the broken
internals of bbkeys are fixed.

It is against the current CVS codebase. If there is any interest, I'd
be persuaded to create a proper patch file.

-- 
Copyleft (c) 2001, Scott Moynes
? Makefile
? bbkeysPrefix.patch
? config.cache
? config.h
? config.log
? config.status
? stamp-h
? version.h
? data/Makefile
? doc/Makefile
? doc/bbkeys.1
? redhat/Makefile
? redhat/bbkeys.spec
? src/.deps
? src/Makefile
? src/bbkeys
? src/bbkeysconf.pl
Index: src/bbkeys.cc
===================================================================
RCS file: /cvsroot/bbkeys/bbkeys/src/bbkeys.cc,v
retrieving revision 1.6
diff -c -b -r1.6 bbkeys.cc
*** src/bbkeys.cc       2001/11/12 07:15:42     1.6
--- src/bbkeys.cc       2001/11/13 02:49:42
***************
*** 400,407 ****
         for (i = 0; i < grabSet.instructCount; i++) {
                        if (grabSet.KeyMap[i].keycode == 0)
                                continue;
! 
                        if (grabSet.KeyMap[i].keycode != AnyModifier) {
                                XGrabKey(getXDisplay(), grabSet.KeyMap[i].keycode,
                                                        grabSet.KeyMap[i].modMask | 
LockMask,
                                                        
getCurrentScreenInfo()->getRootWindow(), True,
--- 400,410 ----
         for (i = 0; i < grabSet.instructCount; i++) {
                        if (grabSet.KeyMap[i].keycode == 0)
                                continue;
!                       if (grabbing||grabSet.KeyMap[i].action == grabPrefix)
!                         {
                                if (grabSet.KeyMap[i].keycode != AnyModifier) {
+                                 {     
+ 
                                        XGrabKey(getXDisplay(), 
grabSet.KeyMap[i].keycode,
                                                   grabSet.KeyMap[i].modMask | 
LockMask,
                                                   
getCurrentScreenInfo()->getRootWindow(), True,
***************
*** 423,430 ****
--- 426,436 ----
                                                 
getCurrentScreenInfo()->getRootWindow(), True,
                                                 GrabModeAsync, GrabModeAsync);
                                }
+                         }     
+        }
  }     
  
+ 
  /*---------------------------------------------------------------------------*/
  
  /*--  Snarfed shamelessly from WindowMaker's code-base once again....                
  --*/
***************
*** 605,611 ****
                        return grabVertDec;
         if (!strcasecmp(action, "ToggleDecor"))
                        return grabToggleDecor;
! 
  
         return 0;
  }
--- 611,618 ----
                        return grabVertDec;
         if (!strcasecmp(action, "ToggleDecor"))
                        return grabToggleDecor;
!        if (!strcasecmp(action, "Prefix"))
!          return grabPrefix;
         
         return 0;
  }
***************
*** 703,708 ****
--- 710,717 ----
         char *actionBegin;
         char *execCmdBegin;
  
+        grabbing = true;
+ 
         FILE *rc_file = fopen(bbkeys_rcfile, "r");
         if (!rc_file) {
                        /* fprintf(stderr, "Can't open bbkeys rc-file (%s)\n", 
bbkeys_rcfile); */
***************
*** 751,756 ****
--- 760,771 ----
  
                                /* if we're supposed to having an execCommand and we 
do have
                                 * something to put into it                            
                                                                                       
                  */
+                               if (grabSet.KeyMap[count].action == grabPrefix)
+                                 {
+                                       grabbing=false;
+                                       havePrefix=true;
+                                       grabSet.KeyMap[count].execCommand = NULL;
+                                 }
                                if (grabSet.KeyMap[count].action == grabExecute) {
                                         execCmdBegin = strchr(actionBegin + 1, '(');
                                         if (execCmdBegin) {
***************
*** 1402,1409 ****
                        XSetWindowBackgroundPixmap(getXDisplay(), win_configBtn,
                                        pixmap.pix_pressedBtn);
                        Redraw();
! 
                        switch (grabSet.KeyMap[grabInt].action) {
                        case grabIconify:
                                if (focus_window && focus_window != (int)PointerRoot ) 
{
                                        XIconifyWindow(getXDisplay(), focus_window, 0);
--- 1417,1428 ----
                        XSetWindowBackgroundPixmap(getXDisplay(), win_configBtn,
                                        pixmap.pix_pressedBtn);
                        Redraw();
!                       if (havePrefix)
!                         grabbing=!grabbing;
                        switch (grabSet.KeyMap[grabInt].action) {
+                       case grabPrefix:
+                         activateKeygrabs();
+                         break;
                        case grabIconify:
                                if (focus_window && focus_window != (int)PointerRoot ) 
{
                                        XIconifyWindow(getXDisplay(), focus_window, 0);
***************
*** 1731,1736 ****
--- 1750,1757 ----
                                break;
                        }
                }
+               if (havePrefix)
+                 activateKeygrabs();
                timer->start();
                break;
        }
Index: src/bbkeys.hh
===================================================================
RCS file: /cvsroot/bbkeys/bbkeys/src/bbkeys.hh,v
retrieving revision 1.3
diff -c -b -r1.3 bbkeys.hh
*** src/bbkeys.hh       2001/11/12 07:15:42     1.3
--- src/bbkeys.hh       2001/11/13 02:49:43
***************
*** 204,209 ****
--- 204,211 ----
        Stackmenu *stackMenu;           // variables for the stack cycling style menu
        bool doingCycling;                      // are we in the middle of a stacked 
cycle?
        bool showAllWorkspaces;
+   bool grabbing;
+   bool havePrefix;
        Window menuWin;
        GC menuGC;
        GC menuHiBGGC;
Index: src/grab_defs.hh
===================================================================
RCS file: /cvsroot/bbkeys/bbkeys/src/grab_defs.hh,v
retrieving revision 1.3
diff -c -b -r1.3 grab_defs.hh
*** src/grab_defs.hh    2001/11/12 07:15:42     1.3
--- src/grab_defs.hh    2001/11/13 02:49:43
***************
*** 74,79 ****
--- 74,81 ----
  
        grabToggleDecor, 
  
+       grabPrefix,
+ 
        NUM_GRABS
  };
  

Attachment: msg03764/pgp00000.pgp
Description: PGP signature

Reply via email to