From e8060b3cd6815454daa74b43714f8bb237e8c985 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Thu, 24 Nov 2011 21:08:22 +0000 Subject: [PATCH] ecore/fb: Bring back the old signature of ecore_fb_input_device_open. A previous patch had changed its signature, but since this is an EAPI, we can't break it. Now ecore_fb_input_device_window_set() was added to provide the same functionality. SVN revision: 65589 --- legacy/ecore/ChangeLog | 3 ++ .../ecore/src/lib/ecore_evas/ecore_evas_fb.c | 3 +- legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h | 3 +- legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c | 39 ++++++++++++++++++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index 36790b5f98..0440b773d6 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -343,3 +343,6 @@ * Fix setting override state to only hide if it should be visible at that point in x back end support +2011-11-24 Rafael Antognolli + + * Add ecore_fb_input_device_window_set(). diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c index 77d9153ae0..3ee913e814 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c @@ -208,8 +208,9 @@ _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) continue; snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name); - if (!(device = ecore_fb_input_device_open(ee, device_path))) + if (!(device = ecore_fb_input_device_open(device_path))) continue; + ecore_fb_input_device_window_set(device, ee); caps = ecore_fb_input_device_cap_get(device); diff --git a/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h b/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h index 37b9e1e6cd..069cccdff9 100644 --- a/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h +++ b/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h @@ -70,7 +70,7 @@ EAPI void ecore_fb_callback_gain_set(void (*func) (void *da EAPI void ecore_fb_callback_lose_set(void (*func) (void *data), void *data); /* ecore_fb_li.c */ -EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(void *window, const char *dev); +EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(const char *dev); EAPI void ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev); EAPI void ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen); EAPI const char *ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev); @@ -78,6 +78,7 @@ EAPI Ecore_Fb_Input_Device_Cap ecore_fb_input_device_cap_get(Ecore_Fb_Input_Devi EAPI void ecore_fb_input_device_axis_size_set(Ecore_Fb_Input_Device *dev, int w, int h); EAPI void ecore_fb_input_threshold_click_set(Ecore_Fb_Input_Device *dev, double threshold); EAPI double ecore_fb_input_threshold_click_get(Ecore_Fb_Input_Device *dev); +EAPI void ecore_fb_input_device_window_set(Ecore_Fb_Input_Device *dev, void *window); /* ecore_fb.c */ diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c index 0b0900c61e..4a196dd394 100644 --- a/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c +++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c @@ -451,6 +451,42 @@ ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen) # define EV_CNT (EV_MAX+1) #endif +/** + * @brief Associates an input device with the given @ref Ecore_Evas. + * + * @param dev The input being associated with an @ref Ecore_Evas (not @c NULL). + * @param window The window which this input is being associated to. + * @c NULL will remove any previous association. + * + * Events generated by this device will have a pointer to @p window. If this @p + * window is registered with ecore_event_window_register() or + * ecore_evas_input_event_register(), respective evas events will be delivered + * by the ecore_input_evas system. An example can be seen in the following code: + * + * @code + * Ecore_Evas *ee = ecore_evas_new(NULL, 0, 0, 800, 600, NULL); + * + * ecore_evas_input_event_register(ee); + * + * device = ecore_fb_input_device_open(device_path); + * if (device) + * ecore_fb_input_device_window_set(device, ee); + * + * @endcode + * + * On the previous code, all input captured on the mentioned device will be + * delivered to the @Ecore_Evas @c ee. + * + * @since 1.1 + */ +EAPI void +ecore_fb_input_device_window_set(Ecore_Fb_Input_Device *dev, void *window) +{ + if (!dev) return; + + dev->window = window; +} + /** * @brief Open an input device. * @@ -461,7 +497,7 @@ ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen) * object for it, or returns @c NULL on failure. */ EAPI Ecore_Fb_Input_Device * -ecore_fb_input_device_open(void *ee, const char *dev) +ecore_fb_input_device_open(const char *dev) { Ecore_Fb_Input_Device *device; unsigned long event_type_bitmask[EV_CNT / 32 + 1]; @@ -525,7 +561,6 @@ ecore_fb_input_device_open(void *ee, const char *dev) } } - device->window = ee; _ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device); return device;