diff options
author | Thomas Jaeger <thjaeger@gmail.com> | 2008-04-01 15:27:06 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-04-01 15:31:50 +0300 |
commit | 37b1258f0a288a79ce6a3eef3559e17a67c4dd96 (patch) | |
tree | 9712e689fc235bfdba2897fe07d9efd58c0ab992 | |
parent | a4d034941100c6ca3b7cc4e59952c2745b9306cc (diff) |
XKB: Fix processInputProc wrapping
If input processing is frozen, only wrap realInputProc: don't smash
processInputProc as well. When input processing is thawed, pIP will be
rewrapped correctly.
This supersedes the previous workaround in 50e80c9.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | include/xkbsrv.h | 16 | ||||
-rw-r--r-- | xkb/xkbActions.c | 9 |
2 files changed, 16 insertions, 9 deletions
diff --git a/include/xkbsrv.h b/include/xkbsrv.h index ef99e94e7..040bb936a 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -237,6 +237,14 @@ typedef struct _XkbSrvLedInfo { typedef struct { ProcessInputProc processInputProc; + /* If processInputProc is set to something different than realInputProc, + * UNWRAP and COND_WRAP will not touch processInputProc and update only + * realInputProc. This ensures that + * processInputProc == (frozen ? EnqueueEvent : realInputProc) + * + * WRAP_PROCESS_INPUT_PROC should only be called during initialization, + * since it may destroy this invariant. + */ ProcessInputProc realInputProc; DeviceUnwrapProc unwrapProc; } xkbDeviceInfoRec, *xkbDeviceInfoPtr; @@ -254,14 +262,14 @@ typedef struct device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ - if (proc != device->public.enqueueInputProc) \ - device->public.realInputProc = proc; \ + device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs, backupproc) \ - backupproc = device->public.processInputProc; \ - device->public.processInputProc = oldprocs->processInputProc; \ + backupproc = device->public.realInputProc; \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = oldprocs->realInputProc; \ device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 890cf4250..8c72874df 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -49,15 +49,14 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) { xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device); - ProcessInputProc tmp = device->public.processInputProc; - ProcessInputProc dummy; /* unused, but neede for macro */ + ProcessInputProc backupproc; if(xkbPrivPtr->unwrapProc) xkbPrivPtr->unwrapProc = NULL; - UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, dummy); + UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, backupproc); proc(device,data); - WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, - tmp,xkbUnwrapProc); + COND_WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, + backupproc,xkbUnwrapProc); } |