Commit 94a6a65a authored by Peter Hutterer's avatar Peter Hutterer

Xext: allow per-device GE masks.

Instead of a single mask per client we allow the storage of a mask per client
per device.
parent ba315ae5
......@@ -300,7 +300,8 @@ GERecalculateWinMask(WindowPtr pWin)
}
/* 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;
......@@ -326,13 +327,13 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
cli = evmasks->geClients;
while(cli)
{
if (cli->client == pClient)
if (cli->client == pClient && cli->dev == pDev)
break;
cli = cli->next;
}
if (!cli)
{
/* new client */
/* new client and/or new device */
cli = (GenericMaskPtr)xcalloc(1, sizeof(GenericMaskRec));
if (!cli)
{
......@@ -341,6 +342,7 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
}
cli->next = evmasks->geClients;
cli->client = pClient;
cli->dev = pDev;
evmasks->geClients = cli;
}
cli->eventMask[extension] = mask;
......@@ -348,7 +350,7 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
{
/* remove client. */
cli = pWin->optional->geMasks->geClients;
if (cli->client == pClient)
if (cli->client == pClient && cli->dev == pDev)
{
pWin->optional->geMasks->geClients = cli->next;
xfree(cli);
......@@ -359,7 +361,7 @@ void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask
while(cli)
{
if (cli->client == pClient)
if (cli->client == pClient && cli->dev == pDev)
{
prev->next = cli->next;
xfree(cli);
......
......@@ -39,12 +39,13 @@ from the author.
* This struct is used both in the window and by grabs to determine the event
* mask for a client.
* 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.
*/
typedef struct _GenericMaskRec {
ClientPtr client; /* client who set the event mask */
Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */
ClientPtr client; /* client who set the event mask */
DeviceIntPtr dev;
Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */
struct _GenericMaskRec* next;
} GenericMaskRec, *GenericMaskPtr;
......@@ -94,7 +95,9 @@ extern GEExtension GEExtensions[MAXEXTENSIONS];
/* 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(
int extension,
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to),
......
......@@ -61,16 +61,19 @@ ProcXiSelectEvent(ClientPtr client)
{
int rc;
WindowPtr pWin;
DeviceIntPtr pDev;
REQUEST(xXiSelectEventReq);
REQUEST_SIZE_MATCH(xXiSelectEventReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (rc != Success)
{
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment