Xi: handle grab accept/reject requests
Consists mostly of generating an ownership event and processing it. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
parent
209b3d613a
commit
bb0af002dc
|
@ -35,6 +35,8 @@
|
|||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "mi.h"
|
||||
#include "eventstr.h"
|
||||
#include <X11/extensions/XI2.h>
|
||||
#include <X11/extensions/XI2proto.h>
|
||||
|
||||
|
@ -49,10 +51,53 @@ SProcXIAllowEvents(ClientPtr client)
|
|||
swaps(&stuff->length);
|
||||
swaps(&stuff->deviceid);
|
||||
swapl(&stuff->time);
|
||||
/* FIXME swap touchid */
|
||||
/* FIXME swap window */
|
||||
|
||||
return ProcXIAllowEvents(client);
|
||||
}
|
||||
|
||||
static int
|
||||
AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid, XID *error)
|
||||
{
|
||||
TouchPointInfoPtr ti;
|
||||
int nev, i;
|
||||
InternalEvent *events = InitEventList(GetMaximumEventsNum());
|
||||
|
||||
if (!events)
|
||||
return BadAlloc;
|
||||
|
||||
if (!dev->touch)
|
||||
{
|
||||
*error = dev->id;
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
/* FIXME window is unhandled */
|
||||
|
||||
ti = TouchFindByClientID(dev, touchid);
|
||||
if (!ti)
|
||||
{
|
||||
*error = touchid;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* FIXME: Allow for early accept */
|
||||
if (ti->num_listeners == 0 || CLIENT_ID(ti->listeners[0].listener) != client->index)
|
||||
return BadAccess;
|
||||
|
||||
nev = GetTouchOwnershipEvents(events, dev, ti, mode, ti->listeners[0].listener, 0);
|
||||
if (nev == 0)
|
||||
return BadAlloc;
|
||||
for (i = 0; i < nev; i++)
|
||||
mieqProcessDeviceEvent(dev, events + i, NULL);
|
||||
|
||||
ProcessInputEvents();
|
||||
|
||||
FreeEventList(events, GetMaximumEventsNum());
|
||||
return Success;
|
||||
}
|
||||
|
||||
int
|
||||
ProcXIAllowEvents(ClientPtr client)
|
||||
{
|
||||
|
@ -61,7 +106,7 @@ ProcXIAllowEvents(ClientPtr client)
|
|||
int ret = Success;
|
||||
|
||||
REQUEST(xXIAllowEventsReq);
|
||||
REQUEST_SIZE_MATCH(xXIAllowEventsReq);
|
||||
/* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */
|
||||
|
||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
|
||||
if (ret != Success)
|
||||
|
@ -91,6 +136,12 @@ ProcXIAllowEvents(ClientPtr client)
|
|||
if (IsMaster(dev))
|
||||
AllowSome(client, time, dev, THAWED_BOTH);
|
||||
break;
|
||||
case XIRejectTouch:
|
||||
case XIAcceptTouch:
|
||||
ret = AllowTouch(client, dev,
|
||||
stuff->mode, stuff->touchid,
|
||||
&client->errorValue);
|
||||
break;
|
||||
default:
|
||||
client->errorValue = stuff->mode;
|
||||
ret = BadValue;
|
||||
|
|
Loading…
Reference in New Issue