forked from enlightenment/enlightenment
move gesture recognition to e itself
This commit is contained in:
parent
59ae22f8ec
commit
424a6a1930
|
@ -298,6 +298,7 @@ dep_eo = dependency('eo' , required: true)
|
||||||
dep_eldbus = dependency('eldbus' , required: true)
|
dep_eldbus = dependency('eldbus' , required: true)
|
||||||
dep_emotion = dependency('emotion' , required: true)
|
dep_emotion = dependency('emotion' , required: true)
|
||||||
dep_elementary = dependency('elementary' , required: true)
|
dep_elementary = dependency('elementary' , required: true)
|
||||||
|
dep_elput = dependency('elput' , required: true)
|
||||||
|
|
||||||
dep_wayland = []
|
dep_wayland = []
|
||||||
if get_option('wl') == true
|
if get_option('wl') == true
|
||||||
|
|
|
@ -21,10 +21,6 @@ static Eina_List *acpi_bindings = NULL;
|
||||||
static Eina_List *swipe_bindings = NULL;
|
static Eina_List *swipe_bindings = NULL;
|
||||||
|
|
||||||
static unsigned int bindings_disabled = 0;
|
static unsigned int bindings_disabled = 0;
|
||||||
static int gesture_capable_devices = 0;
|
|
||||||
|
|
||||||
static E_Bindings_Swipe_Live_Update live_update;
|
|
||||||
static E_Bindings_Swipe_Live_Update live_update_data;
|
|
||||||
|
|
||||||
EINTERN E_Action *(*e_binding_key_list_cb)(E_Binding_Context, Ecore_Event_Key*, E_Binding_Modifier, E_Binding_Key **);
|
EINTERN E_Action *(*e_binding_key_list_cb)(E_Binding_Context, Ecore_Event_Key*, E_Binding_Modifier, E_Binding_Key **);
|
||||||
|
|
||||||
|
@ -1614,19 +1610,6 @@ _e_bindings_edge_cb_timer(void *data)
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
E_API void
|
|
||||||
e_bindings_gesture_capable_devices_set(int number)
|
|
||||||
{
|
|
||||||
gesture_capable_devices = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
E_API int
|
|
||||||
e_bindings_gesture_capable_devices_get(void)
|
|
||||||
{
|
|
||||||
return gesture_capable_devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
E_API void
|
E_API void
|
||||||
e_bindings_swipe_add(E_Binding_Context ctxt, double direction, double length, unsigned int fingers, double error, const char *action, const char *params)
|
e_bindings_swipe_add(E_Binding_Context ctxt, double direction, double length, unsigned int fingers, double error, const char *action, const char *params)
|
||||||
{
|
{
|
||||||
|
@ -1727,22 +1710,3 @@ e_bindings_swipe_find_candidates(E_Binding_Context ctxt, double direction, doubl
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
E_API void
|
|
||||||
e_bindings_swipe_live_update_hook_set(E_Bindings_Swipe_Live_Update update, void *data)
|
|
||||||
{
|
|
||||||
live_update = update;
|
|
||||||
live_update_data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
E_API E_Bindings_Swipe_Live_Update
|
|
||||||
e_bindings_swipe_live_update_hook_get(void)
|
|
||||||
{
|
|
||||||
return live_update;
|
|
||||||
}
|
|
||||||
|
|
||||||
E_API void*
|
|
||||||
e_bindings_swipe_live_update_hook_data_get(void)
|
|
||||||
{
|
|
||||||
return live_update_data;
|
|
||||||
}
|
|
||||||
|
|
|
@ -212,8 +212,6 @@ typedef struct {
|
||||||
double acceptance; //0 to 1
|
double acceptance; //0 to 1
|
||||||
} E_Binding_Swipe_Candidate;
|
} E_Binding_Swipe_Candidate;
|
||||||
|
|
||||||
typedef void (*E_Bindings_Swipe_Live_Update)(void *data, Eina_Bool end, double direction, double length, double error, unsigned int fingers);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direction is in radiens, 0 is pointing to the right. Going clockwise. (Only positive range)
|
* Direction is in radiens, 0 is pointing to the right. Going clockwise. (Only positive range)
|
||||||
*/
|
*/
|
||||||
|
@ -222,11 +220,6 @@ E_API void e_bindings_swipe_add(E_Binding_Context ctxt, double directio
|
||||||
E_API void e_bindings_swipe_del(E_Binding_Context ctxt, double direction, double length, unsigned int fingers, double error, const char *action, const char *params);
|
E_API void e_bindings_swipe_del(E_Binding_Context ctxt, double direction, double length, unsigned int fingers, double error, const char *action, const char *params);
|
||||||
E_API E_Action* e_bindings_swipe_handle(E_Binding_Context ctxt, E_Object *obj, double direction, double length, unsigned int fingers);
|
E_API E_Action* e_bindings_swipe_handle(E_Binding_Context ctxt, E_Object *obj, double direction, double length, unsigned int fingers);
|
||||||
E_API Eina_Inarray/*<E_Bindings_Swipe_Candidate>*/* e_bindings_swipe_find_candidates(E_Binding_Context ctxt, double direction, double lenght, unsigned int fingers);
|
E_API Eina_Inarray/*<E_Bindings_Swipe_Candidate>*/* e_bindings_swipe_find_candidates(E_Binding_Context ctxt, double direction, double lenght, unsigned int fingers);
|
||||||
E_API void e_bindings_swipe_live_update_hook_set(E_Bindings_Swipe_Live_Update update, void *data);
|
|
||||||
E_API E_Bindings_Swipe_Live_Update e_bindings_swipe_live_update_hook_get(void);
|
|
||||||
E_API void e_bindings_gesture_capable_devices_set(int number);
|
|
||||||
E_API int e_bindings_gesture_capable_devices_get(void);
|
|
||||||
E_API void* e_bindings_swipe_live_update_hook_data_get(void);
|
|
||||||
|
|
||||||
E_API int e_bindings_evas_modifiers_convert(Evas_Modifier *modifiers);
|
E_API int e_bindings_evas_modifiers_convert(Evas_Modifier *modifiers);
|
||||||
E_API int e_bindings_modifiers_to_ecore_convert(E_Binding_Modifier modifiers);
|
E_API int e_bindings_modifiers_to_ecore_convert(E_Binding_Modifier modifiers);
|
||||||
|
|
|
@ -5,12 +5,6 @@
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <Elput.h>
|
#include <Elput.h>
|
||||||
|
|
||||||
E_API E_Module_Api e_modapi =
|
|
||||||
{
|
|
||||||
E_MODULE_API_VERSION,
|
|
||||||
"Gesture Recognition"
|
|
||||||
};
|
|
||||||
|
|
||||||
static Eina_Hash *active_gestures;
|
static Eina_Hash *active_gestures;
|
||||||
static Elput_Manager *manager;
|
static Elput_Manager *manager;
|
||||||
|
|
||||||
|
@ -22,6 +16,10 @@ typedef struct {
|
||||||
} visuals;
|
} visuals;
|
||||||
} Swipe_Stats;
|
} Swipe_Stats;
|
||||||
|
|
||||||
|
static int gesture_capable_devices = 0;
|
||||||
|
static E_Bindings_Swipe_Live_Update live_update;
|
||||||
|
static void* live_update_data;
|
||||||
|
|
||||||
static Swipe_Stats*
|
static Swipe_Stats*
|
||||||
_find_swipe_gesture_recognizition(Elput_Device *dev)
|
_find_swipe_gesture_recognizition(Elput_Device *dev)
|
||||||
{
|
{
|
||||||
|
@ -92,10 +90,9 @@ _stats_free(void *ptr)
|
||||||
static void
|
static void
|
||||||
_apply_visual_changes(Swipe_Stats *stats)
|
_apply_visual_changes(Swipe_Stats *stats)
|
||||||
{
|
{
|
||||||
E_Bindings_Swipe_Live_Update live_update = e_bindings_swipe_live_update_hook_get();
|
|
||||||
if (live_update)
|
if (live_update)
|
||||||
{
|
{
|
||||||
live_update(e_bindings_swipe_live_update_hook_data_get(), EINA_FALSE, _config_angle(stats->pos), eina_vector2_length_get(&stats->pos), 0.8, stats->fingers);
|
live_update(live_update_data, EINA_FALSE, _config_angle(stats->pos), eina_vector2_length_get(&stats->pos), 0.8, stats->fingers);
|
||||||
}
|
}
|
||||||
else if (stats->visuals.win)
|
else if (stats->visuals.win)
|
||||||
{
|
{
|
||||||
|
@ -151,11 +148,10 @@ _swipe_cb(void *data EINA_UNUSED, int type, void *event)
|
||||||
}
|
}
|
||||||
else if (type == ELPUT_EVENT_SWIPE_END)
|
else if (type == ELPUT_EVENT_SWIPE_END)
|
||||||
{
|
{
|
||||||
E_Bindings_Swipe_Live_Update live_update = e_bindings_swipe_live_update_hook_get();
|
|
||||||
Swipe_Stats *stats = _find_swipe_gesture_recognizition(dev);
|
Swipe_Stats *stats = _find_swipe_gesture_recognizition(dev);
|
||||||
|
|
||||||
if (live_update)
|
if (live_update)
|
||||||
live_update(e_bindings_swipe_live_update_hook_data_get(), EINA_TRUE, _config_angle(stats->pos), eina_vector2_length_get(&stats->pos), 0.8, stats->fingers);
|
live_update(live_update_data, EINA_TRUE, _config_angle(stats->pos), eina_vector2_length_get(&stats->pos), 0.8, stats->fingers);
|
||||||
else
|
else
|
||||||
e_bindings_swipe_handle(E_BINDING_CONTEXT_NONE, NULL, _config_angle(stats->pos), eina_vector2_length_get(&stats->pos), stats->fingers);
|
e_bindings_swipe_handle(E_BINDING_CONTEXT_NONE, NULL, _config_angle(stats->pos), eina_vector2_length_get(&stats->pos), stats->fingers);
|
||||||
|
|
||||||
|
@ -179,19 +175,25 @@ _debug(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
number_of_gesture_devices++;
|
number_of_gesture_devices++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e_bindings_gesture_capable_devices_set(number_of_gesture_devices);
|
gesture_capable_devices= number_of_gesture_devices;
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_init_for_x11(E_Module *m EINA_UNUSED)
|
_init_for_x11(void)
|
||||||
{
|
{
|
||||||
const char *device = NULL;
|
const char *device = NULL;
|
||||||
|
|
||||||
elput_init();
|
if (!elput_init())
|
||||||
|
{
|
||||||
|
ERR("Failed to init elput");
|
||||||
|
return;
|
||||||
|
}
|
||||||
device = getenv("XDG_SEAT");
|
device = getenv("XDG_SEAT");
|
||||||
if (!device) device = "seat0";
|
if (!device) device = "seat0";
|
||||||
manager = elput_manager_connect_gestures(device, 0);
|
manager = elput_manager_connect_gestures(device, 0);
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(manager);
|
||||||
elput_input_init(manager);
|
elput_input_init(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,11 +207,11 @@ _shutdown_for_x11(void)
|
||||||
|
|
||||||
|
|
||||||
E_API int
|
E_API int
|
||||||
e_modapi_init(E_Module *m EINA_UNUSED)
|
e_gesture_init(void)
|
||||||
{
|
{
|
||||||
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
||||||
{
|
{
|
||||||
_init_for_x11(m);
|
_init_for_x11();
|
||||||
}
|
}
|
||||||
|
|
||||||
active_gestures = eina_hash_pointer_new(_stats_free);
|
active_gestures = eina_hash_pointer_new(_stats_free);
|
||||||
|
@ -223,7 +225,7 @@ e_modapi_init(E_Module *m EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
E_API int
|
E_API int
|
||||||
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
e_gesture_shutdown(void)
|
||||||
{
|
{
|
||||||
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
||||||
{
|
{
|
||||||
|
@ -233,10 +235,15 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
E_API int
|
E_API void
|
||||||
e_modapi_save(E_Module *m EINA_UNUSED)
|
e_bindings_swipe_live_update_hook_set(E_Bindings_Swipe_Live_Update update, void *data)
|
||||||
{
|
{
|
||||||
|
live_update = update;
|
||||||
return 1;
|
live_update_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
E_API int
|
||||||
|
e_bindings_gesture_capable_devices_get(void)
|
||||||
|
{
|
||||||
|
return gesture_capable_devices;
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifdef E_TYPEDEFS
|
||||||
|
|
||||||
|
typedef void (*E_Bindings_Swipe_Live_Update)(void *data, Eina_Bool end, double direction, double length, double error, unsigned int fingers);
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifndef E_GESTURES_H
|
||||||
|
#define E_GESTURES_H
|
||||||
|
E_API int e_gesture_init(void);
|
||||||
|
E_API int e_gesture_shutdown(void);
|
||||||
|
E_API void e_bindings_swipe_live_update_hook_set(E_Bindings_Swipe_Live_Update update, void *data);
|
||||||
|
E_API int e_bindings_gesture_capable_devices_get(void);
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -154,6 +154,7 @@
|
||||||
#include "e_comp_x_devices.h"
|
#include "e_comp_x_devices.h"
|
||||||
#include "e_comp_x_randr.h"
|
#include "e_comp_x_randr.h"
|
||||||
#include "e_watchdog.h"
|
#include "e_watchdog.h"
|
||||||
|
#include "e_gesture.h"
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
# include "e_comp_wl.h"
|
# include "e_comp_wl.h"
|
||||||
|
|
|
@ -1054,6 +1054,11 @@ main(int argc, char **argv)
|
||||||
e_comp_canvas_keys_grab();
|
e_comp_canvas_keys_grab();
|
||||||
TS("E_Comp_Canvas Keys Grab Done");
|
TS("E_Comp_Canvas Keys Grab Done");
|
||||||
|
|
||||||
|
TS("E_Gesture Init");
|
||||||
|
e_gesture_init();
|
||||||
|
TS("E_Gesture Init Done");
|
||||||
|
_e_main_shutdown_push(e_gesture_shutdown);
|
||||||
|
|
||||||
TS("Run Startup Apps");
|
TS("Run Startup Apps");
|
||||||
if (!nostartup)
|
if (!nostartup)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ deps_e = [
|
||||||
dep_eldbus,
|
dep_eldbus,
|
||||||
dep_emotion,
|
dep_emotion,
|
||||||
dep_elementary,
|
dep_elementary,
|
||||||
|
dep_elput,
|
||||||
dep_intl
|
dep_intl
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -223,6 +224,7 @@ src = [
|
||||||
'e_xinerama.c',
|
'e_xinerama.c',
|
||||||
'e_zoomap.c',
|
'e_zoomap.c',
|
||||||
'e_zone.c',
|
'e_zone.c',
|
||||||
|
'e_gesture.c',
|
||||||
'efx/efx_bumpmapping.c',
|
'efx/efx_bumpmapping.c',
|
||||||
'efx/efx.c',
|
'efx/efx.c',
|
||||||
'efx/efx_fade.c',
|
'efx/efx_fade.c',
|
||||||
|
@ -401,7 +403,8 @@ hdr = [
|
||||||
'e_xkb.h',
|
'e_xkb.h',
|
||||||
'e_xsettings.h',
|
'e_xsettings.h',
|
||||||
'e_zoomap.h',
|
'e_zoomap.h',
|
||||||
'e_zone.h'
|
'e_zone.h',
|
||||||
|
'e_gesture.h'
|
||||||
]
|
]
|
||||||
|
|
||||||
if config_h.has('HAVE_WAYLAND') == true
|
if config_h.has('HAVE_WAYLAND') == true
|
||||||
|
|
Binary file not shown.
|
@ -1,4 +0,0 @@
|
||||||
src = files(
|
|
||||||
'e_mod_main.c',
|
|
||||||
)
|
|
||||||
deps += [dependency('elput')]
|
|
|
@ -1,10 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=Link
|
|
||||||
Name=Gesture Recognition
|
|
||||||
Name[fr]=Reconnaissance des gestes
|
|
||||||
Name[it]=Riconoscimento gesture
|
|
||||||
Comment=Gesture recognition using libinput.
|
|
||||||
Comment[fr]=Reconnaissance des gestes utilisant libinput.
|
|
||||||
Comment[it]=Riconoscimento delle gesture per mezzo di libinput.
|
|
||||||
Icon=e-module-gesture_recognition
|
|
||||||
X-Enlightenment-ModuleType=utils
|
|
|
@ -45,7 +45,6 @@ mods = [
|
||||||
'tiling',
|
'tiling',
|
||||||
'packagekit',
|
'packagekit',
|
||||||
'vkbd',
|
'vkbd',
|
||||||
'gesture_recognition',
|
|
||||||
'procstats',
|
'procstats',
|
||||||
# modules have a custom binary as well
|
# modules have a custom binary as well
|
||||||
'battery',
|
'battery',
|
||||||
|
|
Loading…
Reference in New Issue