Merge branch 'stack-smash-on-touchpoint' into for-keith
This commit is contained in:
		
						commit
						bb6f3514ca
					
				| 
						 | 
					@ -1409,7 +1409,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
 | 
				
			||||||
    ptrev->device_event.corestate = event_get_corestate(dev, kbd);
 | 
					    ptrev->device_event.corestate = event_get_corestate(dev, kbd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (grab) {
 | 
					    if (grab) {
 | 
				
			||||||
        /* this side-steps the usual activation mechansims, but... */
 | 
					        /* this side-steps the usual activation mechanisms, but... */
 | 
				
			||||||
        if (ev->any.type == ET_TouchBegin && !dev->deviceGrab.grab)
 | 
					        if (ev->any.type == ET_TouchBegin && !dev->deviceGrab.grab)
 | 
				
			||||||
            ActivatePassiveGrab(dev, grab, ptrev, ev);  /* also delivers the event */
 | 
					            ActivatePassiveGrab(dev, grab, ptrev, ev);  /* also delivers the event */
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
| 
						 | 
					@ -1566,6 +1566,19 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        ti = TouchFindByClientID(dev, touchid);
 | 
					        ti = TouchFindByClientID(dev, touchid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* Active pointer grab */
 | 
				
			||||||
 | 
					    if (emulate_pointer && dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab &&
 | 
				
			||||||
 | 
					        (dev->deviceGrab.grab->grabtype == CORE ||
 | 
				
			||||||
 | 
					         dev->deviceGrab.grab->grabtype == XI ||
 | 
				
			||||||
 | 
					         !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin)))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /* Active pointer grab on touch point and we get a TouchEnd - claim this
 | 
				
			||||||
 | 
					         * touchpoint accepted, otherwise clients waiting for ownership will
 | 
				
			||||||
 | 
					         * wait on this touchpoint until this client ungrabs, or the cows come
 | 
				
			||||||
 | 
					         * home, whichever is earlier */
 | 
				
			||||||
 | 
					        if (ti && type == ET_TouchEnd)
 | 
				
			||||||
 | 
					            TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch);
 | 
				
			||||||
 | 
					        else if (!ti && type != ET_TouchBegin) {
 | 
				
			||||||
            /* Under the following circumstances we create a new touch record for an
 | 
					            /* Under the following circumstances we create a new touch record for an
 | 
				
			||||||
             * existing touch:
 | 
					             * existing touch:
 | 
				
			||||||
             *
 | 
					             *
 | 
				
			||||||
| 
						 | 
					@ -1576,11 +1589,6 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
 | 
				
			||||||
             * This allows for an explicit grab to receive pointer events for an already
 | 
					             * This allows for an explicit grab to receive pointer events for an already
 | 
				
			||||||
             * active touch.
 | 
					             * active touch.
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
    if (!ti && type != ET_TouchBegin && emulate_pointer &&
 | 
					 | 
				
			||||||
        dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab &&
 | 
					 | 
				
			||||||
        (dev->deviceGrab.grab->grabtype == CORE ||
 | 
					 | 
				
			||||||
         dev->deviceGrab.grab->grabtype == XI ||
 | 
					 | 
				
			||||||
         !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin))) {
 | 
					 | 
				
			||||||
            ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
 | 
					            ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
 | 
				
			||||||
                                 emulate_pointer);
 | 
					                                 emulate_pointer);
 | 
				
			||||||
            if (!ti) {
 | 
					            if (!ti) {
 | 
				
			||||||
| 
						 | 
					@ -1593,6 +1601,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
 | 
				
			||||||
            TouchBuildSprite(dev, ti, ev);
 | 
					            TouchBuildSprite(dev, ti, ev);
 | 
				
			||||||
            TouchSetupListeners(dev, ti, ev);
 | 
					            TouchSetupListeners(dev, ti, ev);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!ti) {
 | 
					    if (!ti) {
 | 
				
			||||||
        DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
 | 
					        DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								dix/events.c
								
								
								
								
							
							
						
						
									
										16
									
								
								dix/events.c
								
								
								
								
							| 
						 | 
					@ -1503,11 +1503,27 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    GrabPtr grab = mouse->deviceGrab.grab;
 | 
					    GrabPtr grab = mouse->deviceGrab.grab;
 | 
				
			||||||
    DeviceIntPtr dev;
 | 
					    DeviceIntPtr dev;
 | 
				
			||||||
 | 
					    Bool wasPassive = mouse->deviceGrab.fromPassiveGrab;
 | 
				
			||||||
    Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
 | 
					    Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
 | 
				
			||||||
                        mouse->deviceGrab.implicitGrab);
 | 
					                        mouse->deviceGrab.implicitGrab);
 | 
				
			||||||
    XID grab_resource = grab->resource;
 | 
					    XID grab_resource = grab->resource;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* If an explicit grab was deactivated, we must remove it from the head of
 | 
				
			||||||
 | 
					     * all the touches' listener lists. */
 | 
				
			||||||
 | 
					    for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) {
 | 
				
			||||||
 | 
					        TouchPointInfoPtr ti = mouse->touch->touches + i;
 | 
				
			||||||
 | 
					        if (ti->active && TouchResourceIsOwner(ti, grab_resource)) {
 | 
				
			||||||
 | 
					            /* Rejecting will generate a TouchEnd, but we must not
 | 
				
			||||||
 | 
					               emulate a ButtonRelease here. So pretend the listener
 | 
				
			||||||
 | 
					               already has the end event */
 | 
				
			||||||
 | 
					            if (grab->grabtype == CORE || grab->grabtype == XI ||
 | 
				
			||||||
 | 
					                    !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin))
 | 
				
			||||||
 | 
					                ti->listeners[0].state = LISTENER_HAS_END;
 | 
				
			||||||
 | 
					            TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TouchRemovePointerGrab(mouse);
 | 
					    TouchRemovePointerGrab(mouse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mouse->valuator->motionHintWindow = NullWindow;
 | 
					    mouse->valuator->motionHintWindow = NullWindow;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -915,6 +915,8 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
 | 
				
			||||||
    ti = TouchFindByClientID(dev, ev->touchid);
 | 
					    ti = TouchFindByClientID(dev, ev->touchid);
 | 
				
			||||||
    if (!ti)
 | 
					    if (!ti)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* FIXME: missing a bit of code here... */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* As touch grabs don't turn into active grabs with their own resources, we
 | 
					/* As touch grabs don't turn into active grabs with their own resources, we
 | 
				
			||||||
| 
						 | 
					@ -987,8 +989,6 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
 | 
				
			||||||
    for (i = 0; i < nev; i++)
 | 
					    for (i = 0; i < nev; i++)
 | 
				
			||||||
        mieqProcessDeviceEvent(dev, events + i, NULL);
 | 
					        mieqProcessDeviceEvent(dev, events + i, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ProcessInputEvents();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    FreeEventList(events, GetMaximumEventsNum());
 | 
					    FreeEventList(events, GetMaximumEventsNum());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return nev ? Success : BadMatch;
 | 
					    return nev ? Success : BadMatch;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue