Xext: allow per-device GE masks.
Instead of a single mask per client we allow the storage of a mask per client per device.
This commit is contained in:
parent
ba315ae5dd
commit
94a6a65ae7
12
Xext/geext.c
12
Xext/geext.c
|
@ -300,7 +300,8 @@ GERecalculateWinMask(WindowPtr pWin)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set generic event mask for given window. */
|
/* Set generic event mask for given window. */
|
||||||
void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask)
|
void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
|
||||||
|
WindowPtr pWin, int extension, Mask mask)
|
||||||
{
|
{
|
||||||
GenericMaskPtr cli;
|
GenericMaskPtr cli;
|
||||||
|
|
||||||
|
@ -326,13 +327,13 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
|
||||||
cli = evmasks->geClients;
|
cli = evmasks->geClients;
|
||||||
while(cli)
|
while(cli)
|
||||||
{
|
{
|
||||||
if (cli->client == pClient)
|
if (cli->client == pClient && cli->dev == pDev)
|
||||||
break;
|
break;
|
||||||
cli = cli->next;
|
cli = cli->next;
|
||||||
}
|
}
|
||||||
if (!cli)
|
if (!cli)
|
||||||
{
|
{
|
||||||
/* new client */
|
/* new client and/or new device */
|
||||||
cli = (GenericMaskPtr)xcalloc(1, sizeof(GenericMaskRec));
|
cli = (GenericMaskPtr)xcalloc(1, sizeof(GenericMaskRec));
|
||||||
if (!cli)
|
if (!cli)
|
||||||
{
|
{
|
||||||
|
@ -341,6 +342,7 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
|
||||||
}
|
}
|
||||||
cli->next = evmasks->geClients;
|
cli->next = evmasks->geClients;
|
||||||
cli->client = pClient;
|
cli->client = pClient;
|
||||||
|
cli->dev = pDev;
|
||||||
evmasks->geClients = cli;
|
evmasks->geClients = cli;
|
||||||
}
|
}
|
||||||
cli->eventMask[extension] = mask;
|
cli->eventMask[extension] = mask;
|
||||||
|
@ -348,7 +350,7 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
|
||||||
{
|
{
|
||||||
/* remove client. */
|
/* remove client. */
|
||||||
cli = pWin->optional->geMasks->geClients;
|
cli = pWin->optional->geMasks->geClients;
|
||||||
if (cli->client == pClient)
|
if (cli->client == pClient && cli->dev == pDev)
|
||||||
{
|
{
|
||||||
pWin->optional->geMasks->geClients = cli->next;
|
pWin->optional->geMasks->geClients = cli->next;
|
||||||
xfree(cli);
|
xfree(cli);
|
||||||
|
@ -359,7 +361,7 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
|
||||||
|
|
||||||
while(cli)
|
while(cli)
|
||||||
{
|
{
|
||||||
if (cli->client == pClient)
|
if (cli->client == pClient && cli->dev == pDev)
|
||||||
{
|
{
|
||||||
prev->next = cli->next;
|
prev->next = cli->next;
|
||||||
xfree(cli);
|
xfree(cli);
|
||||||
|
|
|
@ -39,11 +39,12 @@ from the author.
|
||||||
* This struct is used both in the window and by grabs to determine the event
|
* This struct is used both in the window and by grabs to determine the event
|
||||||
* mask for a client.
|
* mask for a client.
|
||||||
* A window will have a linked list of these structs, with one entry per
|
* A window will have a linked list of these structs, with one entry per
|
||||||
* client, null-terminated.
|
* client per device, null-terminated.
|
||||||
* A grab has only one instance of this struct.
|
* A grab has only one instance of this struct.
|
||||||
*/
|
*/
|
||||||
typedef struct _GenericMaskRec {
|
typedef struct _GenericMaskRec {
|
||||||
ClientPtr client; /* client who set the event mask */
|
ClientPtr client; /* client who set the event mask */
|
||||||
|
DeviceIntPtr dev;
|
||||||
Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */
|
Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */
|
||||||
struct _GenericMaskRec* next;
|
struct _GenericMaskRec* next;
|
||||||
} GenericMaskRec, *GenericMaskPtr;
|
} GenericMaskRec, *GenericMaskPtr;
|
||||||
|
@ -94,7 +95,9 @@ extern GEExtension GEExtensions[MAXEXTENSIONS];
|
||||||
|
|
||||||
|
|
||||||
/* Interface for other extensions */
|
/* Interface for other extensions */
|
||||||
void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask);
|
void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
|
||||||
|
WindowPtr pWin, int extension, Mask mask);
|
||||||
|
|
||||||
void GERegisterExtension(
|
void GERegisterExtension(
|
||||||
int extension,
|
int extension,
|
||||||
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to),
|
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to),
|
||||||
|
|
|
@ -61,16 +61,19 @@ ProcXiSelectEvent(ClientPtr client)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
DeviceIntPtr pDev;
|
||||||
REQUEST(xXiSelectEventReq);
|
REQUEST(xXiSelectEventReq);
|
||||||
REQUEST_SIZE_MATCH(xXiSelectEventReq);
|
REQUEST_SIZE_MATCH(xXiSelectEventReq);
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
{
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
|
||||||
|
|
||||||
GEWindowSetMask(client, pWin, IReqCode, stuff->mask);
|
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
GEWindowSetMask(client, pDev, pWin, IReqCode, stuff->mask);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue