Xi: fix XISetClientPointer return values.
If SetClientPointer fails, the only reason may be that the device is not a pointer or that the device is an SD. Return BadDevice instead of BadAccess. (BadAccess is a leftover from the early times of the ClientPointer implementation when only one client was allowed to set it). If the window parameter doesn't name a valid window or client, return BadWindow. Finally, allow both master keyboards and master pointers as deviceid. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
		
							parent
							
								
									ae7dab2a13
								
							
						
					
					
						commit
						e6a18762ef
					
				
							
								
								
									
										13
									
								
								Xi/setcptr.c
								
								
								
								
							
							
						
						
									
										13
									
								
								Xi/setcptr.c
								
								
								
								
							| 
						 | 
					@ -79,29 +79,34 @@ ProcXISetClientPointer(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
 | 
					    rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
 | 
				
			||||||
    if (rc != Success)
 | 
					    if (rc != Success)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        client->errorValue = stuff->deviceid;
 | 
				
			||||||
        return rc;
 | 
					        return rc;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!IsPointerDevice(pDev) || !IsMaster(pDev))
 | 
					    if (!IsMaster(pDev))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        client->errorValue = stuff->deviceid;
 | 
					        client->errorValue = stuff->deviceid;
 | 
				
			||||||
        return BadDevice;
 | 
					        return BadDevice;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pDev = GetMaster(pDev, MASTER_POINTER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->win != None)
 | 
					    if (stuff->win != None)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        rc = dixLookupClient(&targetClient, stuff->win, client,
 | 
					        rc = dixLookupClient(&targetClient, stuff->win, client,
 | 
				
			||||||
                DixWriteAccess);
 | 
					                DixWriteAccess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (rc != Success)
 | 
					        if (rc != Success)
 | 
				
			||||||
            return rc;
 | 
					            return BadWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
        targetClient = client;
 | 
					        targetClient = client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!SetClientPointer(targetClient, client, pDev))
 | 
					    if (!SetClientPointer(targetClient, client, pDev))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        client->errorValue = stuff->win;
 | 
					        client->errorValue = stuff->deviceid;
 | 
				
			||||||
        return BadAccess;
 | 
					        return BadDevice;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue