xfree86: swap the list of paused devices to an xorg_list

No functional changes but it makes it easier to remove elements from the
middle of the list (future patch).

We don't have an init call into this file, so the list is manually
initialized.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2016-10-20 15:45:46 +10:00
parent 28d8855cd4
commit 8fcf2fa78f
1 changed files with 20 additions and 11 deletions

View File

@ -110,8 +110,16 @@
static int
xf86InputDevicePostInit(DeviceIntPtr dev);
static InputInfoPtr *new_input_devices;
static int new_input_devices_count;
typedef struct {
struct xorg_list node;
InputInfoPtr pInfo;
} PausedInputDeviceRec;
typedef PausedInputDeviceRec *PausedInputDevicePtr;
static struct xorg_list new_input_devices_list = {
.next = &new_input_devices_list,
.prev = &new_input_devices_list,
};
/**
* Eval config and modify DeviceVelocityRec accordingly
@ -907,11 +915,10 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
if (fd != -1) {
if (paused) {
/* Put on new_input_devices list for delayed probe */
new_input_devices = xnfreallocarray(new_input_devices,
new_input_devices_count + 1,
sizeof(pInfo));
new_input_devices[new_input_devices_count] = pInfo;
new_input_devices_count++;
PausedInputDevicePtr new_device = xnfalloc(sizeof *new_device);
new_device->pInfo = pInfo;
xorg_list_append(&new_device->node, &new_input_devices_list);
systemd_logind_release_fd(pInfo->major, pInfo->minor, fd);
free(path);
return BadMatch;
@ -1540,11 +1547,12 @@ xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type,
void
xf86InputEnableVTProbe(void)
{
int i, is_auto = 0;
int is_auto = 0;
DeviceIntPtr pdev;
PausedInputDevicePtr d, tmp;
for (i = 0; i < new_input_devices_count; i++) {
InputInfoPtr pInfo = new_input_devices[i];
xorg_list_for_each_entry_safe(d, tmp, &new_input_devices_list, node) {
InputInfoPtr pInfo = d->pInfo;
const char *value = xf86findOptionValue(pInfo->options, "_source");
is_auto = 0;
@ -1557,8 +1565,9 @@ xf86InputEnableVTProbe(void)
xf86NewInputDevice(pInfo, &pdev,
(!is_auto ||
(is_auto && xf86Info.autoEnableDevices)));
xorg_list_del(&d->node);
free(d);
}
new_input_devices_count = 0;
}
/* end of xf86Xinput.c */