On Mon, Apr 05, 2004 at 12:22:42PM -0400, Clark C. Evans wrote:
>   Is there a way to 'toggle mouse' aka turning it on and
>   off via the keyboard?  If the mouse is off, then the 
>   only way to get it back on should be via keyboard.

I don't think such feature belongs in Ion, but it should be
quite easy to write a program to handle grabbing/ungrabbing
the mouse when a key is pressed.

bool grabbed=FALSE;
Display *dpy=XOpenDisplay(NULL);
int kc=XKeysymToKeycode(dpy, XK_Scroll_Lock)
XGrabKey(dpy, kc, 0, DefaultRootWindow(dpy), False, 
         GrabModeAsync, GrabModeAsync);

while(1){
    XEvent ev;
    XNextEvent(dpy, &ev);
    if(ev.type==KeyPress && ev.xkey.keycode==kc){
        if(!grabbed){
              XGrabPointer(... similarly to XGrabKey above, 
                           mask=KeyPressMask; rtfm ...)
              grabbed=TRUE;
        }else{
              XUngrabPointer(...);
              grabbed=FALSE;
        }
    }
}

-- 
Tuomo

Reply via email to