Merge branch 'pointer-emulation-fixes-56558-v2' into for-keith
This commit is contained in:
		
						commit
						fa6ab7d9b2
					
				|  | @ -1187,7 +1187,6 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, | |||
|               TouchOwnershipEvent *ev) | ||||
| { | ||||
|     Bool was_owner = (resource == ti->listeners[0].listener); | ||||
|     void *grab; | ||||
|     int i; | ||||
| 
 | ||||
|     /* Send a TouchEnd event to the resource being removed, but only if they
 | ||||
|  | @ -1202,11 +1201,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, | |||
| 
 | ||||
|     /* Remove the resource from the listener list, updating
 | ||||
|      * ti->num_listeners, as well as ti->num_grabs if it was a grab. */ | ||||
|     if (TouchRemoveListener(ti, resource)) { | ||||
|         if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB, | ||||
|                                     serverClient, DixGetAttrAccess) == Success) | ||||
|             ti->num_grabs--; | ||||
|     } | ||||
|     TouchRemoveListener(ti, resource); | ||||
| 
 | ||||
|     /* If the current owner was removed and there are further listeners, deliver
 | ||||
|      * the TouchOwnership or TouchBegin event to the new owner. */ | ||||
|  | @ -1300,33 +1295,18 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, | |||
| 
 | ||||
|     if (listener->type == LISTENER_GRAB || | ||||
|         listener->type == LISTENER_POINTER_GRAB) { | ||||
|         rc = dixLookupResourceByType((pointer *) grab, listener->listener, | ||||
|                                      RT_PASSIVEGRAB, | ||||
|                                      serverClient, DixSendAccess); | ||||
|         if (rc != Success) { | ||||
|             /* the grab doesn't exist but we have a grabbing listener - this
 | ||||
|              * is an implicit/active grab */ | ||||
|             rc = dixLookupClient(client, listener->listener, serverClient, | ||||
|                                  DixSendAccess); | ||||
|             if (rc != Success) | ||||
|                 return FALSE; | ||||
| 
 | ||||
|             *grab = dev->deviceGrab.grab; | ||||
|             if (!*grab) | ||||
|                 return FALSE; | ||||
|         } | ||||
|         *grab = listener->grab; | ||||
| 
 | ||||
|         BUG_RETURN_VAL(!*grab, FALSE); | ||||
| 
 | ||||
|         *client = rClient(*grab); | ||||
|         *win = (*grab)->window; | ||||
|         *mask = (*grab)->xi2mask; | ||||
|     } | ||||
|     else { | ||||
|         if (listener->level == CORE) | ||||
|             rc = dixLookupWindow(win, listener->listener, | ||||
|                                  serverClient, DixSendAccess); | ||||
|         else | ||||
|         rc = dixLookupResourceByType((pointer *) win, listener->listener, | ||||
|                                          RT_INPUTCLIENT, | ||||
|                                      listener->resource_type, | ||||
|                                      serverClient, DixSendAccess); | ||||
|         if (rc != Success) | ||||
|             return FALSE; | ||||
|  | @ -1467,6 +1447,8 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, | |||
|              */ | ||||
|             l = &ti->listeners[ti->num_listeners - 1]; | ||||
|             l->listener = devgrab->resource; | ||||
|             l->grab = devgrab; | ||||
|             //l->resource_type = RT_NONE;
 | ||||
| 
 | ||||
|             if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin) | ||||
|                 l->type = LISTENER_POINTER_GRAB; | ||||
|  |  | |||
							
								
								
									
										12
									
								
								dix/events.c
								
								
								
								
							
							
						
						
									
										12
									
								
								dix/events.c
								
								
								
								
							|  | @ -1438,6 +1438,7 @@ UpdateTouchesForGrab(DeviceIntPtr mouse) | |||
|                 ti->listeners[0].type = LISTENER_POINTER_GRAB; | ||||
|             else | ||||
|                 ti->listeners[0].type = LISTENER_GRAB; | ||||
|             ti->listeners[0].grab = grab; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1521,7 +1522,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) | |||
|                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)) | ||||
|                     !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) | ||||
|                 ti->listeners[0].state = LISTENER_HAS_END; | ||||
|             TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); | ||||
|         } | ||||
|  | @ -1550,15 +1551,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse) | |||
|         ReattachToOldMaster(mouse); | ||||
| 
 | ||||
|     ComputeFreezes(); | ||||
| 
 | ||||
|     /* If an explicit grab was deactivated, we must remove it from the head of
 | ||||
|      * all the touches' listener lists. */ | ||||
|     for (i = 0; mouse->touch && i < mouse->touch->num_touches; i++) { | ||||
|         TouchPointInfoPtr ti = mouse->touch->touches + i; | ||||
| 
 | ||||
|         if (ti->active && TouchResourceIsOwner(ti, grab_resource)) | ||||
|             TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  |  | |||
							
								
								
									
										38
									
								
								dix/touch.c
								
								
								
								
							
							
						
						
									
										38
									
								
								dix/touch.c
								
								
								
								
							|  | @ -675,15 +675,20 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource) | |||
|  * Add the resource to this touch's listeners. | ||||
|  */ | ||||
| void | ||||
| TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level, | ||||
|                  enum TouchListenerType type, enum TouchListenerState state, | ||||
|                  WindowPtr window) | ||||
| TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type, | ||||
|                  enum InputLevel level, enum TouchListenerType type, | ||||
|                  enum TouchListenerState state, WindowPtr window, | ||||
|                  GrabPtr grab) | ||||
| { | ||||
|     ti->listeners[ti->num_listeners].listener = resource; | ||||
|     ti->listeners[ti->num_listeners].resource_type = resource_type; | ||||
|     ti->listeners[ti->num_listeners].level = level; | ||||
|     ti->listeners[ti->num_listeners].state = state; | ||||
|     ti->listeners[ti->num_listeners].type = type; | ||||
|     ti->listeners[ti->num_listeners].window = window; | ||||
|     ti->listeners[ti->num_listeners].grab = grab; | ||||
|     if (grab) | ||||
|         ti->num_grabs++; | ||||
|     ti->num_listeners++; | ||||
| } | ||||
| 
 | ||||
|  | @ -702,6 +707,11 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource) | |||
|         if (ti->listeners[i].listener == resource) { | ||||
|             int j; | ||||
| 
 | ||||
|             if (ti->listeners[i].grab) { | ||||
|                 ti->listeners[i].grab = NULL; | ||||
|                 ti->num_grabs--; | ||||
|             } | ||||
| 
 | ||||
|             for (j = i; j < ti->num_listeners - 1; j++) | ||||
|                 ti->listeners[j] = ti->listeners[j + 1]; | ||||
|             ti->num_listeners--; | ||||
|  | @ -732,9 +742,9 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti, | |||
|         type = LISTENER_POINTER_GRAB; | ||||
|     } | ||||
| 
 | ||||
|     TouchAddListener(ti, grab->resource, grab->grabtype, | ||||
|                      type, LISTENER_AWAITING_BEGIN, grab->window); | ||||
|     ti->num_grabs++; | ||||
|     /* grab listeners are always RT_NONE since we keep the grab pointer */ | ||||
|     TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype, | ||||
|                      type, LISTENER_AWAITING_BEGIN, grab->window, grab); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  | @ -789,8 +799,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, | |||
|             if (!xi2mask_isset(iclients->xi2mask, dev, XI_TouchOwnership)) | ||||
|                 TouchEventHistoryAllocate(ti); | ||||
| 
 | ||||
|             TouchAddListener(ti, iclients->resource, XI2, | ||||
|                              type, LISTENER_AWAITING_BEGIN, win); | ||||
|             TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI2, | ||||
|                              type, LISTENER_AWAITING_BEGIN, win, NULL); | ||||
|             return TRUE; | ||||
|         } | ||||
|     } | ||||
|  | @ -804,9 +814,9 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, | |||
|                 continue; | ||||
| 
 | ||||
|             TouchEventHistoryAllocate(ti); | ||||
|             TouchAddListener(ti, iclients->resource, XI, | ||||
|             TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI, | ||||
|                              LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, | ||||
|                              win); | ||||
|                              win, NULL); | ||||
|             return TRUE; | ||||
|         } | ||||
|     } | ||||
|  | @ -819,9 +829,9 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, | |||
|         /* window owner */ | ||||
|         if (IsMaster(dev) && (win->eventMask & core_filter)) { | ||||
|             TouchEventHistoryAllocate(ti); | ||||
|             TouchAddListener(ti, win->drawable.id, CORE, | ||||
|             TouchAddListener(ti, win->drawable.id, RT_WINDOW, CORE, | ||||
|                              LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, | ||||
|                              win); | ||||
|                              win, NULL); | ||||
|             return TRUE; | ||||
|         } | ||||
| 
 | ||||
|  | @ -831,8 +841,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, | |||
|                 continue; | ||||
| 
 | ||||
|             TouchEventHistoryAllocate(ti); | ||||
|             TouchAddListener(ti, oclients->resource, CORE, | ||||
|                              type, LISTENER_AWAITING_BEGIN, win); | ||||
|             TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE, | ||||
|                              type, LISTENER_AWAITING_BEGIN, win, NULL); | ||||
|             return TRUE; | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -565,9 +565,9 @@ extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev); | |||
| extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, | ||||
|                                     XID resource); | ||||
| extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource); | ||||
| extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, | ||||
| extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type, | ||||
|                              enum InputLevel level, enum TouchListenerType type, | ||||
|                              enum TouchListenerState state, WindowPtr window); | ||||
|                              enum TouchListenerState state, WindowPtr window, GrabPtr grab); | ||||
| extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource); | ||||
| extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, | ||||
|                                 InternalEvent *ev); | ||||
|  |  | |||
|  | @ -298,6 +298,17 @@ typedef struct _ValuatorClassRec { | |||
|     int v_scroll_axis;          /* vert smooth-scrolling axis */ | ||||
| } ValuatorClassRec; | ||||
| 
 | ||||
| typedef struct _TouchListener { | ||||
|     XID listener;           /* grabs/event selection IDs receiving
 | ||||
|                              * events for this touch */ | ||||
|     int resource_type;      /* listener's resource type */ | ||||
|     enum TouchListenerType type; | ||||
|     enum TouchListenerState state; | ||||
|     enum InputLevel level;  /* matters only for emulating touches */ | ||||
|     WindowPtr window; | ||||
|     GrabPtr grab; | ||||
| } TouchListener; | ||||
| 
 | ||||
| typedef struct _TouchPointInfo { | ||||
|     uint32_t client_id;         /* touch ID as seen in client events */ | ||||
|     int sourceid;               /* Source device's ID for this touchpoint */ | ||||
|  | @ -306,14 +317,7 @@ typedef struct _TouchPointInfo { | |||
|                                  * but still owned by a grab */ | ||||
|     SpriteRec sprite;           /* window trace for delivery */ | ||||
|     ValuatorMask *valuators;    /* last recorded axis values */ | ||||
|     struct _TouchListener { | ||||
|         XID listener;           /* grabs/event selection IDs receiving
 | ||||
|                                  * events for this touch */ | ||||
|         enum TouchListenerType type; | ||||
|         enum TouchListenerState state; | ||||
|         enum InputLevel level;  /* matters only for emulating touches */ | ||||
|         WindowPtr window; | ||||
|     } *listeners; | ||||
|     TouchListener *listeners;   /* set of listeners */ | ||||
|     int num_listeners; | ||||
|     int num_grabs;              /* number of open grabs on this touch
 | ||||
|                                  * which have not accepted or rejected */ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue