From 5a482e9af46376ae9b7edce0629a3123fa0692c1 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Thu, 7 Jul 2016 14:34:47 -0400 Subject: [PATCH] ecore-drm2: Perform input device calibration based on output name When a new input device gets added, device calibration may need to be performed. In order for that to be done properly, we need to know which output this input device is associated with. This patch makes a function call to Elput in order to retrieve that output name and perform the proper calibration. @fix Signed-off-by: Chris Michael --- src/lib/ecore_drm2/ecore_drm2_device.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c index 831c538..8794063 100644 --- a/src/lib/ecore_drm2/ecore_drm2_device.c +++ b/src/lib/ecore_drm2/ecore_drm2_device.c @@ -41,12 +41,33 @@ _cb_device_change(void *data, int type EINA_UNUSED, void *event) if (ev->type == ELPUT_DEVICE_ADDED) { + Eina_List *l; Ecore_Drm2_Output *output; + Eina_Stringshare *name; - /* FIXME: not sure which output to use to calibrate */ - output = eina_list_data_get(device->outputs); - if (output) - ecore_drm2_device_calibrate(device, output->w, output->h); + name = elput_input_device_output_name_get(ev->device); + if (!name) + { + output = eina_list_data_get(device->outputs); + if (output) + ecore_drm2_device_calibrate(device, + output->w, output->h); + } + else + { + EINA_LIST_FOREACH(device->outputs, l, output) + { + if ((output->name) && + (!strcmp(output->name, name))) + { + ecore_drm2_device_calibrate(device, + output->w, output->h); + break; + } + } + + eina_stringshare_del(name); + } } return ECORE_CALLBACK_RENEW; -- 2.7.4