Merge remote-tracking branch 'whot/for-keith'
This commit is contained in:
commit
3197b773c8
@ -1628,6 +1628,19 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
FreeInputClient(InputClientsPtr *other)
|
||||
{
|
||||
free(*other);
|
||||
*other = NULL;
|
||||
}
|
||||
|
||||
static InputClientsPtr
|
||||
AllocInputClient(void)
|
||||
{
|
||||
return calloc(1, sizeof(InputClients));
|
||||
}
|
||||
|
||||
int
|
||||
AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
|
||||
{
|
||||
@ -1635,7 +1648,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
|
||||
|
||||
if (!pWin->optional && !MakeWindowOptional(pWin))
|
||||
return BadAlloc;
|
||||
others = calloc(1, sizeof(InputClients));
|
||||
others = AllocInputClient();
|
||||
if (!others)
|
||||
return BadAlloc;
|
||||
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
|
||||
@ -1649,7 +1662,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
|
||||
return Success;
|
||||
|
||||
bail:
|
||||
free(others);
|
||||
FreeInputClient(&others);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
@ -1665,6 +1678,13 @@ MakeInputMasks(WindowPtr pWin)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
FreeInputMask(OtherInputMasks **imask)
|
||||
{
|
||||
free(*imask);
|
||||
*imask = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
RecalculateDeviceDeliverableEvents(WindowPtr pWin)
|
||||
{
|
||||
@ -1721,14 +1741,15 @@ InputClientGone(WindowPtr pWin, XID id)
|
||||
if (other->resource == id) {
|
||||
if (prev) {
|
||||
prev->next = other->next;
|
||||
free(other);
|
||||
FreeInputClient(&other);
|
||||
} else if (!(other->next)) {
|
||||
if (ShouldFreeInputMasks(pWin, TRUE)) {
|
||||
wOtherInputMasks(pWin)->inputClients = other->next;
|
||||
free(wOtherInputMasks(pWin));
|
||||
OtherInputMasks *mask = wOtherInputMasks(pWin);
|
||||
mask->inputClients = other->next;
|
||||
FreeInputMask(&mask);
|
||||
pWin->optional->inputMasks = (OtherInputMasks *) NULL;
|
||||
CheckWindowOptionalNeed(pWin);
|
||||
free(other);
|
||||
FreeInputClient(&other);
|
||||
} else {
|
||||
other->resource = FakeClientID(0);
|
||||
if (!AddResource(other->resource, RT_INPUTCLIENT,
|
||||
@ -1737,7 +1758,7 @@ InputClientGone(WindowPtr pWin, XID id)
|
||||
}
|
||||
} else {
|
||||
wOtherInputMasks(pWin)->inputClients = other->next;
|
||||
free(other);
|
||||
FreeInputClient(&other);
|
||||
}
|
||||
RecalculateDeviceDeliverableEvents(pWin);
|
||||
return Success;
|
||||
|
@ -80,7 +80,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||
DeviceIntPtr dev, mod_dev;
|
||||
xXIPassiveGrabDeviceReply rep;
|
||||
int i, ret = Success;
|
||||
uint8_t status;
|
||||
uint32_t *modifiers;
|
||||
xXIGrabModifierInfo *modifiers_failed;
|
||||
GrabMask mask;
|
||||
@ -145,32 +144,36 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||
|
||||
if (stuff->cursor != None)
|
||||
{
|
||||
status = dixLookupResourceByType(&tmp, stuff->cursor,
|
||||
ret = dixLookupResourceByType(&tmp, stuff->cursor,
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (status != Success)
|
||||
if (ret != Success)
|
||||
{
|
||||
client->errorValue = stuff->cursor;
|
||||
return status;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
status = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
|
||||
if (status != Success)
|
||||
return status;
|
||||
ret = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
|
||||
if (ret != Success)
|
||||
goto out;
|
||||
|
||||
status = CheckGrabValues(client, ¶m);
|
||||
if (status != Success)
|
||||
return status;
|
||||
ret = CheckGrabValues(client, ¶m);
|
||||
if (ret != Success)
|
||||
goto out;
|
||||
|
||||
modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
|
||||
modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
|
||||
if (!modifiers_failed)
|
||||
return BadAlloc;
|
||||
if (!modifiers_failed) {
|
||||
ret = BadAlloc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
||||
|
||||
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
|
||||
{
|
||||
uint8_t status = Success;
|
||||
|
||||
param.modifiers = *modifiers;
|
||||
switch(stuff->grab_type)
|
||||
{
|
||||
@ -208,6 +211,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||
WriteToClient(client, rep.length * 4, (char*)modifiers_failed);
|
||||
|
||||
free(modifiers_failed);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
25
dix/events.c
25
dix/events.c
@ -469,10 +469,11 @@ GetXI2MaskByte(unsigned char xi2mask[][XI2MASKSIZE], DeviceIntPtr dev, int event
|
||||
|
||||
|
||||
/**
|
||||
* Return the windows complete XI2 mask for the given XI2 event type.
|
||||
* @return TRUE if the mask is set for this event from this device on the
|
||||
* window, or FALSE otherwise.
|
||||
*/
|
||||
Mask
|
||||
GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
|
||||
Bool
|
||||
WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
|
||||
{
|
||||
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
||||
int filter;
|
||||
@ -484,7 +485,7 @@ GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
|
||||
evtype = ((xGenericEvent*)ev)->evtype;
|
||||
filter = GetEventFilter(dev, ev);
|
||||
|
||||
return (GetXI2MaskByte(inputMasks->xi2mask, dev, evtype) & filter);
|
||||
return !!(GetXI2MaskByte(inputMasks->xi2mask, dev, evtype) & filter);
|
||||
}
|
||||
|
||||
Mask
|
||||
@ -2075,7 +2076,7 @@ GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
|
||||
{
|
||||
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
||||
/* Has any client selected for the event? */
|
||||
if (!GetWindowXI2Mask(dev, win, events))
|
||||
if (!WindowXI2MaskIsset(dev, win, events))
|
||||
goto out;
|
||||
*clients = inputMasks->inputClients;
|
||||
} else {
|
||||
@ -3787,14 +3788,13 @@ CheckPassiveGrabsOnWindow(
|
||||
}
|
||||
|
||||
if (!activate)
|
||||
{
|
||||
return grab;
|
||||
}
|
||||
break;
|
||||
else if (!GetXIType(event) && !GetCoreType(event))
|
||||
{
|
||||
ErrorF("Event type %d in CheckPassiveGrabsOnWindow is neither"
|
||||
" XI 1.x nor core\n", event->any.type);
|
||||
return NULL;
|
||||
grab = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* The only consumers of corestate are Xi 1.x and core events, which
|
||||
@ -3860,9 +3860,10 @@ CheckPassiveGrabsOnWindow(
|
||||
}
|
||||
|
||||
free(xE);
|
||||
return grab;
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return grab;
|
||||
#undef CORE_MATCH
|
||||
#undef XI_MATCH
|
||||
#undef XI2_MATCH
|
||||
@ -4632,7 +4633,7 @@ DeviceEnterLeaveEvent(
|
||||
TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask,
|
||||
filter, grab);
|
||||
} else {
|
||||
if (!GetWindowXI2Mask(mouse, pWin, (xEvent*)event))
|
||||
if (!WindowXI2MaskIsset(mouse, pWin, (xEvent*)event))
|
||||
goto out;
|
||||
DeliverEventsToWindow(mouse, pWin, (xEvent*)event, 1, filter,
|
||||
NullGrab);
|
||||
|
@ -535,7 +535,7 @@ extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
|
||||
/* misc event helpers */
|
||||
extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
|
||||
extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
|
||||
extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
|
||||
extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
|
||||
void FixUpEventFromWindow(SpritePtr pSprite,
|
||||
xEvent *xE,
|
||||
WindowPtr pWin,
|
||||
|
@ -72,7 +72,7 @@ extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
|
||||
* this number here is bumped.
|
||||
*/
|
||||
#define XI2LASTEVENT 17 /* XI_RawMotion */
|
||||
#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */
|
||||
#define XI2MASKSIZE ((XI2LASTEVENT >> 3) + 1) /* no of bytes for masks */
|
||||
|
||||
/**
|
||||
* Scroll types for ::SetScrollValuator and the scroll type in the
|
||||
|
@ -359,4 +359,11 @@ typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
|
||||
extern _X_EXPORT unsigned long globalSerialNumber;
|
||||
extern _X_EXPORT unsigned long serverGeneration;
|
||||
|
||||
#define BUG_WARN(cond) \
|
||||
do { if (cond) { \
|
||||
ErrorF("BUG: triggered 'if (" #cond ")'\nBUG: %s:%d in %s()\n", \
|
||||
__FILE__, __LINE__, __func__); \
|
||||
xorg_backtrace(); \
|
||||
} } while(0)
|
||||
|
||||
#endif /* MISC_H */
|
||||
|
@ -76,7 +76,6 @@ static void dix_update_desktop_dimensions(void)
|
||||
|
||||
#define assert_dimensions(_x, _y, _w, _h) \
|
||||
update_desktop_dimensions(); \
|
||||
printf("%d %d %d %d\n", screenInfo.x, screenInfo.y, screenInfo.width, screenInfo.height); \
|
||||
assert(screenInfo.x == _x); \
|
||||
assert(screenInfo.y == _y); \
|
||||
assert(screenInfo.width == _w); \
|
||||
@ -88,8 +87,6 @@ static void dix_update_desktop_dimensions(void)
|
||||
screenInfo.screens[idx]->width = _w; \
|
||||
screenInfo.screens[idx]->height = _h; \
|
||||
|
||||
printf("Testing\n");
|
||||
|
||||
/* single screen */
|
||||
screenInfo.numScreens = 1;
|
||||
set_screen(0, x, y, w, h);
|
||||
|
Loading…
Reference in New Issue
Block a user