#define STEP_DURATION 0.01
-int device_number_shift;
static Eina_Bool during_gesture;
typedef struct _GestureCommand {
ev->multi.y = y;
ev->multi.root.x = x;
ev->multi.root.y = y;
- ev->multi.device = device + device_number_shift;
+ ev->multi.device = device + g_context->device_number_shift;
ev->window = e_comp->ee_win;
ev->event_window = e_comp->ee_win;
ev->root_window = e_comp->ee_win;
ev->multi.y = y;
ev->multi.root.x = x;
ev->multi.root.y = y;
- ev->multi.device = device + device_number_shift;
+ ev->multi.device = device + g_context->device_number_shift;
ev->window = e_comp->ee_win;
ev->event_window = e_comp->ee_win;
ev->root_window = e_comp->ee_win;
ev->multi.y = y;
ev->multi.root.x = x;
ev->multi.root.y = y;
- ev->multi.device = device + device_number_shift;
+ ev->multi.device = device + g_context->device_number_shift;
ev->window = e_comp->ee_win;
ev->event_window = e_comp->ee_win;
ev->root_window = e_comp->ee_win;
static Eldbus_Connection *conn;
static Ecore_Event_Handler *dbus_init_done_handler;
-Eldbus_Service_Interface *iface = NULL;
-Eina_Bool is_slider;
-int highlighted_object_x, highlighted_object_y;
-Eina_Bool is_selection_mode;
-int object_needs_scroll_from_x, object_needs_scroll_from_y;
EAPI E_Module_Api e_modapi =
{
E_MODULE_API_VERSION,
/* Implement this for gesture broadcast */
DEBUG("atspi bus broadcast callback");
if (!conn) return -1;
- if (!iface) return -1;
+ if (!g_context->iface) return -1;
//PRODUCT_ONLY(30JAN2019): disable gesture on Zoom mode.
E_Zone *zone = NULL;
}
//
- eldbus_service_signal_emit(iface, GESTURE_DETECTED_SIGNAL, (int)gi->type, gi->x_beg, gi->y_beg,
+ eldbus_service_signal_emit(g_context->iface, GESTURE_DETECTED_SIGNAL, (int)gi->type, gi->x_beg, gi->y_beg,
gi->x_end, gi->y_end, gi->state, gi->event_time);
INFO("GestureDetected %s %d (%d %d %d %d %d %u)", gesture_enum_to_string(gi->type),
#define HANDLER_APPEND(event, cb) \
handlers = eina_list_append( \
handlers, ecore_event_handler_add(event, cb, NULL));
- HANDLER_APPEND(E_EVENT_ATSPI_GESTURE_DETECTED, _gesture_cb);
+ HANDLER_APPEND(g_context->e_event_atspi_gesture_detected, _gesture_cb);
/* Use this list for other handlers */
#undef HANDLER_APPEND
}
static Eldbus_Message *
_is_slider(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
- if (!eldbus_message_arguments_get(msg, "b", &is_slider))
+ if (!eldbus_message_arguments_get(msg, "b", &g_context->is_slider))
ERROR("eldbus_message_arguments_get() error\n");
return NULL;
static Eldbus_Message *
_highlighted_object_info(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
- if (!eldbus_message_arguments_get(msg, "ii", &highlighted_object_x, &highlighted_object_y))
+ if (!eldbus_message_arguments_get(msg, "ii", &g_context->highlighted_object_x, &g_context->highlighted_object_y))
ERROR("eldbus_message_arguments_get() error\n");
return NULL;
static Eldbus_Message *
_is_selection_mode(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
- if (!eldbus_message_arguments_get(msg, "b", &is_selection_mode))
+ if (!eldbus_message_arguments_get(msg, "b", &g_context->is_selection_mode))
ERROR("eldbus_message_arguments_get() error\n");
return NULL;
static Eldbus_Message *
_object_needs_scroll_gesture(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
- if (!eldbus_message_arguments_get(msg, "ii", &object_needs_scroll_from_x, &object_needs_scroll_from_y))
+ if (!eldbus_message_arguments_get(msg, "ii", &g_context->object_needs_scroll_from_x, &g_context->object_needs_scroll_from_y))
ERROR("eldbus_message_arguments_get() error\n");
return NULL;
ELDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE,
_on_name_cb, NULL);
- iface = eldbus_service_interface_register(conn,
+ g_context->iface = eldbus_service_interface_register(conn,
E_A11Y_SERVICE_NAVI_OBJ_PATH, &iface_desc);
}
else
return &log_dom;
}
+Context_Info *_context_get(void)
+{
+ static Context_Info context;
+
+ return &context;
+}
+
int _e_mod_log_init(void)
{
if (!_eina_log_dom)
};
typedef struct _Cover Cover;
-int E_EVENT_ATSPI_GESTURE_DETECTED;
-
static Cover *cover;
static Ecore_Event_Filter *ef;
static Ecore_Event_Handler *eh;
info->state = gesture_state_enum_to_int(state);
info->event_time = event_time;
- ecore_event_add(E_EVENT_ATSPI_GESTURE_DETECTED, info, _gesture_info_free, NULL);
+ ecore_event_add(g_context->e_event_atspi_gesture_detected, info, _gesture_info_free, NULL);
}
static void
}
memcpy(ev_down, cov->flick_gesture.ev_first_down, sizeof(Ecore_Event_Mouse_Button));
- if (object_needs_scroll_from_x != -1 && object_needs_scroll_from_y != -1)
+ if (g_context->object_needs_scroll_from_x != -1 && g_context->object_needs_scroll_from_y != -1)
{
- cov->flick_gesture.ev_first_down->x = object_needs_scroll_from_x;
- cov->flick_gesture.ev_first_down->y = object_needs_scroll_from_y;
- cov->flick_gesture.object_needs_scroll_x_delta = object_needs_scroll_from_x - cov->flick_gesture.x_org[0];
- cov->flick_gesture.object_needs_scroll_y_delta = object_needs_scroll_from_y - cov->flick_gesture.y_org[0];
+ cov->flick_gesture.ev_first_down->x = g_context->object_needs_scroll_from_x;
+ cov->flick_gesture.ev_first_down->y = g_context->object_needs_scroll_from_y;
+ cov->flick_gesture.object_needs_scroll_x_delta = g_context->object_needs_scroll_from_x - cov->flick_gesture.x_org[0];
+ cov->flick_gesture.object_needs_scroll_y_delta = g_context->object_needs_scroll_from_y - cov->flick_gesture.y_org[0];
}
else
{
break;
}
if (i == 1 && cov->n_taps == 2) {
- if (!is_selection_mode && scrolling &&
+ if (!g_context->is_selection_mode && scrolling &&
(cov->flick_gesture.flick_to_scroll ||
_flick_to_scroll_gesture_conditions_met(ev, cov->flick_gesture.timestamp[i], dx, dy))) {
if (!cov->flick_gesture.flick_to_scroll) {
}
/* start_scroll is necessary for mouse down event */
- if (!is_selection_mode && !cov->flick_gesture.flick_to_scroll) {
+ if (!g_context->is_selection_mode && !cov->flick_gesture.flick_to_scroll) {
start_scroll(cov);
cov->flick_gesture.flick_to_scroll = EINA_TRUE;
}
static void
_hover_event_emit(Cover *cov, gesture_state_e state)
{
- if (cov->tap_n_hold_gesture_data.double_tap && !is_slider)
+ if (cov->tap_n_hold_gesture_data.double_tap && !g_context->is_slider)
{
- if (highlighted_object_x != -1 && highlighted_object_y != -1)
+ if (g_context->highlighted_object_x != -1 && g_context->highlighted_object_y != -1)
{
- __inverse_transform_coordinates(&highlighted_object_x, &highlighted_object_y);
- cov->tap_n_hold_gesture_data.ev_down->x = highlighted_object_x;
- cov->tap_n_hold_gesture_data.ev_down->y = highlighted_object_y;
- cov->tap_n_hold_gesture_data.ev_down->root.x = highlighted_object_x;
- cov->tap_n_hold_gesture_data.ev_down->root.y = highlighted_object_y;
- cov->tap_n_hold_gesture_data.drag_x_delta = highlighted_object_x - cov->hover_gesture.x[0];
- cov->tap_n_hold_gesture_data.drag_y_delta = highlighted_object_y - cov->hover_gesture.y[0];
+ __inverse_transform_coordinates(&g_context->highlighted_object_x, &g_context->highlighted_object_y);
+ cov->tap_n_hold_gesture_data.ev_down->x = g_context->highlighted_object_x;
+ cov->tap_n_hold_gesture_data.ev_down->y = g_context->highlighted_object_y;
+ cov->tap_n_hold_gesture_data.ev_down->root.x = g_context->highlighted_object_x;
+ cov->tap_n_hold_gesture_data.ev_down->root.y = g_context->highlighted_object_y;
+ cov->tap_n_hold_gesture_data.drag_x_delta = g_context->highlighted_object_x - cov->hover_gesture.x[0];
+ cov->tap_n_hold_gesture_data.drag_y_delta = g_context->highlighted_object_y - cov->hover_gesture.y[0];
}
else
{
cover->event_time = ev->timestamp;
if (ev->multi.radius >= MAGIC_NUMBER ||
cover->tap_n_hold_gesture_data.drag_start ||
- (cover->flick_gesture.flick_to_scroll && !is_selection_mode))
+ (cover->flick_gesture.flick_to_scroll && !g_context->is_selection_mode))
{
/* Do not use 2nd finger when highlight object needs scroll.
The changed event point info by object_needs_scroll_x,y_delta could be out of screen */
- if (object_needs_scroll_from_x != -1 && ev->multi.device != 0) return EINA_FALSE;
+ if (g_context->object_needs_scroll_from_x != -1 && ev->multi.device != 0) return EINA_FALSE;
if (ev->multi.radius >= MAGIC_NUMBER) ev->multi.radius -= MAGIC_NUMBER;
else
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev_multi_up, NULL, NULL);
}
cover->tap_n_hold_gesture_data.drag_start = EINA_FALSE;
- highlighted_object_x = -1;
- highlighted_object_y = -1;
+ g_context->highlighted_object_x = -1;
+ g_context->highlighted_object_y = -1;
}
- if (is_slider) is_slider = EINA_FALSE;
+ if (g_context->is_slider) g_context->is_slider = EINA_FALSE;
cover->n_taps--;
cover->event_time = ev->timestamp;
_events_init(void)
{
ef = ecore_event_filter_add(NULL, _event_filter, NULL, NULL);
- if (!E_EVENT_ATSPI_GESTURE_DETECTED)
- E_EVENT_ATSPI_GESTURE_DETECTED = ecore_event_type_new();
+ if (!g_context->e_event_atspi_gesture_detected)
+ g_context->e_event_atspi_gesture_detected = ecore_event_type_new();
eh = ecore_event_handler_add(E_EVENT_CLIENT_ROTATION_CHANGE_END, _rotation_cb_change_end, (void*)cover);
}
ERROR("Fatal Memory error!");
return;
}
- is_slider = EINA_FALSE;
+ g_context->is_slider = EINA_FALSE;
app_support_gestures = EINA_FALSE;
int i;
for (i = 0; i < GESTURES_COUNT; ++i)
gestures_supported_by_app[i] = EINA_FALSE;
- highlighted_object_x = -1;
- highlighted_object_y = -1;
- object_needs_scroll_from_x = -1;
- object_needs_scroll_from_y = -1;
+ g_context->highlighted_object_x = -1;
+ g_context->highlighted_object_y = -1;
+ g_context->object_needs_scroll_from_x = -1;
+ g_context->object_needs_scroll_from_y = -1;
scrolling = EINA_FALSE;
_last_hover_event_time = -1;
unsigned int event_time; //time stamp for the event
} Gesture_Info;
-extern Eina_Bool is_slider;
-extern int highlighted_object_x, highlighted_object_y;
-extern Eina_Bool is_selection_mode;
-extern int object_needs_scroll_from_x, object_needs_scroll_from_y;
+typedef struct {
+ Eldbus_Service_Interface *iface;
+ Eina_Bool is_slider;
+ Eina_Bool is_selection_mode;
+ int highlighted_object_x, highlighted_object_y;
+ int object_needs_scroll_from_x, object_needs_scroll_from_y;
+ int device_number_shift;
+ int e_event_atspi_gesture_detected;
+} Context_Info;
+
+Context_Info *_context_get(void);
+#define g_context _context_get()
const char *gesture_enum_to_string(Gesture g);
void app_gesture_support (char *msg);
int _e_mod_log_init(void);
void _e_mod_log_shutdown(void);
-extern int E_EVENT_ATSPI_GESTURE_DETECTED;
-
int _e_mod_atspi_gestures_init(void);
int _e_mod_atspi_gestures_shutdown(void);
// constant below allows to distinguish the origin of mouse events between one created in this module and the one created by user
#define DEVICE_NUMBER_OFFSET 2048
-extern Eldbus_Service_Interface *iface;
-extern int device_number_shift;
-
static Ecore_Event_Filter *screen_switch_provider_filter = NULL;
static Ecore_Event_Filter *accessories_switch_provider_filter = NULL;
static Ecore_Event_Filter *back_button_filter = NULL;
}
if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
- eldbus_service_signal_emit(iface, MOUSE_DOWN_SIGNAL, ev->multi.device);
+ eldbus_service_signal_emit(g_context->iface, MOUSE_DOWN_SIGNAL, ev->multi.device);
else
- eldbus_service_signal_emit(iface, MOUSE_UP_SIGNAL, ev->multi.device);
+ eldbus_service_signal_emit(g_context->iface, MOUSE_UP_SIGNAL, ev->multi.device);
return EINA_FALSE;
}
return EINA_TRUE;
if (type == ECORE_EVENT_KEY_DOWN)
- eldbus_service_signal_emit(iface, KEY_DOWN_SIGNAL, ev->key);
+ eldbus_service_signal_emit(g_context->iface, KEY_DOWN_SIGNAL, ev->key);
else
- eldbus_service_signal_emit(iface, KEY_UP_SIGNAL, ev->key);
+ eldbus_service_signal_emit(g_context->iface, KEY_UP_SIGNAL, ev->key);
return EINA_FALSE;
}
return EINA_TRUE;
if (type == ECORE_EVENT_KEY_DOWN)
- eldbus_service_signal_emit(iface, BACK_BUTTON_DOWN_SIGNAL);
+ eldbus_service_signal_emit(g_context->iface, BACK_BUTTON_DOWN_SIGNAL);
else
- eldbus_service_signal_emit(iface, BACK_BUTTON_UP_SIGNAL);
+ eldbus_service_signal_emit(g_context->iface, BACK_BUTTON_UP_SIGNAL);
return EINA_FALSE;
}
&& ev->root.y >= context_menu_rectangle.y_tl
&& ev->root.y <= context_menu_rectangle.y_br)
{
- eldbus_service_signal_emit(iface, MENU_MOUSE_DOWN_SIGNAL, ev->root.x, ev->root.y);
+ eldbus_service_signal_emit(g_context->iface, MENU_MOUSE_DOWN_SIGNAL, ev->root.x, ev->root.y);
return EINA_FALSE;
}
if (type == ECORE_EVENT_MOUSE_BUTTON_UP)
{
- eldbus_service_signal_emit(iface, MENU_MOUSE_UP_SIGNAL, ev->root.x, ev->root.y);
+ eldbus_service_signal_emit(g_context->iface, MENU_MOUSE_UP_SIGNAL, ev->root.x, ev->root.y);
return EINA_TRUE;
}
return;
screen_switch_provider_filter = ecore_event_filter_add(NULL, _ssp_filter, NULL, NULL);
- device_number_shift = DEVICE_NUMBER_OFFSET;
+ g_context->device_number_shift = DEVICE_NUMBER_OFFSET;
}
void _ssp_submodule_shutdown()
ecore_event_filter_del(screen_switch_provider_filter);
screen_switch_provider_filter = NULL;
- device_number_shift = 0;
+ g_context->device_number_shift = 0;
}
Eina_Bool _is_screen_switch_provider_enabledd()