dix: fix endianess issue in AddInputDevice. #18111
dev->enabled is a Bool. Bool is two bytes. BOOL on the other hand is a protocol type and always 1 byte. So copy the value into the one-byte type before passing it into XIChangeDeviceProperty. Found by Michel Dänzer. X.Org Bug 18111 <http://bugs.freedesktop.org/show_bug.cgi?id=18111>
This commit is contained in:
		
							parent
							
								
									f6cbe0326c
								
							
						
					
					
						commit
						98f01c2abe
					
				| 
						 | 
					@ -139,6 +139,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
 | 
				
			||||||
    DeviceIntPtr devtmp;
 | 
					    DeviceIntPtr devtmp;
 | 
				
			||||||
    int devid;
 | 
					    int devid;
 | 
				
			||||||
    char devind[MAX_DEVICES];
 | 
					    char devind[MAX_DEVICES];
 | 
				
			||||||
 | 
					    BOOL enabled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Find next available id */
 | 
					    /* Find next available id */
 | 
				
			||||||
    memset(devind, 0, sizeof(char)*MAX_DEVICES);
 | 
					    memset(devind, 0, sizeof(char)*MAX_DEVICES);
 | 
				
			||||||
| 
						 | 
					@ -183,8 +184,9 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
 | 
				
			||||||
    *prev = dev;
 | 
					    *prev = dev;
 | 
				
			||||||
    dev->next = NULL;
 | 
					    dev->next = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    enabled = TRUE;
 | 
				
			||||||
    XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
 | 
					    XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
 | 
				
			||||||
                           XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
 | 
					                           XA_INTEGER, 8, PropModeReplace, 1, &enabled,
 | 
				
			||||||
                           FALSE);
 | 
					                           FALSE);
 | 
				
			||||||
    XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
 | 
					    XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
 | 
				
			||||||
    XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL, NULL);
 | 
					    XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL, NULL);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue