Commit 8fcf2fa7 authored by Peter Hutterer's avatar Peter Hutterer

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's avatarPeter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 28d8855c
......@@ -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 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment