[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

howto grab a key under X



man XGrabKey

       The XGrabKey function establishes a passive grab on the
       keyboard.  In the future, the keyboard is actively grabbed
       (as for XGrabKeyboard), the last-keyboard-grab time is set
       to the time at which the key was pressed (as transmitted
       in the KeyPress event), and the KeyPress event is reported
       if all of the following conditions are true:

       ·    The keyboard is not grabbed and the specified key
            (which can itself be a modifier key) is logically
            pressed when the specified modifier keys are logi­
            cally down, and no other modifier keys are logically
            down.

       ·    Either the grab_window is an ancestor of (or is) the
            focus window, or the grab_window is a descendant of
            the focus window and contains the pointer.

       ·    A passive grab on the same key combination does not
            exist on any ancestor of grab_window.

hence, a window manager could blindly grab any key. My code is rough, so
here's only a man page for you. ;)

On resending the key. I originally thinkin' that the synthetic-sendin'
method, but since some apps (xterm? GNU Emacs?) don't support this, 
i move to use the `cut buffer` technique, now proved failed, I'm waiting
your help... ;) i still in a mess with the `selection' mechanism.

once this is being done. We then don't need XIM anymore, I guess? is it
suggesting this is then impossible? ;) but anyways, it will be much
simpler than the XIM solution... IMHO.

Best regards,

P.s. if someone reading this thinks me a quite ok programmer, and have
a job opportunity, then please consider help me. ;) I'm tryin hard to
find a job after the comin' china new year... my grrl friend will kill
me if i can't find a job then... ;)

-- 
zhaoway -=- zw * zhaoway.com -=- http://www.zhaoway.com/ -=- blue ribbon
GnuPG 1024D/7C0441F2  BF4F B39D A53E A9BB 1057  2364 652C 1BA6 7C04 41F2


Reply to: