input: swap the server over to use the XI2mask struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
parent
b8b90cd161
commit
86bb3781b3
|
@ -1631,6 +1631,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
|
||||||
static void
|
static void
|
||||||
FreeInputClient(InputClientsPtr *other)
|
FreeInputClient(InputClientsPtr *other)
|
||||||
{
|
{
|
||||||
|
xi2mask_free(&(*other)->xi2mask);
|
||||||
free(*other);
|
free(*other);
|
||||||
*other = NULL;
|
*other = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1653,6 +1654,9 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
|
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
|
||||||
goto bail;
|
goto bail;
|
||||||
|
others->xi2mask = xi2mask_new();
|
||||||
|
if (!others->xi2mask)
|
||||||
|
goto bail;
|
||||||
others->mask[mskidx] = mask;
|
others->mask[mskidx] = mask;
|
||||||
others->resource = FakeClientID(client->index);
|
others->resource = FakeClientID(client->index);
|
||||||
others->next = pWin->optional->inputMasks->inputClients;
|
others->next = pWin->optional->inputMasks->inputClients;
|
||||||
|
@ -1674,6 +1678,12 @@ MakeInputMasks(WindowPtr pWin)
|
||||||
imasks = calloc(1, sizeof(struct _OtherInputMasks));
|
imasks = calloc(1, sizeof(struct _OtherInputMasks));
|
||||||
if (!imasks)
|
if (!imasks)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
imasks->xi2mask = xi2mask_new();
|
||||||
|
if (!imasks->xi2mask)
|
||||||
|
{
|
||||||
|
free(imasks);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
pWin->optional->inputMasks = imasks;
|
pWin->optional->inputMasks = imasks;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1681,6 +1691,7 @@ MakeInputMasks(WindowPtr pWin)
|
||||||
static void
|
static void
|
||||||
FreeInputMask(OtherInputMasks **imask)
|
FreeInputMask(OtherInputMasks **imask)
|
||||||
{
|
{
|
||||||
|
xi2mask_free(&(*imask)->xi2mask);
|
||||||
free(*imask);
|
free(*imask);
|
||||||
*imask = NULL;
|
*imask = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1691,20 +1702,17 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin)
|
||||||
InputClientsPtr others;
|
InputClientsPtr others;
|
||||||
struct _OtherInputMasks *inputMasks; /* default: NULL */
|
struct _OtherInputMasks *inputMasks; /* default: NULL */
|
||||||
WindowPtr pChild, tmp;
|
WindowPtr pChild, tmp;
|
||||||
int i, j;
|
int i;
|
||||||
|
|
||||||
pChild = pWin;
|
pChild = pWin;
|
||||||
while (1) {
|
while (1) {
|
||||||
if ((inputMasks = wOtherInputMasks(pChild)) != 0) {
|
if ((inputMasks = wOtherInputMasks(pChild)) != 0) {
|
||||||
for (i = 0; i < EMASKSIZE; i++)
|
xi2mask_zero(inputMasks->xi2mask, -1);
|
||||||
memset(inputMasks->xi2mask[i], 0, sizeof(inputMasks->xi2mask[i]));
|
|
||||||
for (others = inputMasks->inputClients; others;
|
for (others = inputMasks->inputClients; others;
|
||||||
others = others->next) {
|
others = others->next) {
|
||||||
for (i = 0; i < EMASKSIZE; i++)
|
for (i = 0; i < EMASKSIZE; i++)
|
||||||
inputMasks->inputEvents[i] |= others->mask[i];
|
inputMasks->inputEvents[i] |= others->mask[i];
|
||||||
for (i = 0; i < EMASKSIZE; i++)
|
xi2mask_merge(inputMasks->xi2mask, others->xi2mask);
|
||||||
for (j = 0; j < XI2MASKSIZE; j++)
|
|
||||||
inputMasks->xi2mask[i][j] |= others->xi2mask[i][j];
|
|
||||||
}
|
}
|
||||||
for (i = 0; i < EMASKSIZE; i++)
|
for (i = 0; i < EMASKSIZE; i++)
|
||||||
inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i];
|
inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i];
|
||||||
|
@ -2188,14 +2196,12 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
|
||||||
for (others = wOtherInputMasks(win)->inputClients; others;
|
for (others = wOtherInputMasks(win)->inputClients; others;
|
||||||
others = others->next) {
|
others = others->next) {
|
||||||
if (SameClient(others, client)) {
|
if (SameClient(others, client)) {
|
||||||
memset(others->xi2mask[dev->id], 0,
|
xi2mask_zero(others->xi2mask, dev->id);
|
||||||
sizeof(others->xi2mask[dev->id]));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len = min(len, sizeof(others->xi2mask[dev->id]));
|
|
||||||
|
|
||||||
if (len && !others)
|
if (len && !others)
|
||||||
{
|
{
|
||||||
|
@ -2204,11 +2210,14 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
|
||||||
others= wOtherInputMasks(win)->inputClients;
|
others= wOtherInputMasks(win)->inputClients;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (others)
|
if (others) {
|
||||||
memset(others->xi2mask[dev->id], 0, sizeof(others->xi2mask[dev->id]));
|
xi2mask_zero(others->xi2mask, dev->id);
|
||||||
|
len = min(len, xi2mask_mask_size(others->xi2mask));
|
||||||
|
}
|
||||||
|
|
||||||
if (len)
|
if (len) {
|
||||||
memcpy(others->xi2mask[dev->id], mask, len);
|
xi2mask_set_one_mask(others->xi2mask, dev->id, mask, len);
|
||||||
|
}
|
||||||
|
|
||||||
RecalculateDeviceDeliverableEvents(win);
|
RecalculateDeviceDeliverableEvents(win);
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "exglobals.h" /* BadDevice */
|
#include "exglobals.h" /* BadDevice */
|
||||||
#include "exevents.h"
|
#include "exevents.h"
|
||||||
#include "xigrabdev.h"
|
#include "xigrabdev.h"
|
||||||
|
#include "inpututils.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
SProcXIGrabDevice(ClientPtr client)
|
SProcXIGrabDevice(ClientPtr client)
|
||||||
|
@ -64,7 +65,7 @@ ProcXIGrabDevice(ClientPtr client)
|
||||||
xXIGrabDeviceReply rep;
|
xXIGrabDeviceReply rep;
|
||||||
int ret = Success;
|
int ret = Success;
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
GrabMask mask;
|
GrabMask mask = { 0 };
|
||||||
int mask_len;
|
int mask_len;
|
||||||
|
|
||||||
REQUEST(xXIGrabDeviceReq);
|
REQUEST(xXIGrabDeviceReq);
|
||||||
|
@ -81,9 +82,13 @@ ProcXIGrabDevice(ClientPtr client)
|
||||||
stuff->mask_len * 4) != Success)
|
stuff->mask_len * 4) != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4);
|
mask.xi2mask = xi2mask_new();
|
||||||
memset(mask.xi2mask, 0, sizeof(mask.xi2mask));
|
if (!mask.xi2mask)
|
||||||
memcpy(mask.xi2mask, (char*)&stuff[1], mask_len);
|
return BadAlloc;
|
||||||
|
|
||||||
|
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
|
||||||
|
/* FIXME: I think the old code was broken here */
|
||||||
|
xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char*)&stuff[1], mask_len);
|
||||||
|
|
||||||
ret = GrabDevice(client, dev, stuff->grab_mode,
|
ret = GrabDevice(client, dev, stuff->grab_mode,
|
||||||
stuff->paired_device_mode,
|
stuff->paired_device_mode,
|
||||||
|
@ -96,6 +101,8 @@ ProcXIGrabDevice(ClientPtr client)
|
||||||
None /* confineTo */,
|
None /* confineTo */,
|
||||||
&status);
|
&status);
|
||||||
|
|
||||||
|
xi2mask_free(&mask.xi2mask);
|
||||||
|
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "xipassivegrab.h"
|
#include "xipassivegrab.h"
|
||||||
#include "dixgrabs.h"
|
#include "dixgrabs.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "inpututils.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
SProcXIPassiveGrabDevice(ClientPtr client)
|
SProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
|
@ -82,7 +83,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
int i, ret = Success;
|
int i, ret = Success;
|
||||||
uint32_t *modifiers;
|
uint32_t *modifiers;
|
||||||
xXIGrabModifierInfo *modifiers_failed;
|
xXIGrabModifierInfo *modifiers_failed;
|
||||||
GrabMask mask;
|
GrabMask mask = { 0 };
|
||||||
GrabParameters param;
|
GrabParameters param;
|
||||||
void *tmp;
|
void *tmp;
|
||||||
int mask_len;
|
int mask_len;
|
||||||
|
@ -124,9 +125,12 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
stuff->mask_len * 4) != Success)
|
stuff->mask_len * 4) != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4);
|
mask.xi2mask = xi2mask_new();
|
||||||
memset(mask.xi2mask, 0, sizeof(mask.xi2mask));
|
if (!mask.xi2mask)
|
||||||
memcpy(mask.xi2mask[stuff->deviceid], &stuff[1], mask_len * 4);
|
return BadAlloc;
|
||||||
|
|
||||||
|
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
|
||||||
|
xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid, (unsigned char*)&stuff[1], mask_len * 4);
|
||||||
|
|
||||||
rep.repType = X_Reply;
|
rep.repType = X_Reply;
|
||||||
rep.RepType = X_XIPassiveGrabDevice;
|
rep.RepType = X_XIPassiveGrabDevice;
|
||||||
|
@ -212,6 +216,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
|
|
||||||
free(modifiers_failed);
|
free(modifiers_failed);
|
||||||
out:
|
out:
|
||||||
|
xi2mask_free(&mask.xi2mask);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "exglobals.h"
|
#include "exglobals.h"
|
||||||
#include "exevents.h"
|
#include "exevents.h"
|
||||||
#include <X11/extensions/XI2proto.h>
|
#include <X11/extensions/XI2proto.h>
|
||||||
|
#include "inpututils.h"
|
||||||
|
|
||||||
#include "xiselectev.h"
|
#include "xiselectev.h"
|
||||||
|
|
||||||
|
@ -249,7 +250,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
for (i = 0; i < MAXDEVICES; i++)
|
for (i = 0; i < MAXDEVICES; i++)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
unsigned char *devmask = others->xi2mask[i];
|
const unsigned char *devmask = xi2mask_get_one_mask(others->xi2mask, i);
|
||||||
|
|
||||||
if (i > 2)
|
if (i > 2)
|
||||||
{
|
{
|
||||||
|
@ -259,7 +260,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (j = XI2MASKSIZE - 1; j >= 0; j--)
|
for (j = xi2mask_mask_size(others->xi2mask) - 1; j >= 0; j--)
|
||||||
{
|
{
|
||||||
if (devmask[j] != 0)
|
if (devmask[j] != 0)
|
||||||
{
|
{
|
||||||
|
|
43
dix/events.c
43
dix/events.c
|
@ -420,12 +420,6 @@ GetXI2EventFilterMask(int evtype)
|
||||||
return (1 << (evtype % 8));
|
return (1 << (evtype % 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
|
||||||
GetXI2EventFilterOffset(int evtype)
|
|
||||||
{
|
|
||||||
return (evtype / 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the given event, return the matching event filter. This filter may then
|
* For the given event, return the matching event filter. This filter may then
|
||||||
* be AND'ed with the selected event mask.
|
* be AND'ed with the selected event mask.
|
||||||
|
@ -459,12 +453,15 @@ GetEventFilter(DeviceIntPtr dev, xEvent *event)
|
||||||
* for the event_type.
|
* for the event_type.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
GetXI2MaskByte(unsigned char xi2mask[][XI2MASKSIZE], DeviceIntPtr dev, int event_type)
|
GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type)
|
||||||
{
|
{
|
||||||
int byte = GetXI2EventFilterOffset(event_type);
|
/* we just return the matching filter because that's the only use
|
||||||
return xi2mask[dev->id][byte] |
|
* for this mask anyway.
|
||||||
xi2mask[XIAllDevices][byte] |
|
*/
|
||||||
(IsMaster(dev) ? xi2mask[XIAllMasterDevices][byte] : 0);
|
if (xi2mask_isset(mask, dev, event_type))
|
||||||
|
return GetXI2EventFilterMask(event_type);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -476,16 +473,14 @@ Bool
|
||||||
WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
|
WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
|
||||||
{
|
{
|
||||||
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
||||||
int filter;
|
|
||||||
int evtype;
|
int evtype;
|
||||||
|
|
||||||
if (!inputMasks || xi2_get_type(ev) == 0)
|
if (!inputMasks || xi2_get_type(ev) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
evtype = ((xGenericEvent*)ev)->evtype;
|
evtype = ((xGenericEvent*)ev)->evtype;
|
||||||
filter = GetEventFilter(dev, ev);
|
|
||||||
|
|
||||||
return !!(GetXI2MaskByte(inputMasks->xi2mask, dev, evtype) & filter);
|
return xi2mask_isset(inputMasks->xi2mask, dev, evtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mask
|
Mask
|
||||||
|
@ -2011,8 +2006,7 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
|
||||||
tempGrab->deviceMask = (inputMasks) ? inputMasks->inputEvents[dev->id]: 0;
|
tempGrab->deviceMask = (inputMasks) ? inputMasks->inputEvents[dev->id]: 0;
|
||||||
|
|
||||||
if (inputMasks)
|
if (inputMasks)
|
||||||
memcpy(tempGrab->xi2mask, inputMasks->xi2mask,
|
xi2mask_merge(tempGrab->xi2mask, inputMasks->xi2mask);
|
||||||
sizeof(tempGrab->xi2mask));
|
|
||||||
|
|
||||||
(*dev->deviceGrab.ActivateGrab)(dev, tempGrab,
|
(*dev->deviceGrab.ActivateGrab)(dev, tempGrab,
|
||||||
currentTime, TRUE | ImplicitGrabMask);
|
currentTime, TRUE | ImplicitGrabMask);
|
||||||
|
@ -2561,10 +2555,7 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
|
||||||
|
|
||||||
if ((type = GetXI2Type(event)) != 0)
|
if ((type = GetXI2Type(event)) != 0)
|
||||||
{
|
{
|
||||||
filter = GetXI2EventFilterMask(type);
|
if (inputMasks && xi2mask_isset(inputMasks->xi2mask, dev, type))
|
||||||
|
|
||||||
if (inputMasks &&
|
|
||||||
(GetXI2MaskByte(inputMasks->xi2mask, dev, type) & filter))
|
|
||||||
rc |= EVENT_XI2_MASK;
|
rc |= EVENT_XI2_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4155,12 +4146,11 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
if (rc == Success)
|
if (rc == Success)
|
||||||
{
|
{
|
||||||
int evtype = xi2_get_type(xi2);
|
int evtype = xi2_get_type(xi2);
|
||||||
mask = GetXI2MaskByte(grab->xi2mask, thisDev, evtype);
|
mask = xi2mask_isset(grab->xi2mask, thisDev, evtype);
|
||||||
/* try XI2 event */
|
/* try XI2 event */
|
||||||
FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE);
|
FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE);
|
||||||
/* XXX: XACE */
|
/* XXX: XACE */
|
||||||
deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask,
|
deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask, 1, grab);
|
||||||
GetEventFilter(thisDev, xi2), grab);
|
|
||||||
} else if (rc != BadMatch)
|
} else if (rc != BadMatch)
|
||||||
ErrorF("[dix] %s: XI2 conversion failed in DGE (%d, %d). Skipping delivery.\n",
|
ErrorF("[dix] %s: XI2 conversion failed in DGE (%d, %d). Skipping delivery.\n",
|
||||||
thisDev->name, event->any.type, rc);
|
thisDev->name, event->any.type, rc);
|
||||||
|
@ -4634,9 +4624,8 @@ DeviceEnterLeaveEvent(
|
||||||
if (grab)
|
if (grab)
|
||||||
{
|
{
|
||||||
Mask mask;
|
Mask mask;
|
||||||
mask = GetXI2MaskByte(grab->xi2mask, mouse, type);
|
mask = xi2mask_isset(grab->xi2mask, mouse, type);
|
||||||
TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask,
|
TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask, 1, grab);
|
||||||
filter, grab);
|
|
||||||
} else {
|
} else {
|
||||||
if (!WindowXI2MaskIsset(mouse, pWin, (xEvent*)event))
|
if (!WindowXI2MaskIsset(mouse, pWin, (xEvent*)event))
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -5100,7 +5089,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
||||||
else if (grabtype == GRABTYPE_XI)
|
else if (grabtype == GRABTYPE_XI)
|
||||||
tempGrab->eventMask = mask->xi;
|
tempGrab->eventMask = mask->xi;
|
||||||
else
|
else
|
||||||
memcpy(tempGrab->xi2mask, mask->xi2mask, sizeof(tempGrab->xi2mask));
|
xi2mask_merge(tempGrab->xi2mask, mask->xi2mask);
|
||||||
tempGrab->device = dev;
|
tempGrab->device = dev;
|
||||||
tempGrab->cursor = cursor;
|
tempGrab->cursor = cursor;
|
||||||
tempGrab->confineTo = confineTo;
|
tempGrab->confineTo = confineTo;
|
||||||
|
|
38
dix/grabs.c
38
dix/grabs.c
|
@ -60,6 +60,7 @@ SOFTWARE.
|
||||||
#include "dixgrabs.h"
|
#include "dixgrabs.h"
|
||||||
#include "xace.h"
|
#include "xace.h"
|
||||||
#include "exevents.h"
|
#include "exevents.h"
|
||||||
|
#include "inpututils.h"
|
||||||
|
|
||||||
#define BITMASK(i) (((Mask)1) << ((i) & 31))
|
#define BITMASK(i) (((Mask)1) << ((i) & 31))
|
||||||
#define MASKIDX(i) ((i) >> 5)
|
#define MASKIDX(i) ((i) >> 5)
|
||||||
|
@ -122,13 +123,15 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
|
||||||
}
|
}
|
||||||
else if (grab->grabtype == GRABTYPE_XI2)
|
else if (grab->grabtype == GRABTYPE_XI2)
|
||||||
{
|
{
|
||||||
for (i = 0; i < EMASKSIZE; i++)
|
for (i = 0; i < xi2mask_num_masks(grab->xi2mask); i++)
|
||||||
{
|
{
|
||||||
|
const unsigned char *mask;
|
||||||
int print;
|
int print;
|
||||||
print = 0;
|
print = 0;
|
||||||
for (j = 0; j < XI2MASKSIZE; j++)
|
for (j = 0; j < XI2MASKSIZE; j++)
|
||||||
{
|
{
|
||||||
if (grab->xi2mask[i][j])
|
mask = xi2mask_get_one_mask(grab->xi2mask, i);
|
||||||
|
if (mask[j])
|
||||||
{
|
{
|
||||||
print = 1;
|
print = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -137,8 +140,8 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
|
||||||
if (!print)
|
if (!print)
|
||||||
continue;
|
continue;
|
||||||
ErrorF(" xi2 event mask for device %d: 0x", dev->id);
|
ErrorF(" xi2 event mask for device %d: 0x", dev->id);
|
||||||
for (j = 0; j < XI2MASKSIZE; j++)
|
for (j = 0; j < xi2mask_mask_size(grab->xi2mask); j++)
|
||||||
ErrorF("%x", grab->xi2mask[i][j]);
|
ErrorF("%x", mask[j]);
|
||||||
ErrorF("\n");
|
ErrorF("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,6 +188,14 @@ AllocGrab(void)
|
||||||
{
|
{
|
||||||
GrabPtr grab = calloc(1, sizeof(GrabRec));
|
GrabPtr grab = calloc(1, sizeof(GrabRec));
|
||||||
|
|
||||||
|
if (grab) {
|
||||||
|
grab->xi2mask = xi2mask_new();
|
||||||
|
if (!grab->xi2mask) {
|
||||||
|
free(grab);
|
||||||
|
grab = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return grab;
|
return grab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +238,7 @@ CreateGrab(
|
||||||
grab->next = NULL;
|
grab->next = NULL;
|
||||||
|
|
||||||
if (grabtype == GRABTYPE_XI2)
|
if (grabtype == GRABTYPE_XI2)
|
||||||
memcpy(grab->xi2mask, mask->xi2mask, sizeof(mask->xi2mask));
|
xi2mask_merge(grab->xi2mask, mask->xi2mask);
|
||||||
if (cursor)
|
if (cursor)
|
||||||
cursor->refcnt++;
|
cursor->refcnt++;
|
||||||
return grab;
|
return grab;
|
||||||
|
@ -243,6 +254,7 @@ FreeGrab(GrabPtr pGrab)
|
||||||
if (pGrab->cursor)
|
if (pGrab->cursor)
|
||||||
FreeCursor(pGrab->cursor, (Cursor)0);
|
FreeCursor(pGrab->cursor, (Cursor)0);
|
||||||
|
|
||||||
|
xi2mask_free(&pGrab->xi2mask);
|
||||||
free(pGrab);
|
free(pGrab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +263,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
|
||||||
{
|
{
|
||||||
Mask *mdetails_mask = NULL;
|
Mask *mdetails_mask = NULL;
|
||||||
Mask *details_mask = NULL;
|
Mask *details_mask = NULL;
|
||||||
|
XI2Mask *xi2mask;
|
||||||
|
|
||||||
if (src->cursor)
|
if (src->cursor)
|
||||||
src->cursor->refcnt++;
|
src->cursor->refcnt++;
|
||||||
|
@ -273,9 +286,24 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
|
||||||
memcpy(details_mask, src->detail.pMask, len);
|
memcpy(details_mask, src->detail.pMask, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!dst->xi2mask) {
|
||||||
|
xi2mask = xi2mask_new();
|
||||||
|
if (!xi2mask) {
|
||||||
|
free(mdetails_mask);
|
||||||
|
free(details_mask);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xi2mask = dst->xi2mask;
|
||||||
|
xi2mask_zero(xi2mask, -1);
|
||||||
|
}
|
||||||
|
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
dst->modifiersDetail.pMask = mdetails_mask;
|
dst->modifiersDetail.pMask = mdetails_mask;
|
||||||
dst->detail.pMask = details_mask;
|
dst->detail.pMask = details_mask;
|
||||||
|
dst->xi2mask = xi2mask;
|
||||||
|
|
||||||
|
xi2mask_merge(dst->xi2mask, src->xi2mask);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ typedef struct _InputClients {
|
||||||
XID resource; /**< id for putting into resource manager */
|
XID resource; /**< id for putting into resource manager */
|
||||||
Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
|
Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
|
||||||
/** XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
/** XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
||||||
unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
struct _XI2Mask *xi2mask;
|
||||||
} InputClients;
|
} InputClients;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +148,7 @@ typedef struct _OtherInputMasks {
|
||||||
/** The clients that selected for events */
|
/** The clients that selected for events */
|
||||||
InputClientsPtr inputClients;
|
InputClientsPtr inputClients;
|
||||||
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
||||||
unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
struct _XI2Mask *xi2mask;
|
||||||
} OtherInputMasks;
|
} OtherInputMasks;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -176,7 +176,7 @@ typedef enum {
|
||||||
union _GrabMask {
|
union _GrabMask {
|
||||||
Mask core;
|
Mask core;
|
||||||
Mask xi;
|
Mask xi;
|
||||||
char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
struct _XI2Mask *xi2mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,7 +210,7 @@ typedef struct _GrabRec {
|
||||||
Mask eventMask;
|
Mask eventMask;
|
||||||
Mask deviceMask;
|
Mask deviceMask;
|
||||||
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
/* XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
||||||
unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
struct _XI2Mask *xi2mask;
|
||||||
} GrabRec;
|
} GrabRec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue