This commit is contained in:
Enrico Weigelt, metux IT consult
2025-05-15 18:50:56 +02:00
parent 58ae25b722
commit dc3c1643f5
2 changed files with 19 additions and 19 deletions

View File

@@ -557,10 +557,10 @@ XICreateDeviceProperty(Atom property)
prop->next = NULL; prop->next = NULL;
prop->propertyName = property; prop->propertyName = property;
prop->value.type = None; prop->type = None;
prop->value.format = 0; prop->format = 0;
prop->value.size = 0; prop->size = 0;
prop->value.data = NULL; prop->data = NULL;
prop->deletable = TRUE; prop->deletable = TRUE;
return prop; return prop;
@@ -580,7 +580,7 @@ XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
static void static void
XIDestroyDeviceProperty(XIPropertyPtr prop) XIDestroyDeviceProperty(XIPropertyPtr prop)
{ {
free(prop->value.data); free(prop->data);
free(prop); free(prop);
} }
@@ -662,8 +662,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
XIPropertyPtr prop; XIPropertyPtr prop;
int size_in_bytes; int size_in_bytes;
unsigned long total_len; unsigned long total_len;
XIPropertyValuePtr prop_value; XIPropertyPtr prop_value;
XIPropertyValueRec new_value;
Bool add = FALSE; Bool add = FALSE;
int rc; int rc;
@@ -678,7 +677,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
add = TRUE; add = TRUE;
mode = PropModeReplace; mode = PropModeReplace;
} }
prop_value = &prop->value; prop_value = prop;
/* To append or prepend to a property the request format and type /* To append or prepend to a property the request format and type
must match those of the already defined property. The must match those of the already defined property. The
@@ -689,7 +688,8 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
return BadMatch; return BadMatch;
if ((prop_value->type != type) && (mode != PropModeReplace)) if ((prop_value->type != type) && (mode != PropModeReplace))
return BadMatch; return BadMatch;
new_value = *prop_value;
XIPropertyRec new_value = *prop_value;
if (mode == PropModeReplace) if (mode == PropModeReplace)
total_len = len; total_len = len;
else else
@@ -758,6 +758,11 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
} while (!checkonly); } while (!checkonly);
} }
free(prop_value->data); free(prop_value->data);
prop_value.type = new_value.type;
prop_value.format = new_value.format;
prop_value.data = new_value.data;
prop_value.size = new_value.size;
*prop_value = new_value; *prop_value = new_value;
} }
else if (len == 0) { else if (len == 0) {
@@ -805,7 +810,7 @@ XIGetDeviceProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
} }
} }
*value = &prop->value; *value = prop;
return Success; return Success;
} }

View File

@@ -457,17 +457,12 @@ typedef struct _XIPropertyValue {
short format; /* format of data for swapping - 8,16,32 */ short format; /* format of data for swapping - 8,16,32 */
long size; /* size of data in (format/8) bytes */ long size; /* size of data in (format/8) bytes */
void *data; /* private to client */ void *data; /* private to client */
} XIPropertyValueRec;
typedef struct _XIProperty { // not supposed to be touched by drivers
struct _XIProperty *next; struct _XIPropertyValue *next;
Atom propertyName; Atom propertyName;
BOOL deletable; /* clients can delete this prop? */ Bool deletable; /* clients can delete this prop? */
XIPropertyValueRec value; } XIPropertyRec, *XIPropertyPtr, *XIPropertyValuePtr;
} XIPropertyRec;
typedef XIPropertyRec *XIPropertyPtr;
typedef XIPropertyValueRec *XIPropertyValuePtr;
typedef struct _XIPropertyHandler { typedef struct _XIPropertyHandler {
struct _XIPropertyHandler *next; struct _XIPropertyHandler *next;