dix: Add special treatment of NotifyUngrab for enter/leave events.

In some cases (e.g. using x2x) the previous model broke, with a window ending
not counting down to 0 anymore. Special treatment for NotifyUngrab seems to
help here.

Current solution: If a NotifyGrab is to be sent ignore it. If a NotifyUngrab
enter is sent, only adjust the semaphore if it is on 0. Likewise, do the same
for a NotifyUngrab leave if the semaphore is on 1. This seems to work alright
so far.
This commit is contained in:
Peter Hutterer 2007-11-24 15:00:43 +10:30
parent 691da03131
commit 5dabe448bd

View File

@ -4468,12 +4468,17 @@ LeaveNotifies(DeviceIntPtr pDev,
}
}
/* welcome to insanity */
#define FOCUS_SEMAPHORE_MODIFY(win, field, mode, val) \
{ \
if (mode != NotifyGrab && mode != NotifyUngrab) \
{ \
FocusSemaphoresPtr sem;\
sem = (FocusSemaphoresPtr)win->devPrivates[FocusPrivatesIndex].ptr; \
if (mode != NotifyGrab && mode != NotifyUngrab) { \
sem->field += val; \
} else if (mode == NotifyUngrab) { \
if (sem->field == 0 && val > 0) \
sem->field += val; \
else if (sem->field == 1 && val < 0) \
sem->field += val; \
} \
}