Fix invalid device pointer in DispatchGestureEvent 96/209596/2 accepted/tizen/unified/20190711.062832 submit/tizen/20190710.050854
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Tue, 9 Jul 2019 07:35:40 +0000 (09:35 +0200)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Tue, 9 Jul 2019 07:39:21 +0000 (09:39 +0200)
Change-Id: I937b336be11de4c0e3058dc67059ff8107435f08

src/e_dispatch_gesture_event.c
src/e_dispatch_key_event.c
src/e_dispatch_rotary_event.c
src/e_mod_utils.c
src/e_mod_utils.h

index d3d931d..8d4a8c6 100644 (file)
@@ -46,7 +46,7 @@ static void _dispatch_mouse_move_event(int x, int y, int device)
    ev->event_window = e_comp->ee_win;
    ev->root_window = e_comp->ee_win;
    ev->same_screen = 1;
-   ev->dev = _get_device();
+   ev->dev = _get_device(ECORE_DEVICE_CLASS_TOUCH);
 
    ev->multi.radius = 1;
    ev->multi.radius_x = 1;
@@ -81,7 +81,7 @@ static void _dispatch_mouse_down_event(int x, int y, int device)
    ev->event_window = e_comp->ee_win;
    ev->root_window = e_comp->ee_win;
    ev->same_screen = 1;
-   ev->dev = _get_device();
+   ev->dev = _get_device(ECORE_DEVICE_CLASS_TOUCH);
 
    ev->multi.radius = 1;
    ev->multi.radius_x = 1;
@@ -116,7 +116,7 @@ static void _dispatch_mouse_up_event(int x, int y, int device)
    ev->event_window = e_comp->ee_win;
    ev->root_window = e_comp->ee_win;
    ev->same_screen = 1;
-   ev->dev = _get_device();
+   ev->dev = _get_device(ECORE_DEVICE_CLASS_TOUCH);
 
    ev->multi.radius = 1;
    ev->multi.radius_x = 1;
index ff785be..6acf199 100644 (file)
@@ -33,7 +33,7 @@ _create_key_event(KeyEventData *ked)
    ev->event_window = e_comp->ee_win;
    ev->root_window = e_comp->ee_win;
    ev->same_screen = 1;
-   ev->dev = _get_device();
+   ev->dev = _get_device(ECORE_DEVICE_CLASS_KEYBOARD);
    ev->keycode = ked->keycode;
 
    return ev;
index b3eaa59..3d6dfc5 100644 (file)
@@ -35,7 +35,11 @@ _create_wheel_event(int z_coordinate)
    ev->root.x = CONST_COORDINATE;
    ev->root.y = CONST_COORDINATE;
 
-   ev->dev = _get_device();
+   Ecore_Device *dev = _get_device(ECORE_DEVICE_CLASS_NONE);
+   if (!dev)
+      dev = _get_device(ECORE_DEVICE_CLASS_MOUSE);
+
+   ev->dev = dev;
 
    return ev;
 }
index 3eaad57..06f2888 100644 (file)
@@ -50,10 +50,8 @@ void _transform_coordinates(int *ax, int *ay)
     }
 }
 
-//FIXME: return proper device according to required type
-Ecore_Device * _get_device()
+Ecore_Device * _get_device(Ecore_Device_Class klass)
 {
-   Ecore_Device *ret = NULL;
    const Eina_List *dev_list = ecore_device_list();
    if (!dev_list) return NULL;
 
@@ -65,12 +63,11 @@ Ecore_Device * _get_device()
         const char *identifier = ecore_device_identifier_get(dev);
         if (!identifier) continue;
 
-        //FIXME: ECORE_DEVICE_CLASS_NONE is used on emulator
-        if (ecore_device_class_get(dev) == ECORE_DEVICE_CLASS_MOUSE || ecore_device_class_get(dev) == ECORE_DEVICE_CLASS_NONE)
-          ret = dev;
+        if (ecore_device_class_get(dev) == klass)
+          return dev;
      }
 
-   return ret;
+   return NULL;
 }
 
 typedef struct _keycode_map_entry{
index 709dcdb..37fb638 100644 (file)
@@ -7,7 +7,7 @@
 
 int _get_window_angle(void);
 void _transform_coordinates(int *ax, int *ay);
-Ecore_Device * _get_device();
+Ecore_Device * _get_device(Ecore_Device_Class klass);
 int _get_keycode_from_string(const char *key);
 
 #endif