diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-09-26 18:03:21 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-09-26 18:03:21 +0930 |
commit | 3342b5ad47be25c6838321c0aafc28c329c308b5 (patch) | |
tree | f09a3fddbe64190aa9ed581bef5169204dd95870 | |
parent | e2cb8515661b1f7826981931d82dee6e05529f04 (diff) |
Xi: fix the wrapper code for processInputProc wrapping.
Followup to [1].
If a core grab causes the device to freeze, it overwrites the processInputProc
of the device. [1] would then overwrite this while unwrapping, the device
does not thaw anymore.
Changing this to only re-wrap if the processInputProc hasn't been changed
during the event handling.
[1] 340911d7243a7f1095d79b5b2dcfa81b145c2474
-rw-r--r-- | Xi/exevents.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 2baaa58e3..d844eefea 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -104,15 +104,23 @@ typedef struct { */ #define WRAP_PROCESS_INPUT_PROC(device, saveprocs, newproc) \ - saveprocs->processInputProc = device->public.processInputProc; \ + saveprocs->processInputProc = \ saveprocs->realInputProc = device->public.realInputProc; \ device->public.processInputProc = newproc; \ - device->public.realInputProc = newproc; + device->public.realInputProc = newproc -#define UNWRAP_PROCESS_INPUT_PROC(device, saveprocs) \ +#define UNWRAP_PROCESS_INPUT_PROC(device, saveprocs, backupproc) \ + backupproc = device->public.processInputProc; \ device->public.processInputProc = saveprocs->processInputProc; \ device->public.realInputProc = saveprocs->realInputProc; +#define REWRAP_PROCESS_INPUT_PROC(device, saveprocs, newproc) \ + if (device->public.processInputProc == device->public.realInputProc) \ + device->public.processInputProc = newproc; \ + saveprocs->processInputProc = \ + saveprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = newproc; + void RegisterOtherDevice(DeviceIntPtr device) { @@ -159,11 +167,13 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count) /* Handle core events. */ if (xE->u.u.type < LASTEvent && xE->u.u.type != GenericEvent) { + ProcessInputProc backupproc; xiDevPrivatePtr xiPrivPtr = (xiDevPrivatePtr)device->devPrivates[xiDevPrivateIndex].ptr; - UNWRAP_PROCESS_INPUT_PROC(device, xiPrivPtr); + UNWRAP_PROCESS_INPUT_PROC(device, xiPrivPtr, backupproc); device->public.processInputProc(xE, device, count); - WRAP_PROCESS_INPUT_PROC(device, xiPrivPtr, ProcessOtherEvent); + /* only rewraps is the processInputProc hasn't been modified */ + REWRAP_PROCESS_INPUT_PROC(device, xiPrivPtr, backupproc); return; } |