Create global context structure 81/242881/3 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.113315 accepted/tizen/6.0/unified/hotfix/20201103.001158 accepted/tizen/unified/20200907.045059 submit/tizen/20200906.212734 submit/tizen_6.0/20201029.205105 submit/tizen_6.0_hotfix/20201102.192505 submit/tizen_6.0_hotfix/20201103.114805 tizen_6.0.m2_release
authorArtur Świgoń <a.swigon@samsung.com>
Tue, 1 Sep 2020 13:50:27 +0000 (15:50 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Wed, 2 Sep 2020 14:39:32 +0000 (16:39 +0200)
Change-Id: Ied639a8421db9aa4ad565f4da27996fafaf028b1

src/e_dispatch_gesture_event.c
src/e_mod_main.c
src/e_screen_reader_gestures.c
src/e_screen_reader_private.h
src/e_universal_switch.c

index 60d49d9..e693bca 100644 (file)
@@ -5,7 +5,6 @@
 
 #define STEP_DURATION 0.01
 
-int device_number_shift;
 static Eina_Bool during_gesture;
 
 typedef struct _GestureCommand {
@@ -41,7 +40,7 @@ static void _dispatch_mouse_move_event(int x, int y, int device)
    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;
@@ -76,7 +75,7 @@ static void _dispatch_mouse_down_event(int x, int y, int device)
    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;
@@ -111,7 +110,7 @@ static void _dispatch_mouse_up_event(int x, int y, int device)
    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;
index a43a453..b031c4c 100644 (file)
@@ -24,11 +24,6 @@ static Eina_List *handlers;
 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,
@@ -219,7 +214,7 @@ int _e_mod_atspi_dbus_broadcast(Gesture_Info *gi)
    /* 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;
@@ -238,7 +233,7 @@ int _e_mod_atspi_dbus_broadcast(Gesture_Info *gi)
     }
 //
 
-   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),
@@ -266,7 +261,7 @@ _atspi_gesture_init(void)
 #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
 }
@@ -408,7 +403,7 @@ _back_button_interception_enabled(const Eldbus_Service_Interface *iface, const E
 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;
@@ -433,7 +428,7 @@ _is_app_gesture_support(const Eldbus_Service_Interface *iface, const Eldbus_Mess
 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;
@@ -442,7 +437,7 @@ _highlighted_object_info(const Eldbus_Service_Interface *iface, const Eldbus_Mes
 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;
@@ -451,7 +446,7 @@ _is_selection_mode(const Eldbus_Service_Interface *iface, const Eldbus_Message *
 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;
@@ -561,7 +556,7 @@ _dbus_init_done(void *data, int type, void *event)
                                  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
@@ -624,6 +619,13 @@ int *_eina_log_dom_get(void)
    return &log_dom;
 }
 
+Context_Info *_context_get(void)
+{
+   static Context_Info context;
+
+   return &context;
+}
+
 int _e_mod_log_init(void)
 {
    if (!_eina_log_dom)
index 02c59f8..38cdadd 100644 (file)
@@ -99,8 +99,6 @@ struct _Cover
 };
 typedef struct _Cover Cover;
 
-int E_EVENT_ATSPI_GESTURE_DETECTED;
-
 static Cover *cover;
 static Ecore_Event_Filter *ef;
 static Ecore_Event_Handler *eh;
@@ -281,7 +279,7 @@ static void _event_emit(Gesture g, int x, int y, int x_e, int y_e, gesture_state
    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
@@ -631,12 +629,12 @@ start_scroll(Cover *cov)
      }
    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
      {
@@ -698,7 +696,7 @@ _flick_gesture_mouse_move(Ecore_Event_Mouse_Move *ev, Cover *cov)
                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) {
@@ -905,7 +903,7 @@ _hover_gesture_mouse_down(Ecore_Event_Mouse_Button *ev, Cover *cov)
                }
 
                /* 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;
                }
@@ -988,17 +986,17 @@ void __inverse_transform_coordinates(int *ax, int *ay)
 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
           {
@@ -1464,11 +1462,11 @@ _mouse_move(int type, Ecore_Event_Mouse_Move *event)
    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
@@ -1553,10 +1551,10 @@ _mouse_button_up(int type, Ecore_Event_Mouse_Button *event)
              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;
 
@@ -1627,8 +1625,8 @@ static void
 _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);
 }
 
@@ -1649,15 +1647,15 @@ _gesture_init()
         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;
 
index 39096a0..df76eb5 100644 (file)
@@ -67,10 +67,18 @@ typedef struct {
      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);
@@ -78,8 +86,6 @@ 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);
 
index a93c415..56b82ba 100644 (file)
@@ -6,9 +6,6 @@
 // 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;
@@ -32,9 +29,9 @@ static Eina_Bool _ssp_filter(void *data, void *loop_data, int type, void *event)
             }
 
          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;
       }
@@ -79,9 +76,9 @@ static Eina_Bool _asp_filter(void *data, void *loop_data, int type, void *event)
       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;
 }
@@ -97,9 +94,9 @@ static Eina_Bool _bbi_filter(void *data, void *loop_data, int type, void *event)
       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;
 }
@@ -121,13 +118,13 @@ static Eina_Bool _cm_filter(void *data, void *loop_data, int type, void *event)
            && 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;
      }
 
@@ -140,7 +137,7 @@ void _ssp_submodule_init()
       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()
@@ -150,7 +147,7 @@ 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()