Quoting Albert Jongkit Wong <[EMAIL PROTECTED]>:

> Is there a way to get the keyboard or mouse back from a frozen
> application?  I've looked around and haven't been able to find any
> information about this.  It would seem that when an Xclient freezes up
> and
> needs to be killed, there could be some way to get the keyboard and
> mouse
> to unlock -- perhaps with an optional keybinding or something like that?
>  
> It would be very handy to not have to kill X to get the keyboard back
> when 
> the only thing frozen is gaim or something similar...

  Hi,

  I wrote code for this some months ago, it is the current CVS. I Updated
the XF86Config manpage to document it:

--
       Option "AllowDeactivateGrabs" "boolean"
              This option enables the use of the Ctrl+Alt+Keypad-
              Divide  key sequence to desactivate any active key�
              board and mouse grabs.  Default: off.

       Option "AllowClosedownGrabs" "boolean"
              This option enables the use of the Ctrl+Alt+Keypad-
              Multiply  key  sequence  to  kill  clients  with an
              active keyboard or mouse grab as  well  as  killing
              any  application  that  may have locked the server,
              normally using the  XGrabServer(3)  Xlib  function.
              Default: off.
              Note  that  the  options  AllowDeactivateGrabs  and
              AllowClosedownGrabs will allow users to remove  the
              grab  used by screen saver/locker programs.  An API
              was written to  such  cases.  If  you  enable  this
              option,  make  sure  your  screen  saver/locker  is
              updated.
--

  A very simple wrapper to disable killing xlock is:
--
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/extensions/xf86misc.h>

int
main(int argc, char *argv[])
{
    int xfree86, major, minor;
    Display *display = XOpenDisplay(NULL);
 
    if (display == NULL) {
        fprintf(stderr, "Cannot open display.\n");
        exit(1);
    }

    xfree86 = strstr(ServerVendor(display), "XFree86") != NULL;

    if (xfree86) {
        signal(SIGHUP, SIG_IGN);
        signal(SIGPIPE, SIG_IGN);
        signal(SIGINT, SIG_IGN);
        signal(SIGQUIT, SIG_IGN);

        if (XF86MiscQueryVersion(display, &major, &minor) == False) {
            fprintf(stderr, "Failed to call XF86MiscQueryVersion.\n");
            exit(1);
        }

        if (major >= 0 && minor >= 5 &&
            XF86MiscSetGrabKeysState(display, False) ==
            MiscExtGrabStateLocked) {
            fprintf(stderr, "Cannot disable XFree86 hotkeys to remove grabs.\n")
;
            exit(1);
        }
        XFlush(display);
    }

    system("xlock");

    if (xfree86 && major >= 0 && minor >= 5) {
        XF86MiscSetGrabKeysState(display, True);
        XFlush(display);
    }

    return (0);
}
--

> -Albert
> 
> ------------
> I believe in death after life...
> 
> "Someone has to be screwed up to teach everyone else" 
> 
> PGP Key and Fingerprint:
>       http://www.cs.washington.edu/homes/awong/gnupgpkey.txt
>       603F 118F 2B0E 47C6 9FCE  B0AA DA83 089D B120 6714
> 
> _______________________________________________
> Xpert mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/xpert

Paulo
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to