dix: Rework Enter/Leave semaphore system.

Instead of a simple counter, use bits to keep track of which device is where
etc. When device enters a window (or sets focus), the bit matching the device
is set, when it leaves again, it is unset. If there are 0 bits set, then
Leave/Enter/Focus events may be sent to the client.

Same theory as before, but this should get around the insanity with
Grab/Ungrab special cases. Those cases are basically untested though.
This commit is contained in:
Peter Hutterer
2008-04-10 19:22:59 +09:30
parent a88386ee27
commit 04dff74ffd
5 changed files with 114 additions and 62 deletions

View File

@@ -59,6 +59,7 @@ SOFTWARE.
#include "miscstruct.h"
#include <X11/Xprotostr.h>
#include "opaque.h"
#include "inputstr.h"
#define GuaranteeNothing 0
#define GuaranteeVisBack 1
@@ -257,11 +258,14 @@ extern ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
extern DevPrivateKey FocusPrivatesKey;
/* Used to maintain semantics of core protocol for Enter/LeaveNotifies and
* FocusIn/Out events for multiple pointers/keyboards.
*/
* FocusIn/Out events for multiple pointers/keyboards.
*
* Each device ID corresponds to one bit. If set, the device is in the
* window/has focus.
*/
typedef struct _FocusSemaphores {
int enterleave;
int focusinout;
char enterleave[(MAX_DEVICES + 7)/8];
char focusinout[(MAX_DEVICES + 7)/8];
} FocusSemaphoresRec, *FocusSemaphoresPtr;
/*