summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-10-20 15:45:46 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-10-26 15:35:07 +1000
commit8fcf2fa78f09257933b17e7dc9a03a2034e3076f (patch)
treeb52e56e8c2389b0b9fa386fb2015550e3db03e03
parent28d8855cd4e3be8831fb1c17bf1d205bd8465d1e (diff)
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>
-rw-r--r--hw/xfree86/common/xf86Xinput.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index e31aab31e..009527285 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -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 */